@pisell/pisellos 2.2.244 → 2.2.245

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 (317) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
  2. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  3. package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
  4. package/dist/modules/BookingContext/index.d.ts +48 -0
  5. package/dist/modules/BookingContext/index.js +566 -0
  6. package/dist/modules/BookingContext/types.d.ts +102 -0
  7. package/dist/modules/BookingContext/types.js +51 -0
  8. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  9. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +284 -0
  10. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  11. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +145 -0
  12. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  13. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +218 -0
  14. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  15. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  16. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  17. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  18. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  19. package/dist/modules/BookingContext/utils/index.js +11 -0
  20. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  21. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  22. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  23. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  24. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  25. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  26. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  27. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  28. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  29. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  30. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  31. package/dist/modules/BookingContext/utils/resources.js +486 -0
  32. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  33. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  34. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  35. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  36. package/dist/modules/Cart/utils/cartProduct.js +24 -3
  37. package/dist/modules/Cart/utils/changePrice.js +11 -11
  38. package/dist/modules/Customer/index.d.ts +20 -0
  39. package/dist/modules/Customer/index.js +172 -83
  40. package/dist/modules/Customer/types.d.ts +2 -0
  41. package/dist/modules/Discount/index.d.ts +1 -1
  42. package/dist/modules/Discount/index.js +13 -6
  43. package/dist/modules/Discount/types.d.ts +1 -0
  44. package/dist/modules/OpenData/index.d.ts +8 -0
  45. package/dist/modules/OpenData/index.js +37 -17
  46. package/dist/modules/Order/index.d.ts +275 -19
  47. package/dist/modules/Order/index.js +3493 -809
  48. package/dist/modules/Order/types.d.ts +286 -31
  49. package/dist/modules/Order/types.js +38 -0
  50. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  51. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  52. package/dist/modules/Order/utils.d.ts +147 -5
  53. package/dist/modules/Order/utils.js +750 -104
  54. package/dist/modules/Payment/index.d.ts +10 -13
  55. package/dist/modules/Payment/index.js +467 -837
  56. package/dist/modules/Payment/types.d.ts +2 -0
  57. package/dist/modules/Payment/utils.js +2 -1
  58. package/dist/modules/Payment/walletpass.js +41 -25
  59. package/dist/modules/ProductList/index.d.ts +16 -12
  60. package/dist/modules/ProductList/index.js +133 -59
  61. package/dist/modules/ProductList/types.d.ts +14 -0
  62. package/dist/modules/Quotation/index.d.ts +0 -1
  63. package/dist/modules/Quotation/index.js +25 -22
  64. package/dist/modules/Rules/index.d.ts +4 -0
  65. package/dist/modules/Rules/index.js +97 -70
  66. package/dist/modules/Rules/types.d.ts +1 -0
  67. package/dist/modules/SalesSummary/index.d.ts +8 -25
  68. package/dist/modules/SalesSummary/index.js +86 -35
  69. package/dist/modules/SalesSummary/types.d.ts +4 -1
  70. package/dist/modules/SalesSummary/utils.d.ts +2 -25
  71. package/dist/modules/SalesSummary/utils.js +794 -162
  72. package/dist/modules/Schedule/index.d.ts +7 -0
  73. package/dist/modules/Schedule/index.js +24 -2
  74. package/dist/modules/Summary/index.js +4 -3
  75. package/dist/modules/SurchargeList/index.d.ts +16 -0
  76. package/dist/modules/SurchargeList/index.js +162 -0
  77. package/dist/modules/SurchargeList/types.d.ts +11 -0
  78. package/dist/modules/SurchargeList/types.js +1 -0
  79. package/dist/modules/index.d.ts +2 -0
  80. package/dist/modules/index.js +3 -1
  81. package/dist/plugins/request.d.ts +1 -0
  82. package/dist/server/index.d.ts +204 -1
  83. package/dist/server/index.js +3654 -922
  84. package/dist/server/modules/index.d.ts +2 -0
  85. package/dist/server/modules/index.js +2 -0
  86. package/dist/server/modules/order/index.d.ts +120 -3
  87. package/dist/server/modules/order/index.js +1758 -448
  88. package/dist/server/modules/order/types.d.ts +32 -3
  89. package/dist/server/modules/order/types.js +8 -0
  90. package/dist/server/modules/order/utils/filterBookings.js +26 -3
  91. package/dist/server/modules/order/utils/filterOrders.js +23 -8
  92. package/dist/server/modules/payment/index.d.ts +28 -0
  93. package/dist/server/modules/payment/index.js +305 -0
  94. package/dist/server/modules/payment/types.d.ts +9 -0
  95. package/dist/server/modules/payment/types.js +1 -0
  96. package/dist/server/modules/products/index.d.ts +34 -7
  97. package/dist/server/modules/products/index.js +631 -317
  98. package/dist/server/modules/resource/index.d.ts +2 -0
  99. package/dist/server/modules/resource/index.js +29 -3
  100. package/dist/server/modules/schedule/index.d.ts +4 -4
  101. package/dist/server/modules/schedule/index.js +111 -88
  102. package/dist/server/test.json +713 -0
  103. package/dist/server/utils/small-ticket.d.ts +71 -0
  104. package/dist/server/utils/small-ticket.js +840 -0
  105. package/dist/solution/BaseSales/index.d.ts +133 -10
  106. package/dist/solution/BaseSales/index.js +1950 -447
  107. package/dist/solution/BaseSales/types.d.ts +82 -6
  108. package/dist/solution/BaseSales/types.js +5 -4
  109. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  110. package/dist/solution/BaseSales/utils/cartPromotion.js +1438 -0
  111. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  112. package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
  113. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  114. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +105 -24
  115. package/dist/solution/BaseSales/utils.d.ts +1 -1
  116. package/dist/solution/BaseSales/utils.js +62 -21
  117. package/dist/solution/BookingByStep/index.d.ts +1 -1
  118. package/dist/solution/BookingTicket/index.d.ts +271 -11
  119. package/dist/solution/BookingTicket/index.js +1777 -242
  120. package/dist/solution/BookingTicket/types.d.ts +118 -1
  121. package/dist/solution/BookingTicket/types.js +41 -2
  122. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  123. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  124. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  125. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  126. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  127. package/dist/solution/BookingTicket/utils/bookingStatus.js +70 -0
  128. package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
  129. package/dist/solution/BookingTicket/utils/cartView.js +94 -7
  130. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  131. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  132. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  133. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  134. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  135. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  136. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  137. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  138. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  139. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  140. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  141. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  142. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  143. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  144. package/dist/solution/Checkout/index.d.ts +1 -0
  145. package/dist/solution/Checkout/index.js +10 -9
  146. package/dist/solution/RegisterAndLogin/config.js +2 -10
  147. package/dist/solution/ScanOrder/index.d.ts +9 -3
  148. package/dist/solution/ScanOrder/index.js +241 -134
  149. package/dist/solution/ScanOrder/types.d.ts +9 -5
  150. package/dist/solution/ScanOrder/types.js +2 -3
  151. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  152. package/dist/solution/ScanOrder/utils.js +84 -22
  153. package/dist/solution/VenueBooking/index.d.ts +5 -2
  154. package/dist/solution/VenueBooking/index.js +110 -59
  155. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  156. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  157. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  158. package/dist/types/index.d.ts +10 -0
  159. package/lib/model/strategy/adapter/promotion/evaluator.js +2 -1
  160. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  161. package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
  162. package/lib/modules/BookingContext/index.d.ts +48 -0
  163. package/lib/modules/BookingContext/index.js +368 -0
  164. package/lib/modules/BookingContext/types.d.ts +102 -0
  165. package/lib/modules/BookingContext/types.js +34 -0
  166. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  167. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
  168. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  169. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +151 -0
  170. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  171. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +201 -0
  172. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  173. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  174. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  175. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  176. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  177. package/lib/modules/BookingContext/utils/index.js +43 -0
  178. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  179. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  180. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  181. package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
  182. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  183. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  184. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  185. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  186. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  187. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  188. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  189. package/lib/modules/BookingContext/utils/resources.js +377 -0
  190. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  191. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  192. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  193. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  194. package/lib/modules/Cart/utils/cartProduct.js +20 -3
  195. package/lib/modules/Cart/utils/changePrice.js +12 -20
  196. package/lib/modules/Customer/index.d.ts +20 -0
  197. package/lib/modules/Customer/index.js +64 -11
  198. package/lib/modules/Customer/types.d.ts +2 -0
  199. package/lib/modules/Discount/index.d.ts +1 -1
  200. package/lib/modules/Discount/index.js +9 -1
  201. package/lib/modules/Discount/types.d.ts +1 -0
  202. package/lib/modules/OpenData/index.d.ts +8 -0
  203. package/lib/modules/OpenData/index.js +19 -5
  204. package/lib/modules/Order/index.d.ts +275 -19
  205. package/lib/modules/Order/index.js +2245 -336
  206. package/lib/modules/Order/types.d.ts +286 -31
  207. package/lib/modules/Order/types.js +1 -0
  208. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  209. package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
  210. package/lib/modules/Order/utils.d.ts +147 -5
  211. package/lib/modules/Order/utils.js +615 -46
  212. package/lib/modules/Payment/index.d.ts +10 -13
  213. package/lib/modules/Payment/index.js +18 -150
  214. package/lib/modules/Payment/types.d.ts +2 -0
  215. package/lib/modules/Payment/utils.js +2 -1
  216. package/lib/modules/Payment/walletpass.js +16 -3
  217. package/lib/modules/ProductList/index.d.ts +16 -12
  218. package/lib/modules/ProductList/index.js +41 -4
  219. package/lib/modules/ProductList/types.d.ts +14 -0
  220. package/lib/modules/Quotation/index.d.ts +0 -1
  221. package/lib/modules/Quotation/index.js +19 -16
  222. package/lib/modules/Rules/index.d.ts +4 -0
  223. package/lib/modules/Rules/index.js +137 -120
  224. package/lib/modules/Rules/types.d.ts +1 -0
  225. package/lib/modules/SalesSummary/index.d.ts +8 -25
  226. package/lib/modules/SalesSummary/index.js +30 -4
  227. package/lib/modules/SalesSummary/types.d.ts +4 -1
  228. package/lib/modules/SalesSummary/utils.d.ts +2 -25
  229. package/lib/modules/SalesSummary/utils.js +645 -91
  230. package/lib/modules/Schedule/index.d.ts +7 -0
  231. package/lib/modules/Schedule/index.js +17 -1
  232. package/lib/modules/Summary/index.js +5 -4
  233. package/lib/modules/SurchargeList/index.d.ts +16 -0
  234. package/lib/modules/SurchargeList/index.js +89 -0
  235. package/lib/modules/SurchargeList/types.d.ts +11 -0
  236. package/lib/modules/SurchargeList/types.js +17 -0
  237. package/lib/modules/index.d.ts +2 -0
  238. package/lib/modules/index.js +5 -1
  239. package/lib/plugins/request.d.ts +1 -0
  240. package/lib/server/index.d.ts +204 -1
  241. package/lib/server/index.js +1891 -59
  242. package/lib/server/modules/index.d.ts +2 -0
  243. package/lib/server/modules/index.js +3 -0
  244. package/lib/server/modules/order/index.d.ts +120 -3
  245. package/lib/server/modules/order/index.js +883 -94
  246. package/lib/server/modules/order/types.d.ts +32 -3
  247. package/lib/server/modules/order/utils/filterBookings.js +24 -5
  248. package/lib/server/modules/order/utils/filterOrders.js +15 -6
  249. package/lib/server/modules/payment/index.d.ts +28 -0
  250. package/lib/server/modules/payment/index.js +192 -0
  251. package/lib/server/modules/payment/types.d.ts +9 -0
  252. package/lib/server/modules/payment/types.js +17 -0
  253. package/lib/server/modules/products/index.d.ts +34 -7
  254. package/lib/server/modules/products/index.js +189 -54
  255. package/lib/server/modules/resource/index.d.ts +2 -0
  256. package/lib/server/modules/resource/index.js +27 -3
  257. package/lib/server/modules/schedule/index.d.ts +4 -4
  258. package/lib/server/modules/schedule/index.js +47 -40
  259. package/lib/server/test.json +713 -0
  260. package/lib/server/utils/small-ticket.d.ts +71 -0
  261. package/lib/server/utils/small-ticket.js +800 -0
  262. package/lib/solution/BaseSales/index.d.ts +133 -10
  263. package/lib/solution/BaseSales/index.js +1111 -63
  264. package/lib/solution/BaseSales/types.d.ts +82 -6
  265. package/lib/solution/BaseSales/types.js +3 -1
  266. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  267. package/lib/solution/BaseSales/utils/cartPromotion.js +992 -0
  268. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  269. package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
  270. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  271. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +106 -18
  272. package/lib/solution/BaseSales/utils.d.ts +1 -1
  273. package/lib/solution/BaseSales/utils.js +54 -10
  274. package/lib/solution/BookingByStep/index.d.ts +1 -1
  275. package/lib/solution/BookingTicket/index.d.ts +271 -11
  276. package/lib/solution/BookingTicket/index.js +922 -29
  277. package/lib/solution/BookingTicket/types.d.ts +118 -1
  278. package/lib/solution/BookingTicket/types.js +11 -0
  279. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  280. package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
  281. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  282. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
  283. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  284. package/lib/solution/BookingTicket/utils/bookingStatus.js +44 -2
  285. package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
  286. package/lib/solution/BookingTicket/utils/cartView.js +61 -6
  287. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  288. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  289. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  290. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
  291. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  292. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
  293. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  294. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
  295. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  296. package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
  297. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  298. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
  299. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  300. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
  301. package/lib/solution/Checkout/index.d.ts +1 -0
  302. package/lib/solution/Checkout/index.js +1 -2
  303. package/lib/solution/RegisterAndLogin/config.js +2 -10
  304. package/lib/solution/ScanOrder/index.d.ts +9 -3
  305. package/lib/solution/ScanOrder/index.js +153 -70
  306. package/lib/solution/ScanOrder/types.d.ts +9 -5
  307. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  308. package/lib/solution/ScanOrder/utils.js +83 -17
  309. package/lib/solution/VenueBooking/index.d.ts +5 -2
  310. package/lib/solution/VenueBooking/index.js +54 -17
  311. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  312. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  313. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  314. package/lib/types/index.d.ts +10 -0
  315. package/package.json +1 -1
  316. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  317. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -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, buildPriceBreakdown } from "./utils/slotMerge";
48
- import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
47
+ import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildVenueResourceMetadata, buildPriceBreakdown } from "./utils/slotMerge";
48
+ import { composeLinePrice, createUuidV4, getProductSkuOptions, 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,6 +112,26 @@ 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
+ }
115
135
  }, {
116
136
  key: "serializeError",
117
137
  value: function serializeError(error) {
@@ -122,6 +142,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
122
142
  stack: error.stack
123
143
  };
124
144
  }
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
+ }
125
160
  return {
126
161
  message: String(error)
127
162
  };
@@ -246,8 +281,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
246
281
  value: function resolveCustomerIdFromLoginPayload(payload) {
247
282
  var _payload$user, _payload$user2, _payload$user3, _payload$user4, _payload$account, _payload$account2, _payload$account3, _payload$_origin;
248
283
  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];
249
- for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
250
- var candidate = _candidates[_i];
284
+ for (var _i2 = 0, _candidates2 = candidates; _i2 < _candidates2.length; _i2++) {
285
+ var candidate = _candidates2[_i2];
251
286
  var customerId = this.normalizeCustomerId(candidate);
252
287
  if (customerId) return customerId;
253
288
  }
@@ -499,12 +534,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
499
534
  var _this4$store$order, _this4$otherParams, _this4$otherParams2, _this4$otherParams3, _this4$otherParams4;
500
535
  _this4.store[step] = targetModule;
501
536
  var initialState = step === 'salesSummary' ? {
502
- // TODO(Order types): VenueBooking should read OrderState.summary instead of tempOrder.summary.
503
537
  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()
504
538
  } : {};
505
539
  var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.loggerProvider) || 'feishu';
506
540
  var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.loggerConfig) || {
507
- feishu: {}
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
+ }
508
545
  };
509
546
  _this4.core.registerModule(targetModule, {
510
547
  initialState: initialState,
@@ -829,24 +866,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
829
866
  }
830
867
  throw new Error('addonProducts 模块未初始化');
831
868
  case 6:
869
+ _context11.next = 8;
870
+ return this.loadOpenDataConfig();
871
+ case 8:
832
872
  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']) || [];
833
873
  if (associatedMenus.length) {
834
- _context11.next = 9;
874
+ _context11.next = 12;
835
875
  break;
836
876
  }
877
+ this.logMethodError('loadAllProducts', new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置'));
837
878
  throw new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置');
838
- case 9:
879
+ case 12:
839
880
  menuListIds = associatedMenus.map(function (n) {
840
881
  return Number(n.value);
841
882
  });
842
- _context11.next = 12;
883
+ _context11.next = 15;
843
884
  return this.store.venueProducts.loadProducts({
844
885
  menu_list_ids: menuListIds,
845
886
  cacheId: this.cacheId,
846
887
  schedule_date: dayjs().format('YYYY-MM-DD'),
847
888
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
848
889
  });
849
- case 12:
890
+ case 15:
850
891
  allProducts = _context11.sent;
851
892
  list = Array.isArray(allProducts) ? allProducts : [];
852
893
  venueList = list.filter(function (p) {
@@ -874,16 +915,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
874
915
  venueProducts: venueList,
875
916
  addonProducts: addonList
876
917
  });
877
- case 25:
878
- _context11.prev = 25;
918
+ case 28:
919
+ _context11.prev = 28;
879
920
  _context11.t0 = _context11["catch"](1);
880
921
  this.logMethodError('loadAllProducts', _context11.t0);
881
922
  throw _context11.t0;
882
- case 29:
923
+ case 32:
883
924
  case "end":
884
925
  return _context11.stop();
885
926
  }
886
- }, _callee11, this, [[1, 25]]);
927
+ }, _callee11, this, [[1, 28]]);
887
928
  }));
888
929
  function _doLoadAllProducts() {
889
930
  return _doLoadAllProducts2.apply(this, arguments);
@@ -995,7 +1036,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
995
1036
  key: "fetchResourceAvailability",
996
1037
  value: function () {
997
1038
  var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
998
- var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator2, _step2, item, _i2, _rawData, _item, mappings, _iterator3, _step3, mapping;
1039
+ var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator2, _step2, item, _i3, _rawData, _item, mappings, _iterator3, _step3, mapping;
999
1040
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1000
1041
  while (1) switch (_context15.prev = _context15.next) {
1001
1042
  case 0:
@@ -1063,13 +1104,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1063
1104
  }
1064
1105
  }
1065
1106
  this.store.rawResourceData = rawData;
1066
- _i2 = 0, _rawData = rawData;
1107
+ _i3 = 0, _rawData = rawData;
1067
1108
  case 24:
1068
- if (!(_i2 < _rawData.length)) {
1109
+ if (!(_i3 < _rawData.length)) {
1069
1110
  _context15.next = 34;
1070
1111
  break;
1071
1112
  }
1072
- _item = _rawData[_i2];
1113
+ _item = _rawData[_i3];
1073
1114
  mappings = this.resourceProductMap.get(_item.resourceId);
1074
1115
  if (mappings) {
1075
1116
  _context15.next = 29;
@@ -1090,7 +1131,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1090
1131
  _iterator3.f();
1091
1132
  }
1092
1133
  case 31:
1093
- _i2++;
1134
+ _i3++;
1094
1135
  _context15.next = 24;
1095
1136
  break;
1096
1137
  case 34:
@@ -1628,7 +1669,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1628
1669
  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,
1629
1670
  relation_id: resourceId,
1630
1671
  capacity: 1,
1631
- metadata: {}
1672
+ metadata: buildVenueResourceMetadata({
1673
+ mapping: mapping,
1674
+ rawResource: rawResource
1675
+ })
1632
1676
  };
1633
1677
  if (childRawResources && childRawResources.length) {
1634
1678
  resourceEntry.children = childRawResources.map(function (child) {
@@ -1682,7 +1726,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1682
1726
  product_variant_id: 0,
1683
1727
  num: 1,
1684
1728
  product_bundle: [],
1685
- product_option_item: [],
1729
+ product_sku: {
1730
+ option: []
1731
+ },
1686
1732
  discount_list: [],
1687
1733
  custom_deposit_data: customDepositData,
1688
1734
  metadata: {}
@@ -2139,7 +2185,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2139
2185
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
2140
2186
  return sum + (pd.amount || 0);
2141
2187
  }, 0);
2142
- optionSum = sumOptionUnitPrice(product.product_option_item);
2188
+ optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
2143
2189
  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';
2144
2190
  newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
2145
2191
  newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
@@ -2182,7 +2228,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2182
2228
  });
2183
2229
  case 50:
2184
2230
  this.store.order.persistTempOrder();
2185
- // TODO(Order types): VenueBooking should read OrderState.summary instead of tempOrder.summary.
2186
2231
  finalSummary = ((_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.summary) || null;
2187
2232
  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;
2188
2233
  this.logMethodSuccess('setDiscountSelected', params);
@@ -2250,7 +2295,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2250
2295
  key: "getOrderProducts",
2251
2296
  value: function getOrderProducts() {
2252
2297
  if (!this.store.order) throw new Error('order 模块未初始化');
2253
- return this.store.order.getOrderProducts();
2298
+ var products = this.store.order.getOrderProducts();
2299
+ return products;
2254
2300
  }
2255
2301
  }, {
2256
2302
  key: "getSummary",
@@ -2405,14 +2451,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2405
2451
  return addProductToOrder;
2406
2452
  }()
2407
2453
  }, {
2408
- key: "updateProductInOrder",
2454
+ key: "updateOrderProduct",
2409
2455
  value: function () {
2410
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2456
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2411
2457
  var products;
2412
2458
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2413
2459
  while (1) switch (_context26.prev = _context26.next) {
2414
2460
  case 0:
2415
- this.logMethodStart('updateProductInOrder', {
2461
+ this.logMethodStart('updateOrderProduct', {
2416
2462
  product_id: params.product_id,
2417
2463
  product_variant_id: params.product_variant_id
2418
2464
  });
@@ -2424,7 +2470,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2424
2470
  throw new Error('order 模块未初始化');
2425
2471
  case 4:
2426
2472
  _context26.next = 6;
2427
- return this.store.order.updateProductInOrder(params);
2473
+ return this.store.order.updateOrderProduct(params);
2428
2474
  case 6:
2429
2475
  products = _context26.sent;
2430
2476
  _context26.next = 9;
@@ -2433,14 +2479,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2433
2479
  _context26.next = 11;
2434
2480
  return this.refreshCartValidationPassed();
2435
2481
  case 11:
2436
- this.logMethodSuccess('updateProductInOrder', {
2482
+ this.logMethodSuccess('updateOrderProduct', {
2437
2483
  productCount: products.length
2438
2484
  });
2439
2485
  return _context26.abrupt("return", products);
2440
2486
  case 15:
2441
2487
  _context26.prev = 15;
2442
2488
  _context26.t0 = _context26["catch"](1);
2443
- this.logMethodError('updateProductInOrder', _context26.t0);
2489
+ this.logMethodError('updateOrderProduct', _context26.t0);
2444
2490
  throw _context26.t0;
2445
2491
  case 19:
2446
2492
  case "end":
@@ -2448,10 +2494,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2448
2494
  }
2449
2495
  }, _callee26, this, [[1, 15]]);
2450
2496
  }));
2451
- function updateProductInOrder(_x17) {
2452
- return _updateProductInOrder.apply(this, arguments);
2497
+ function updateOrderProduct(_x17) {
2498
+ return _updateOrderProduct.apply(this, arguments);
2453
2499
  }
2454
- return updateProductInOrder;
2500
+ return updateOrderProduct;
2455
2501
  }()
2456
2502
  }, {
2457
2503
  key: "removeProductFromOrder",
@@ -2498,7 +2544,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2498
2544
  }
2499
2545
  return _context27.abrupt("continue", 20);
2500
2546
  case 18:
2501
- // TODO(Order types): VenueBooking should use metadata.unique_identification_number only.
2502
2547
  if (product.identity_key) venueProductUids.add(String(product.identity_key));
2503
2548
  if ((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.booking_uid) {
2504
2549
  venueBookingUids.add(String(product.metadata.booking_uid));
@@ -2593,8 +2638,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2593
2638
  key: "loadOpenDataConfig",
2594
2639
  value: function () {
2595
2640
  var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2596
- var _this11 = this;
2597
- var lastFetchedAt, cachedData;
2641
+ var lastFetchedAt, cachedData, openDataConfig;
2598
2642
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2599
2643
  while (1) switch (_context29.prev = _context29.next) {
2600
2644
  case 0:
@@ -2614,27 +2658,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2614
2658
  return _context29.abrupt("return", cachedData);
2615
2659
  case 7:
2616
2660
  if (!this.loadOpenDataConfigInFlight) {
2617
- _context29.next = 9;
2661
+ _context29.next = 11;
2618
2662
  break;
2619
2663
  }
2620
- return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
2621
- case 9:
2664
+ _context29.next = 10;
2665
+ return this.loadOpenDataConfigInFlight;
2666
+ case 10:
2667
+ return _context29.abrupt("return", _context29.sent);
2668
+ case 11:
2622
2669
  this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
2623
2670
  scope: 'board',
2624
2671
  target: 'venue_booking+online_store',
2625
2672
  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;
2631
2673
  });
2632
- return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
2633
- case 11:
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:
2634
2686
  case "end":
2635
2687
  return _context29.stop();
2636
2688
  }
2637
- }, _callee29, this);
2689
+ }, _callee29, this, [[12,, 18, 21]]);
2638
2690
  }));
2639
2691
  function loadOpenDataConfig() {
2640
2692
  return _loadOpenDataConfig.apply(this, arguments);
@@ -2780,8 +2832,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2780
2832
  var key = buildProductKey(productId, normalizedVariantId);
2781
2833
  if (!sourceMap.has(key)) sourceMap.set(key, node);
2782
2834
  }
2783
- for (var _i3 = 0, _Object$values = Object.values(node); _i3 < _Object$values.length; _i3++) {
2784
- var childValue = _Object$values[_i3];
2835
+ for (var _i4 = 0, _Object$values = Object.values(node); _i4 < _Object$values.length; _i4++) {
2836
+ var childValue = _Object$values[_i4];
2785
2837
  if (childValue && _typeof(childValue) === 'object') collectFromValue(childValue);
2786
2838
  }
2787
2839
  };
@@ -2814,7 +2866,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2814
2866
  key: "ensureItemRuleConfigsLoaded",
2815
2867
  value: function () {
2816
2868
  var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2817
- var _this12 = this;
2869
+ var _this11 = this;
2818
2870
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2819
2871
  while (1) switch (_context34.prev = _context34.next) {
2820
2872
  case 0:
@@ -2835,19 +2887,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2835
2887
  return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2836
2888
  while (1) switch (_context33.prev = _context33.next) {
2837
2889
  case 0:
2838
- runtimeConfig = _this12.getItemRuleRuntimeConfig();
2890
+ runtimeConfig = _this11.getItemRuleRuntimeConfig();
2839
2891
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
2840
2892
  if (!(staticConfigs.length > 0)) {
2841
2893
  _context33.next = 6;
2842
2894
  break;
2843
2895
  }
2844
- _this12.itemRuleConfigs = staticConfigs;
2845
- _this12.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2846
- return _context33.abrupt("return", _this12.itemRuleConfigs);
2896
+ _this11.itemRuleConfigs = staticConfigs;
2897
+ _this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2898
+ return _context33.abrupt("return", _this11.itemRuleConfigs);
2847
2899
  case 6:
2848
- _this12.itemRuleConfigs = [];
2849
- _this12.itemRuleEvaluator.setStrategyConfigs([]);
2850
- return _context33.abrupt("return", _this12.itemRuleConfigs);
2900
+ _this11.itemRuleConfigs = [];
2901
+ _this11.itemRuleEvaluator.setStrategyConfigs([]);
2902
+ return _context33.abrupt("return", _this11.itemRuleConfigs);
2851
2903
  case 9:
2852
2904
  case "end":
2853
2905
  return _context33.stop();
@@ -3028,7 +3080,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3028
3080
  item_rule_prefill: true,
3029
3081
  item_rule_id: prefillItem.ruleId
3030
3082
  }),
3031
- // TODO(Order types): migrate VenueBooking prefill origin runtime into tempOrder._extend.
3032
3083
  _origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
3033
3084
  });
3034
3085
  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)))) {
@@ -3309,7 +3360,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3309
3360
  var raw = this.window.sessionStorage.getItem(key) || '{}';
3310
3361
  var parsed = JSON.parse(raw);
3311
3362
  return parsed && _typeof(parsed) === 'object' ? parsed : {};
3312
- } catch (_unused2) {
3363
+ } catch (_unused3) {
3313
3364
  return {};
3314
3365
  }
3315
3366
  }
@@ -71,8 +71,6 @@
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;↕;可选。",
76
74
  "selling_price": "50.00",
77
75
  "selling_price__comment": "销售单价(交易快照);string;←;服务端返回,不能依赖基准数据回填。",
78
76
  "original_price": "60.00",
@@ -12,6 +12,10 @@ 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>;
15
19
  export interface BuildVenueBookingParams {
16
20
  group: MergedSlotGroup;
17
21
  resourceId: number | string;
@@ -89,6 +89,16 @@ 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
+ }
92
102
  export function buildVenueBookingEntry(params) {
93
103
  var _rawResource$form_id;
94
104
  var group = params.group,
@@ -14,6 +14,16 @@ 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;
17
27
  destroy?: () => Promise<void> | void;
18
28
  exports?: Record<string, any>;
19
29
  isSolution?: boolean;
@@ -528,7 +528,8 @@ var PromotionEvaluator = class {
528
528
  return b.price - a.price;
529
529
  });
530
530
  const totalUnits = unitProducts.length;
531
- const groupCount = cumulative ? Math.floor(totalUnits / x) : totalUnits >= x ? 1 : 0;
531
+ const isCumulative = cumulative !== false;
532
+ const groupCount = isCumulative ? Math.floor(totalUnits / x) : totalUnits >= x ? 1 : 0;
532
533
  const promotionUnits = groupCount * x;
533
534
  const inPromotionUnits = unitProducts.slice(0, promotionUnits);
534
535
  const notInPromotionUnits = unitProducts.slice(promotionUnits);
@@ -0,0 +1,49 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
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
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/model/strategy/adapter/promotion/index.ts
30
+ var promotion_exports = {};
31
+ __export(promotion_exports, {
32
+ BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
+ PromotionAdapter: () => import_adapter.PromotionAdapter,
34
+ PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
35
+ X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
36
+ default: () => import_adapter2.default
37
+ });
38
+ module.exports = __toCommonJS(promotion_exports);
39
+ var import_evaluator = require("./evaluator");
40
+ var import_adapter = require("./adapter");
41
+ var import_adapter2 = __toESM(require("./adapter"));
42
+ var import_examples = require("./examples");
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ BUY_X_GET_Y_FREE_STRATEGY,
46
+ PromotionAdapter,
47
+ PromotionEvaluator,
48
+ X_ITEMS_FOR_Y_PRICE_STRATEGY
49
+ });
@@ -346,7 +346,8 @@ 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)
349
+ new import_decimal.default(maxDeductionAmount),
350
+ remainingOrderAmount
350
351
  );
351
352
  let deductionLeft = maxDeduction;
352
353
  const deductionDetails = [];
@@ -488,7 +489,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
488
489
  });
489
490
  return;
490
491
  }
491
- const usageAmount = typeof selectedVoucher.edit_current_amount === "number" ? selectedVoucher.edit_current_amount : getRecommendedAmount(selectedVoucher);
492
+ const usageAmount = typeof selectedVoucher.edit_current_amount === "number" ? selectedVoucher.edit_current_amount : selectedVoucher._available_max_amount ?? getRecommendedAmount(selectedVoucher);
492
493
  const maxDeduction = import_decimal.default.min(
493
494
  new import_decimal.default(usageAmount),
494
495
  new import_decimal.default(maxDeductionAmount),
@@ -0,0 +1,48 @@
1
+ import { Module, ModuleOptions, PisellCore } from '../../types';
2
+ import { BaseModule } from '../BaseModule';
3
+ import { BookingContextConfig, BookingContextDateInput, BookingContextModuleAPI, BookingContextResource, BookingContextResourceMap, BookingContextState, InitBookingContextParams, LoadBookingConfigParams, LoadBookingResourcesParams } from './types';
4
+ export * from './types';
5
+ export * from './utils';
6
+ /**
7
+ * 清理跨实例共享缓存,仅供单元测试隔离使用。
8
+ *
9
+ * @example
10
+ * __clearBookingContextSharedCacheForTest();
11
+ */
12
+ export declare function __clearBookingContextSharedCacheForTest(): void;
13
+ /** 稳定序列化 config 查询参数,用于判断是否与上次 loadBookingConfig 一致。 */
14
+ export declare function buildBookingConfigQueryKey(params?: LoadBookingConfigParams): string;
15
+ /** 稳定序列化资源列表查询(date + bookingIds),用于跳过重复 loadResources。 */
16
+ export declare function buildBookingResourcesQueryKey(params?: LoadBookingResourcesParams): string;
17
+ export declare class BookingContextModule extends BaseModule implements Module, BookingContextModuleAPI {
18
+ protected defaultName: string;
19
+ protected defaultVersion: string;
20
+ private request;
21
+ private store;
22
+ /** 上次成功 loadBookingConfig 的 query key;命中则不再请求。 */
23
+ private lastConfigQueryKey;
24
+ /** 上次成功 loadResources 的 query key(date|bookingIds);命中则不再请求。 */
25
+ private lastResourcesQueryKey;
26
+ constructor(name?: string, version?: string);
27
+ initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
28
+ loadBookingConfig(params?: LoadBookingConfigParams, options?: {
29
+ forceRefresh?: boolean;
30
+ }): Promise<BookingContextConfig | null>;
31
+ loadResources(params?: LoadBookingResourcesParams, options?: {
32
+ forceRefresh?: boolean;
33
+ }): Promise<BookingContextResource[]>;
34
+ /**
35
+ * store 内是否已具备与本次 init 入参等价的 config / resources(不再打接口)。
36
+ */
37
+ isBookingContextReady(params?: InitBookingContextParams): boolean;
38
+ initBookingContext(params?: InitBookingContextParams): Promise<BookingContextState>;
39
+ setBookingConfig(config: BookingContextConfig | null): void;
40
+ getBookingConfig(): BookingContextConfig | null;
41
+ setResources(resources: BookingContextResource[] | null | undefined): void;
42
+ getResourcesOrigin(): BookingContextResource[];
43
+ getResourcesOriginMap(): BookingContextResourceMap;
44
+ setDate(date: BookingContextDateInput): void;
45
+ getDate(): string | null;
46
+ getState(): BookingContextState;
47
+ clear(): void;
48
+ }