@pisell/pisellos 2.2.243 → 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 (315) 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 -3658
  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/promotion/index.js +0 -49
  96. package/lib/model/strategy/adapter/walletPass/utils.js +2 -3
  97. package/lib/modules/Cart/utils/cartProduct.js +3 -20
  98. package/lib/modules/Cart/utils/changePrice.js +20 -12
  99. package/lib/modules/Customer/index.d.ts +0 -20
  100. package/lib/modules/Customer/index.js +11 -64
  101. package/lib/modules/Customer/types.d.ts +0 -2
  102. package/lib/modules/Discount/index.js +1 -5
  103. package/lib/modules/Discount/types.d.ts +0 -1
  104. package/lib/modules/OpenData/index.d.ts +0 -8
  105. package/lib/modules/OpenData/index.js +5 -19
  106. package/lib/modules/Order/index.d.ts +18 -268
  107. package/lib/modules/Order/index.js +344 -2149
  108. package/lib/modules/Order/types.d.ts +31 -279
  109. package/lib/modules/Order/types.js +0 -1
  110. package/lib/modules/Order/utils.d.ts +5 -147
  111. package/lib/modules/Order/utils.js +46 -614
  112. package/lib/modules/Payment/index.d.ts +13 -10
  113. package/lib/modules/Payment/index.js +150 -18
  114. package/lib/modules/Payment/types.d.ts +0 -2
  115. package/lib/modules/Payment/utils.js +1 -2
  116. package/lib/modules/Payment/walletpass.js +3 -7
  117. package/lib/modules/ProductList/index.d.ts +12 -16
  118. package/lib/modules/ProductList/index.js +4 -41
  119. package/lib/modules/ProductList/types.d.ts +0 -14
  120. package/lib/modules/Quotation/index.d.ts +1 -0
  121. package/lib/modules/Quotation/index.js +16 -19
  122. package/lib/modules/Rules/index.d.ts +0 -4
  123. package/lib/modules/Rules/index.js +120 -136
  124. package/lib/modules/Rules/types.d.ts +0 -1
  125. package/lib/modules/SalesSummary/index.d.ts +25 -8
  126. package/lib/modules/SalesSummary/index.js +4 -30
  127. package/lib/modules/SalesSummary/types.d.ts +1 -4
  128. package/lib/modules/SalesSummary/utils.d.ts +25 -2
  129. package/lib/modules/SalesSummary/utils.js +91 -645
  130. package/lib/modules/Schedule/index.d.ts +0 -7
  131. package/lib/modules/Schedule/index.js +1 -17
  132. package/lib/modules/Summary/index.js +4 -5
  133. package/lib/modules/index.d.ts +0 -2
  134. package/lib/modules/index.js +1 -5
  135. package/lib/plugins/request.d.ts +0 -1
  136. package/lib/server/index.d.ts +1 -204
  137. package/lib/server/index.js +57 -1888
  138. package/lib/server/modules/index.d.ts +0 -2
  139. package/lib/server/modules/index.js +0 -3
  140. package/lib/server/modules/order/index.d.ts +4 -120
  141. package/lib/server/modules/order/index.js +142 -919
  142. package/lib/server/modules/order/types.d.ts +3 -32
  143. package/lib/server/modules/order/utils/filterBookings.js +5 -24
  144. package/lib/server/modules/order/utils/filterOrders.js +6 -15
  145. package/lib/server/modules/products/index.d.ts +7 -34
  146. package/lib/server/modules/products/index.js +54 -189
  147. package/lib/server/modules/resource/index.d.ts +0 -2
  148. package/lib/server/modules/resource/index.js +3 -27
  149. package/lib/server/modules/schedule/index.d.ts +4 -4
  150. package/lib/server/modules/schedule/index.js +40 -47
  151. package/lib/solution/BaseSales/index.d.ts +9 -131
  152. package/lib/solution/BaseSales/index.js +63 -1106
  153. package/lib/solution/BaseSales/types.d.ts +6 -76
  154. package/lib/solution/BaseSales/types.js +1 -3
  155. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
  156. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +18 -106
  157. package/lib/solution/BaseSales/utils.d.ts +1 -1
  158. package/lib/solution/BaseSales/utils.js +10 -54
  159. package/lib/solution/BookingByStep/index.d.ts +1 -1
  160. package/lib/solution/BookingTicket/index.d.ts +10 -270
  161. package/lib/solution/BookingTicket/index.js +29 -922
  162. package/lib/solution/BookingTicket/types.d.ts +1 -118
  163. package/lib/solution/BookingTicket/types.js +0 -11
  164. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
  165. package/lib/solution/BookingTicket/utils/bookingStatus.js +2 -44
  166. package/lib/solution/BookingTicket/utils/cartView.d.ts +1 -9
  167. package/lib/solution/BookingTicket/utils/cartView.js +6 -61
  168. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -5
  169. package/lib/solution/BookingTicket/utils/scan/index.js +3 -17
  170. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  171. package/lib/solution/Checkout/index.d.ts +0 -1
  172. package/lib/solution/Checkout/index.js +2 -1
  173. package/lib/solution/RegisterAndLogin/config.js +10 -2
  174. package/lib/solution/ScanOrder/index.d.ts +3 -9
  175. package/lib/solution/ScanOrder/index.js +70 -153
  176. package/lib/solution/ScanOrder/types.d.ts +5 -9
  177. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  178. package/lib/solution/ScanOrder/utils.js +17 -83
  179. package/lib/solution/VenueBooking/index.d.ts +2 -5
  180. package/lib/solution/VenueBooking/index.js +17 -54
  181. package/lib/solution/VenueBooking/sales-section-4-annotated.json +2 -0
  182. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  183. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
  184. package/lib/types/index.d.ts +0 -10
  185. package/package.json +1 -1
  186. package/dist/modules/BookingContext/index.d.ts +0 -48
  187. package/dist/modules/BookingContext/index.js +0 -566
  188. package/dist/modules/BookingContext/types.d.ts +0 -102
  189. package/dist/modules/BookingContext/types.js +0 -51
  190. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  191. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -284
  192. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  193. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -145
  194. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  195. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -218
  196. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
  197. package/dist/modules/BookingContext/utils/flexible.js +0 -56
  198. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  199. package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
  200. package/dist/modules/BookingContext/utils/index.d.ts +0 -11
  201. package/dist/modules/BookingContext/utils/index.js +0 -11
  202. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
  203. package/dist/modules/BookingContext/utils/noResource.js +0 -77
  204. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  205. package/dist/modules/BookingContext/utils/orderLineDisplay.js +0 -36
  206. package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
  207. package/dist/modules/BookingContext/utils/productExtend.js +0 -339
  208. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  209. package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
  210. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  211. package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
  212. package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
  213. package/dist/modules/BookingContext/utils/resources.js +0 -486
  214. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  215. package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
  216. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  217. package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
  218. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  219. package/dist/modules/Order/utils/manualProductDiscount.js +0 -210
  220. package/dist/modules/SurchargeList/index.d.ts +0 -16
  221. package/dist/modules/SurchargeList/index.js +0 -162
  222. package/dist/modules/SurchargeList/types.d.ts +0 -11
  223. package/dist/modules/SurchargeList/types.js +0 -1
  224. package/dist/server/modules/payment/index.d.ts +0 -28
  225. package/dist/server/modules/payment/index.js +0 -305
  226. package/dist/server/modules/payment/types.d.ts +0 -9
  227. package/dist/server/modules/payment/types.js +0 -1
  228. package/dist/server/test.json +0 -713
  229. package/dist/server/utils/small-ticket.d.ts +0 -71
  230. package/dist/server/utils/small-ticket.js +0 -830
  231. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
  232. package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1438
  233. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  234. package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
  235. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
  236. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
  237. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
  238. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +0 -95
  239. package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  240. package/dist/solution/BookingTicket/utils/exampleData.js +0 -183
  241. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  242. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -438
  243. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
  244. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -399
  245. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
  246. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -56
  247. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  248. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +0 -150
  249. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
  250. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +0 -78
  251. package/lib/modules/BookingContext/index.d.ts +0 -48
  252. package/lib/modules/BookingContext/index.js +0 -368
  253. package/lib/modules/BookingContext/types.d.ts +0 -102
  254. package/lib/modules/BookingContext/types.js +0 -34
  255. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  256. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -276
  257. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  258. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -151
  259. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  260. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -201
  261. package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
  262. package/lib/modules/BookingContext/utils/flexible.js +0 -80
  263. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  264. package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
  265. package/lib/modules/BookingContext/utils/index.d.ts +0 -11
  266. package/lib/modules/BookingContext/utils/index.js +0 -43
  267. package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
  268. package/lib/modules/BookingContext/utils/noResource.js +0 -90
  269. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  270. package/lib/modules/BookingContext/utils/orderLineDisplay.js +0 -56
  271. package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
  272. package/lib/modules/BookingContext/utils/productExtend.js +0 -283
  273. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  274. package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
  275. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  276. package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
  277. package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
  278. package/lib/modules/BookingContext/utils/resources.js +0 -377
  279. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  280. package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
  281. package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  282. package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
  283. package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  284. package/lib/modules/Order/utils/manualProductDiscount.js +0 -206
  285. package/lib/modules/SurchargeList/index.d.ts +0 -16
  286. package/lib/modules/SurchargeList/index.js +0 -89
  287. package/lib/modules/SurchargeList/types.d.ts +0 -11
  288. package/lib/modules/SurchargeList/types.js +0 -17
  289. package/lib/server/modules/payment/index.d.ts +0 -28
  290. package/lib/server/modules/payment/index.js +0 -192
  291. package/lib/server/modules/payment/types.d.ts +0 -9
  292. package/lib/server/modules/payment/types.js +0 -17
  293. package/lib/server/test.json +0 -713
  294. package/lib/server/utils/small-ticket.d.ts +0 -71
  295. package/lib/server/utils/small-ticket.js +0 -781
  296. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
  297. package/lib/solution/BaseSales/utils/cartPromotion.js +0 -992
  298. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  299. package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
  300. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
  301. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
  302. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
  303. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +0 -125
  304. package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  305. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  306. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  307. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -254
  308. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
  309. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -168
  310. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
  311. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -51
  312. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  313. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +0 -127
  314. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
  315. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +0 -85
@@ -1,102 +0,0 @@
1
- /**
2
- * BookingContext 子模块:承载「预约 UI 上下文」三件套。
3
- *
4
- * - bookingConfig:来自 `/core/board/management/config` 的整套预约配置(service_time / resource_tab /
5
- * appointment_subject / subject_require / stock_setting / basic / capacity 等)。
6
- * - resourcesOrigin / resourcesOriginMap:来自 `/schedule/resource/list` 的资源全集,含 times / event_list /
7
- * combined_resource 等运行态信息,是 getResourceByIds / getResourceTimeIsUsable 的输入。
8
- * - date:当前选择的日期(dayjs 或 ISO 字符串,迁移后内部统一存原始 ISO 字符串,UI 可自行解析)。
9
- *
10
- * 设计原则(与 BookingTicket 现状对齐):
11
- * - 默认由 `loadBookingConfig` / `loadResources` 拉取并写入 store;也支持消费方 `set*` 直接灌入(复用 ticketBooking 已拉到的数据)。
12
- * - 所有读 API 返回浅克隆(数组)或原引用(map / config),避免 UI 写穿。
13
- */
14
- /** `loadBookingConfig` 入参,与 ticketBooking `getBookingConfig` 一致。 */
15
- export interface LoadBookingConfigParams {
16
- item_type?: string;
17
- sub_type?: string;
18
- source_type?: string;
19
- [key: string]: any;
20
- }
21
- /** `loadResources` 入参,与 info2 `getResourceList` 一致。 */
22
- export interface LoadBookingResourcesParams {
23
- /** 查询日期,`YYYY-MM-DD`;缺省用 store 内已 set 的 date,再缺省为当天。 */
24
- date?: string;
25
- /** 编辑态排除容量占用用的 booking id 列表。 */
26
- bookingIds?: number[];
27
- }
28
- /** `initBookingContext` 入参(BookingTicket 聚合入口)。 */
29
- export interface InitBookingContextParams {
30
- bookingConfigParams?: LoadBookingConfigParams;
31
- date?: BookingContextDateInput;
32
- /** 是否拉资源列表,默认 true。 */
33
- loadResources?: boolean;
34
- bookingIds?: number[];
35
- /** 为 true 时忽略内存命中,强制重新请求(默认 false)。 */
36
- forceRefresh?: boolean;
37
- }
38
- /**
39
- * 资源全集 map:key 为资源 id(数字),value 为资源原始对象,含 times / event_list 等运行态。
40
- * 这里只声明 Record 形态;具体字段保留 `any`,与 ticketBooking 现网传入的数据形状兼容。
41
- */
42
- export type BookingContextResource = Record<string, any>;
43
- export type BookingContextResourceMap = Record<string, BookingContextResource>;
44
- /**
45
- * 形参 booking_config(结构来自 `/core/board/management/config` 接口)。
46
- * OS 不强制 schema,保留 `Record<string, any>` 兼容现网;常用路径文档化在 SDK docs。
47
- */
48
- export type BookingContextConfig = Record<string, any>;
49
- /**
50
- * 日期入参:接受 dayjs 实例、ISO 字符串、Date 实例;内部统一 normalize 为 ISO 字符串保存。
51
- */
52
- export type BookingContextDateInput = string | Date | {
53
- format?: (fmt?: string) => string;
54
- } | null | undefined;
55
- /**
56
- * 内部 store 形态。`resourcesOriginMap` 由 `setResources` 派生,不允许外部直接 set。
57
- */
58
- export interface BookingContextState {
59
- bookingConfig: BookingContextConfig | null;
60
- resourcesOrigin: BookingContextResource[];
61
- resourcesOriginMap: BookingContextResourceMap;
62
- /**
63
- * 当前选择的日期,统一 ISO 字符串('YYYY-MM-DD HH:mm:ss' 或 'YYYY-MM-DD')。
64
- * UI 取出后可自行 dayjs 解析;OS 内的计算 helper 都接受 string,不做 dayjs 依赖。
65
- */
66
- date: string | null;
67
- }
68
- /**
69
- * BookingContextModule 对外 API(给 BookingTicket / SDK Provider 透传消费)。
70
- */
71
- export interface BookingContextModuleAPI {
72
- setBookingConfig(config: BookingContextConfig | null): void;
73
- getBookingConfig(): BookingContextConfig | null;
74
- setResources(resources: BookingContextResource[] | null | undefined): void;
75
- getResourcesOrigin(): BookingContextResource[];
76
- getResourcesOriginMap(): BookingContextResourceMap;
77
- setDate(date: BookingContextDateInput): void;
78
- getDate(): string | null;
79
- /** 当前 store 的浅克隆,调试 / 测试用。 */
80
- getState(): BookingContextState;
81
- /** 一键清空,destroy / 切租户场景用。 */
82
- clear(): void;
83
- /** 拉取 board config 并写入 store(`/core/board/management/config`)。 */
84
- loadBookingConfig(params?: LoadBookingConfigParams): Promise<BookingContextConfig | null>;
85
- /** 拉取资源全集并写入 store(`/schedule/resource/list`)。 */
86
- loadResources(params?: LoadBookingResourcesParams): Promise<BookingContextResource[]>;
87
- /**
88
- * 依次 setDate → loadBookingConfig → loadResources。
89
- * SalesSdkProvider 挂载时默认调用 BookingTicket.initBookingContext。
90
- */
91
- initBookingContext(params?: InitBookingContextParams): Promise<BookingContextState>;
92
- /** store 是否已具备与入参等价的 config / resources(无需再请求)。 */
93
- isBookingContextReady(params?: InitBookingContextParams): boolean;
94
- }
95
- /**
96
- * BookingContextModule 事件名常量(采用 `${this.name}:` 前缀,与现有模块一致)。
97
- */
98
- export declare enum BookingContextEvent {
99
- OnBookingConfigChange = "onBookingConfigChange",
100
- OnResourcesChange = "onResourcesChange",
101
- OnDateChange = "onDateChange"
102
- }
@@ -1,34 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/modules/BookingContext/types.ts
20
- var types_exports = {};
21
- __export(types_exports, {
22
- BookingContextEvent: () => BookingContextEvent
23
- });
24
- module.exports = __toCommonJS(types_exports);
25
- var BookingContextEvent = /* @__PURE__ */ ((BookingContextEvent2) => {
26
- BookingContextEvent2["OnBookingConfigChange"] = "onBookingConfigChange";
27
- BookingContextEvent2["OnResourcesChange"] = "onResourcesChange";
28
- BookingContextEvent2["OnDateChange"] = "onDateChange";
29
- return BookingContextEvent2;
30
- })(BookingContextEvent || {});
31
- // Annotate the CommonJS export names for ESM import in node:
32
- 0 && (module.exports = {
33
- BookingContextEvent
34
- });
@@ -1,16 +0,0 @@
1
- import type { OrderProduct } from '../../Order/types';
2
- export interface BuildCacheItemFromOrderLineInput {
3
- /** tempOrder.products 中的一行 */
4
- product: OrderProduct;
5
- /** 与该行 product_uid 关联的 tempOrder.bookings 项 */
6
- booking: Record<string, any>;
7
- /** 商品 catalog / 详情,用于 capacity、duration、product_resource 等模板字段 */
8
- sourceProduct?: Record<string, any> | null;
9
- }
10
- /**
11
- * 从已加车的 order line + booking 反查 editService 所需的 cacheItem。
12
- *
13
- * 与 `buildCacheItemFromCartDetail` / `buildCacheItemFromDetail` 正向拼装互逆(在 getProductExtend 之前调用)。
14
- * 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
15
- */
16
- export declare function buildCacheItemFromOrderLine(input: BuildCacheItemFromOrderLineInput): Record<string, any>;
@@ -1,276 +0,0 @@
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/modules/BookingContext/utils/buildCacheItemFromOrderLine.ts
30
- var buildCacheItemFromOrderLine_exports = {};
31
- __export(buildCacheItemFromOrderLine_exports, {
32
- buildCacheItemFromOrderLine: () => buildCacheItemFromOrderLine
33
- });
34
- module.exports = __toCommonJS(buildCacheItemFromOrderLine_exports);
35
- var import_dayjs = __toESM(require("dayjs"));
36
- var import_utils = require("../../Order/utils");
37
- var import_manualProductDiscount = require("../../Order/utils/manualProductDiscount");
38
- var import_orderLineDisplay = require("./orderLineDisplay");
39
- function safeFormat(value, fmt) {
40
- if (value === void 0 || value === null)
41
- return void 0;
42
- const d = (0, import_dayjs.default)(value);
43
- if (!d.isValid())
44
- return void 0;
45
- return d.format(fmt);
46
- }
47
- function normalizeTimeString(value) {
48
- if (value === void 0 || value === null)
49
- return void 0;
50
- if (typeof value === "string") {
51
- const t = value.trim();
52
- const hhmmFromHhmmss = t.match(/^(\d{1,2}:\d{2}):\d{2}$/);
53
- if (hhmmFromHhmmss)
54
- return hhmmFromHhmmss[1];
55
- if (/^\d{1,2}:\d{2}$/.test(t))
56
- return t;
57
- }
58
- const d = (0, import_dayjs.default)(value);
59
- if (d.isValid())
60
- return d.format("HH:mm");
61
- return void 0;
62
- }
63
- function unflattenResourceMap(resources) {
64
- const map = {};
65
- if (!Array.isArray(resources))
66
- return map;
67
- resources.forEach((r) => {
68
- const formId = r == null ? void 0 : r.form_id;
69
- if (formId === void 0 || formId === null)
70
- return;
71
- const key = String(formId);
72
- if (!map[key])
73
- map[key] = [];
74
- map[key].push({
75
- form_id: formId,
76
- relation_id: r.relation_id,
77
- relation_type: r.relation_type || "form",
78
- like_status: r.like_status || "common",
79
- metadata: r.metadata ? { ...r.metadata } : void 0,
80
- children: r.children
81
- });
82
- });
83
- return map;
84
- }
85
- function resolveCapacityFromBooking(booking) {
86
- var _a;
87
- const metaCap = (_a = booking.metadata) == null ? void 0 : _a.capacity;
88
- if (Array.isArray(metaCap) && metaCap.length > 0) {
89
- return metaCap.map((item) => {
90
- if (!item || typeof item !== "object")
91
- return null;
92
- if (item.id === void 0 || item.id === null)
93
- return null;
94
- const row = {
95
- id: item.id,
96
- value: Number(item.value ?? 0)
97
- };
98
- if (item.name !== void 0)
99
- row.name = item.name;
100
- return row;
101
- }).filter((item) => item != null);
102
- }
103
- if (typeof metaCap === "number" && Number.isFinite(metaCap)) {
104
- return [{ id: 0, value: metaCap, name: "" }];
105
- }
106
- return [];
107
- }
108
- function resolveDurationForExtend(booking) {
109
- const duration = booking.duration;
110
- if (booking.sub_type === "days" || booking.is_all === 1) {
111
- return duration;
112
- }
113
- if (typeof duration === "number" && Number.isFinite(duration)) {
114
- return duration;
115
- }
116
- return duration;
117
- }
118
- function resolveTopLevelDuration(booking, sourceProduct) {
119
- if ((sourceProduct == null ? void 0 : sourceProduct.duration) !== void 0) {
120
- return sourceProduct.duration;
121
- }
122
- const raw = booking.duration;
123
- if (raw == null || raw === "")
124
- return void 0;
125
- if (typeof raw === "object" && raw.type) {
126
- return raw;
127
- }
128
- const subType = booking.sub_type === "days" ? "days" : "minutes";
129
- const value = Number(raw);
130
- if (!Number.isFinite(value) || value <= 0)
131
- return void 0;
132
- return { type: subType, value };
133
- }
134
- function resolveProductTitle(product, booking, sourceProduct) {
135
- var _a, _b;
136
- const metadata = product.metadata || {};
137
- return (sourceProduct == null ? void 0 : sourceProduct.title) ?? (sourceProduct == null ? void 0 : sourceProduct.name) ?? metadata.product_title ?? metadata.product_name ?? ((_a = booking == null ? void 0 : booking.product) == null ? void 0 : _a.title) ?? ((_b = booking == null ? void 0 : booking.detail) == null ? void 0 : _b.product_title) ?? "";
138
- }
139
- function synthesizeProductResourceFromBooking(booking) {
140
- const rows = booking == null ? void 0 : booking.resources;
141
- if (!Array.isArray(rows) || rows.length === 0)
142
- return void 0;
143
- const relationIdsByForm = /* @__PURE__ */ new Map();
144
- rows.forEach((row) => {
145
- const formId = row == null ? void 0 : row.form_id;
146
- const relationId = Number(row == null ? void 0 : row.relation_id);
147
- if (formId == null || formId === "" || !Number.isFinite(relationId) || relationId <= 0) {
148
- return;
149
- }
150
- const list = relationIdsByForm.get(formId) ?? [];
151
- if (!list.includes(relationId)) {
152
- list.push(relationId);
153
- }
154
- relationIdsByForm.set(formId, list);
155
- });
156
- if (relationIdsByForm.size === 0)
157
- return void 0;
158
- return {
159
- resources: Array.from(relationIdsByForm.entries()).map(([formId, relationIds]) => ({
160
- id: formId,
161
- status: 1,
162
- type: "form",
163
- code: "",
164
- optional_resource: relationIds,
165
- default_resource: []
166
- }))
167
- };
168
- }
169
- function buildCacheItemFromOrderLine(input) {
170
- var _a, _b, _c, _d, _e, _f;
171
- const { product, booking, sourceProduct } = input;
172
- const resolvedId = product.product_id ?? (sourceProduct == null ? void 0 : sourceProduct.id);
173
- const selling = Number(product.selling_price ?? 0);
174
- const original = Number(product.original_price ?? selling);
175
- const startDate = safeFormat(booking.start_date, "YYYY-MM-DD");
176
- const endDate = safeFormat(booking.end_date, "YYYY-MM-DD");
177
- const startTime = normalizeTimeString(booking.start_time);
178
- const endTime = normalizeTimeString(booking.end_time);
179
- const resource = unflattenResourceMap(booking.resources);
180
- const capacity = resolveCapacityFromBooking(booking);
181
- const holderId = ((_a = booking.metadata) == null ? void 0 : _a.holder_id) ?? booking.holder_id;
182
- const productTitle = resolveProductTitle(product, booking, sourceProduct);
183
- const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
184
- const other = {
185
- product_variant_id: product.product_variant_id ?? 0,
186
- option: (0, import_utils.getProductSkuOptions)(product),
187
- bundle: Array.isArray(product.product_bundle) ? [...product.product_bundle] : []
188
- };
189
- const extend = {
190
- start_date: startDate ? (0, import_dayjs.default)(startDate) : void 0,
191
- end_date: endDate ? (0, import_dayjs.default)(endDate) : void 0,
192
- startDate: startDate ? (0, import_dayjs.default)(startDate) : void 0,
193
- endDate: endDate ? (0, import_dayjs.default)(endDate) : void 0,
194
- start_time: startTime,
195
- end_time: endTime,
196
- duration: resolveDurationForExtend(booking),
197
- sub_type: booking.sub_type,
198
- quantity: product.num ?? 1,
199
- product_name: productTitle,
200
- note: product.note ?? ((_b = booking == null ? void 0 : booking.detail) == null ? void 0 : _b.note) ?? "",
201
- price: selling,
202
- total: selling,
203
- origin_total: original,
204
- resource,
205
- capacity,
206
- holder_id: holderId,
207
- other,
208
- like_status: booking.like_status || "common",
209
- discount_reason: (0, import_manualProductDiscount.resolveManualDiscountMessage)(
210
- product.discount_list,
211
- (_c = product.metadata) == null ? void 0 : _c.product_discount_reason
212
- ) || void 0,
213
- ...productOptionString ? { product_option_string: productOptionString } : {}
214
- };
215
- const manualDiscount = (product.discount_list || []).find((d) => (d == null ? void 0 : d.type) === "product");
216
- if (manualDiscount && extend.origin_total === selling) {
217
- const manualAmount = Number(manualDiscount.amount ?? 0);
218
- if (Number.isFinite(manualAmount) && manualAmount > 0) {
219
- extend.origin_total = selling + manualAmount;
220
- }
221
- }
222
- if (((_d = product.metadata) == null ? void 0 : _d.price_override) != null || manualDiscount) {
223
- extend.priceOverride = selling;
224
- }
225
- if (booking.holder !== void 0) {
226
- extend.holder = booking.holder;
227
- }
228
- if (Array.isArray(booking.relation_forms)) {
229
- extend.relation_forms = booking.relation_forms;
230
- }
231
- const base = {
232
- ...sourceProduct || {},
233
- id: resolvedId,
234
- product_id: resolvedId,
235
- extension_type: (sourceProduct == null ? void 0 : sourceProduct.extension_type) ?? ((_e = booking == null ? void 0 : booking.product) == null ? void 0 : _e.extension_type) ?? (sourceProduct == null ? void 0 : sourceProduct.extension_type),
236
- title: productTitle || (sourceProduct == null ? void 0 : sourceProduct.title) || ((_f = booking == null ? void 0 : booking.product) == null ? void 0 : _f.title),
237
- price: (sourceProduct == null ? void 0 : sourceProduct.price) ?? selling,
238
- selling_price: product.selling_price,
239
- original_price: product.original_price,
240
- ...productOptionString ? { product_option_string: productOptionString } : {},
241
- _extend: extend,
242
- new: 0,
243
- autoClose: false,
244
- order_detail_id: product.order_detail_id ?? null,
245
- booking_id: booking.id ?? booking.booking_id ?? 0
246
- };
247
- if ((sourceProduct == null ? void 0 : sourceProduct.capacity) !== void 0) {
248
- base.capacity = sourceProduct.capacity;
249
- }
250
- const topLevelDuration = resolveTopLevelDuration(booking, sourceProduct);
251
- if (topLevelDuration !== void 0) {
252
- base.duration = topLevelDuration;
253
- }
254
- if ((sourceProduct == null ? void 0 : sourceProduct.product_resource) !== void 0) {
255
- base.product_resource = sourceProduct.product_resource;
256
- } else {
257
- const synthesized = synthesizeProductResourceFromBooking(booking);
258
- if (synthesized) {
259
- base.product_resource = synthesized;
260
- }
261
- }
262
- if (Array.isArray(sourceProduct == null ? void 0 : sourceProduct.schedules) && sourceProduct.schedules.length) {
263
- base.schedules = sourceProduct.schedules;
264
- }
265
- if (Array.isArray(sourceProduct == null ? void 0 : sourceProduct["schedule.ids"]) && sourceProduct["schedule.ids"].length) {
266
- base["schedule.ids"] = sourceProduct["schedule.ids"];
267
- }
268
- if (booking.schedule_event_id !== void 0) {
269
- base.schedule_event_id = booking.schedule_event_id;
270
- }
271
- return base;
272
- }
273
- // Annotate the CommonJS export names for ESM import in node:
274
- 0 && (module.exports = {
275
- buildCacheItemFromOrderLine
276
- });
@@ -1,8 +0,0 @@
1
- import type { OrderProduct } from '../../Order/types';
2
- export interface BuildNormalProductCacheItemFromOrderLineInput {
3
- /** tempOrder.products 中的一行(普通商品,无关联 booking) */
4
- product: OrderProduct;
5
- /** 商品 catalog / 详情,用于 variant / option / bundle 模板字段 */
6
- sourceProduct?: Record<string, any> | null;
7
- }
8
- export declare function buildNormalProductCacheItemFromOrderLine(input: BuildNormalProductCacheItemFromOrderLineInput): Record<string, any>;
@@ -1,151 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.ts
20
- var buildNormalProductCacheItemFromOrderLine_exports = {};
21
- __export(buildNormalProductCacheItemFromOrderLine_exports, {
22
- buildNormalProductCacheItemFromOrderLine: () => buildNormalProductCacheItemFromOrderLine
23
- });
24
- module.exports = __toCommonJS(buildNormalProductCacheItemFromOrderLine_exports);
25
- var import_utils = require("../../Order/utils");
26
- var import_orderLineDisplay = require("./orderLineDisplay");
27
- function resolveSourceProductPrice(product, sourceProduct) {
28
- var _a, _b, _c;
29
- const metadata = product.metadata || {};
30
- if (metadata.source_product_price !== void 0 && metadata.source_product_price !== null) {
31
- const parsed = Number(metadata.source_product_price);
32
- if (Number.isFinite(parsed))
33
- return parsed;
34
- }
35
- const variantId = Number(product.product_variant_id || 0);
36
- if (variantId > 0) {
37
- const variantList = ((_a = metadata.origin) == null ? void 0 : _a.variant) ?? (sourceProduct == null ? void 0 : sourceProduct.variant);
38
- if (Array.isArray(variantList)) {
39
- const matched = variantList.find((v) => Number(v == null ? void 0 : v.id) === variantId);
40
- const variantPrice = (matched == null ? void 0 : matched.price) ?? (matched == null ? void 0 : matched.base_price);
41
- if (variantPrice !== void 0 && variantPrice !== null) {
42
- const parsed = Number(variantPrice);
43
- if (Number.isFinite(parsed))
44
- return parsed;
45
- }
46
- }
47
- }
48
- const catalogPrice = (sourceProduct == null ? void 0 : sourceProduct.price) ?? (sourceProduct == null ? void 0 : sourceProduct.base_price);
49
- if (catalogPrice !== void 0 && catalogPrice !== null) {
50
- const parsed = Number(catalogPrice);
51
- if (Number.isFinite(parsed))
52
- return parsed;
53
- }
54
- const originPrice = ((_b = metadata.origin) == null ? void 0 : _b.price) ?? ((_c = metadata.origin) == null ? void 0 : _c.base_price);
55
- if (originPrice !== void 0 && originPrice !== null) {
56
- const parsed = Number(originPrice);
57
- if (Number.isFinite(parsed))
58
- return parsed;
59
- }
60
- return Number(product.selling_price ?? 0);
61
- }
62
- function mapOrderBundleToOtherBundle(bundle) {
63
- return bundle.map((item) => {
64
- const catalogOriginal = item.original_price ?? item.product_price ?? item.price ?? item.bundle_selling_price;
65
- const selling = item.bundle_selling_price ?? item.price ?? catalogOriginal;
66
- const { bundle_selling_price: _omitBundleSelling, ...rest } = item;
67
- const isMarkupOrMarkdown = (item.price_type === "markdown" || item.price_type === "markup") && (item.price_type_ext === "" || item.price_type_ext === void 0 || item.price_type_ext === null);
68
- if (isMarkupOrMarkdown)
69
- delete rest.original_total;
70
- return {
71
- ...rest,
72
- price: selling,
73
- original_price: catalogOriginal,
74
- ...isMarkupOrMarkdown ? {} : { original_total: item.original_total ?? catalogOriginal },
75
- num: item.num ?? item.quantity ?? 1,
76
- quantity: item.quantity ?? item.num ?? 1
77
- };
78
- });
79
- }
80
- function buildNormalProductCacheItemFromOrderLine(input) {
81
- var _a, _b, _c, _d;
82
- const { product, sourceProduct } = input;
83
- const resolvedId = product.product_id ?? (sourceProduct == null ? void 0 : sourceProduct.id);
84
- const sourcePrice = resolveSourceProductPrice(product, sourceProduct);
85
- const selling = Number(product.selling_price ?? 0);
86
- const original = Number(product.original_price ?? selling);
87
- const uid = (_a = product.metadata) == null ? void 0 : _a.unique_identification_number;
88
- const option = (0, import_utils.getProductSkuOptions)(product);
89
- const bundle = mapOrderBundleToOtherBundle(
90
- Array.isArray(product.product_bundle) ? product.product_bundle : []
91
- );
92
- const originExtend = (_c = (_b = product.metadata) == null ? void 0 : _b.origin) == null ? void 0 : _c._extend;
93
- const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
94
- const discountList = product.discount_list || [];
95
- const other = {
96
- product_id: resolvedId,
97
- product_variant_id: product.product_variant_id ?? 0,
98
- option,
99
- bundle: ((_d = originExtend == null ? void 0 : originExtend.other) == null ? void 0 : _d.bundle) ? JSON.parse(JSON.stringify(originExtend.other.bundle)) : bundle,
100
- quantity: product.num ?? 1
101
- };
102
- const skuValue = {
103
- product_id: resolvedId,
104
- product_variant_id: product.product_variant_id ?? 0,
105
- option: other.option,
106
- bundle: other.bundle
107
- };
108
- const extend = {
109
- quantity: product.num ?? 1,
110
- product_name: (sourceProduct == null ? void 0 : sourceProduct.title) ?? "",
111
- note: product.note ?? "",
112
- // v2:_extend.price 为主商品 source 价;行 composite 用 total / origin_total 展示
113
- price: (originExtend == null ? void 0 : originExtend.price) ?? sourcePrice,
114
- total: (originExtend == null ? void 0 : originExtend.total) ?? selling,
115
- origin_total: (originExtend == null ? void 0 : originExtend.origin_total) ?? original,
116
- other,
117
- skuValue: JSON.parse(JSON.stringify(skuValue)),
118
- _skuValue: JSON.parse(JSON.stringify(skuValue)),
119
- isNormalProduct: true,
120
- ...productOptionString ? { product_option_string: productOptionString } : {},
121
- ...(originExtend == null ? void 0 : originExtend.priceOverride) !== void 0 ? { priceOverride: originExtend.priceOverride } : {},
122
- ...(originExtend == null ? void 0 : originExtend.bundle_edit) !== void 0 ? { bundle_edit: originExtend.bundle_edit } : {}
123
- };
124
- if ((originExtend == null ? void 0 : originExtend.skuValue) || (originExtend == null ? void 0 : originExtend._skuValue)) {
125
- extend.skuValue = JSON.parse(
126
- JSON.stringify(originExtend.skuValue || originExtend._skuValue)
127
- );
128
- extend._skuValue = JSON.parse(JSON.stringify(extend.skuValue));
129
- }
130
- return {
131
- ...sourceProduct || {},
132
- id: resolvedId,
133
- product_id: resolvedId,
134
- _id: uid,
135
- title: sourceProduct == null ? void 0 : sourceProduct.title,
136
- price: (sourceProduct == null ? void 0 : sourceProduct.price) ?? sourcePrice,
137
- selling_price: product.selling_price,
138
- original_price: product.original_price,
139
- ...productOptionString ? { product_option_string: productOptionString } : {},
140
- note: product.note,
141
- order_detail_id: product.order_detail_id ?? null,
142
- discount_list: discountList,
143
- new: 0,
144
- autoClose: true,
145
- _extend: extend
146
- };
147
- }
148
- // Annotate the CommonJS export names for ESM import in node:
149
- 0 && (module.exports = {
150
- buildNormalProductCacheItemFromOrderLine
151
- });
@@ -1,76 +0,0 @@
1
- /**
2
- * 把 info2 `cacheItem` 转换为 OS `addProductToOrder(product, booking)` 所需的 booking 入参。
3
- *
4
- * 协议严格对齐 `pisell_os/src/modules/Order/TEMP_ORDER_FIELDS_SUMMARY.md` 的 Bookings 章节:
5
- * - 顶层只允许出现:schedule_event_id / appointment_status / start_date / start_time / end_date /
6
- * end_time / select_date / duration / sub_type / like_status / number / resources / relation_forms /
7
- * holder / metadata / is_all / schedule_id / relation_id / form_id / relation_type / product_uid
8
- * - bookings[] 不允许出现 `_extend`
9
- * - bookings[].metadata 走白名单:unique_identification_number / collect_pax / capacity / holder_id / resource_select_type
10
- * - bookings[].resources[] 只接受协议白名单:form_id / relation_type / relation_id / capacity / like_status / metadata / children
11
- *
12
- * `product_uid` / `metadata.unique_identification_number` 不在这里生成:
13
- * OS `addProductToOrder` 内的 `createLinkedProductAndBooking` 会在最终一步统一改写,
14
- * 保证商品行 uid 与 booking root 唯一值始终对齐。
15
- *
16
- * 复杂 multi-day 展开(createBookingItemsByGroup / concatBookings)首版**不支持**,
17
- * 由 UI 在 `cart.confirmDetail` 之外通过辅助 API 处理。
18
- */
19
- export interface CacheItemToBookingInputOptions {
20
- /** booking config,用于推导 metadata.resource_select_type(默认从 cacheItem.\_data.resources[0].select_type.type 推断)。 */
21
- bookingConfig?: any;
22
- }
23
- export interface BookingInput {
24
- schedule_event_id?: number | string;
25
- start_date?: string;
26
- start_time?: string;
27
- end_date?: string;
28
- end_time?: string;
29
- select_date?: string;
30
- duration?: number;
31
- sub_type?: 'days' | 'minutes' | string;
32
- is_all?: 0 | 1;
33
- number?: number;
34
- holder?: any;
35
- like_status?: string;
36
- relation_forms?: any[];
37
- resources?: BookingResourceInput[];
38
- metadata?: BookingMetadataInput;
39
- schedule_id?: number | string;
40
- relation_id?: number | string;
41
- form_id?: number | string;
42
- relation_type?: string;
43
- }
44
- export interface BookingResourceInput {
45
- form_id?: number | string;
46
- relation_type?: string;
47
- relation_id?: number | string;
48
- capacity?: number;
49
- like_status?: string;
50
- metadata?: Record<string, any>;
51
- children?: any[];
52
- }
53
- /** custom / package 人数维度快照,与 info2 `_extend.capacity` / `metadata.capacity` 对齐。 */
54
- export interface BookingCapacityMetadataItem {
55
- id: string | number;
56
- value: number;
57
- name?: Record<string, any> | string;
58
- }
59
- export interface BookingMetadataInput {
60
- /** 由 OS createLinkedProductAndBooking 统一改写,这里不生成。 */
61
- unique_identification_number?: string;
62
- collect_pax?: number;
63
- /**
64
- * 资源容量快照:custom 多维度时为 `{ id, value, name? }[]`;
65
- * 仅总和场景可为 number(capacity_snapshot 兼容)。
66
- */
67
- capacity?: number | BookingCapacityMetadataItem[];
68
- /** 协议要求始终提交(即使为 null)。 */
69
- holder_id: any;
70
- holder?: any;
71
- resource_select_type?: 'single' | 'multiple' | string;
72
- }
73
- /**
74
- * 主入口。
75
- */
76
- export declare function cacheItemToBookingInput(cacheItem: any, options?: CacheItemToBookingInputOptions): BookingInput;