@pisell/pisellos 2.2.242 → 2.2.244

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +2 -3
  2. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  3. package/dist/model/strategy/adapter/walletPass/utils.js +4 -7
  4. package/dist/modules/Cart/utils/cartProduct.js +3 -24
  5. package/dist/modules/Cart/utils/changePrice.js +11 -11
  6. package/dist/modules/Customer/index.d.ts +0 -20
  7. package/dist/modules/Customer/index.js +83 -172
  8. package/dist/modules/Customer/types.d.ts +0 -2
  9. package/dist/modules/Discount/index.js +3 -4
  10. package/dist/modules/Discount/types.d.ts +0 -1
  11. package/dist/modules/OpenData/index.d.ts +0 -8
  12. package/dist/modules/OpenData/index.js +17 -37
  13. package/dist/modules/Order/index.d.ts +18 -268
  14. package/dist/modules/Order/index.js +757 -3306
  15. package/dist/modules/Order/types.d.ts +31 -279
  16. package/dist/modules/Order/types.js +0 -38
  17. package/dist/modules/Order/utils.d.ts +5 -147
  18. package/dist/modules/Order/utils.js +103 -746
  19. package/dist/modules/Payment/index.d.ts +13 -10
  20. package/dist/modules/Payment/index.js +837 -467
  21. package/dist/modules/Payment/types.d.ts +0 -2
  22. package/dist/modules/Payment/utils.js +1 -2
  23. package/dist/modules/Payment/walletpass.js +7 -14
  24. package/dist/modules/ProductList/index.d.ts +12 -16
  25. package/dist/modules/ProductList/index.js +59 -133
  26. package/dist/modules/ProductList/types.d.ts +0 -14
  27. package/dist/modules/Quotation/index.d.ts +1 -0
  28. package/dist/modules/Quotation/index.js +22 -25
  29. package/dist/modules/Rules/index.d.ts +0 -4
  30. package/dist/modules/Rules/index.js +69 -93
  31. package/dist/modules/Rules/types.d.ts +0 -1
  32. package/dist/modules/SalesSummary/index.d.ts +25 -8
  33. package/dist/modules/SalesSummary/index.js +35 -86
  34. package/dist/modules/SalesSummary/types.d.ts +1 -4
  35. package/dist/modules/SalesSummary/utils.d.ts +25 -2
  36. package/dist/modules/SalesSummary/utils.js +162 -794
  37. package/dist/modules/Schedule/index.d.ts +0 -7
  38. package/dist/modules/Schedule/index.js +2 -24
  39. package/dist/modules/Summary/index.js +3 -4
  40. package/dist/modules/index.d.ts +0 -2
  41. package/dist/modules/index.js +1 -3
  42. package/dist/plugins/request.d.ts +0 -1
  43. package/dist/server/index.d.ts +1 -204
  44. package/dist/server/index.js +928 -3659
  45. package/dist/server/modules/index.d.ts +0 -2
  46. package/dist/server/modules/index.js +0 -2
  47. package/dist/server/modules/order/index.d.ts +4 -120
  48. package/dist/server/modules/order/index.js +483 -1779
  49. package/dist/server/modules/order/types.d.ts +3 -32
  50. package/dist/server/modules/order/types.js +0 -8
  51. package/dist/server/modules/order/utils/filterBookings.js +3 -26
  52. package/dist/server/modules/order/utils/filterOrders.js +8 -23
  53. package/dist/server/modules/products/index.d.ts +7 -34
  54. package/dist/server/modules/products/index.js +317 -631
  55. package/dist/server/modules/resource/index.d.ts +0 -2
  56. package/dist/server/modules/resource/index.js +3 -29
  57. package/dist/server/modules/schedule/index.d.ts +4 -4
  58. package/dist/server/modules/schedule/index.js +88 -111
  59. package/dist/solution/BaseSales/index.d.ts +9 -131
  60. package/dist/solution/BaseSales/index.js +447 -1944
  61. package/dist/solution/BaseSales/types.d.ts +6 -76
  62. package/dist/solution/BaseSales/types.js +4 -5
  63. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
  64. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +24 -105
  65. package/dist/solution/BaseSales/utils.d.ts +1 -1
  66. package/dist/solution/BaseSales/utils.js +21 -62
  67. package/dist/solution/BookingByStep/index.d.ts +1 -1
  68. package/dist/solution/BookingTicket/index.d.ts +10 -270
  69. package/dist/solution/BookingTicket/index.js +237 -1772
  70. package/dist/solution/BookingTicket/types.d.ts +1 -118
  71. package/dist/solution/BookingTicket/types.js +2 -41
  72. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
  73. package/dist/solution/BookingTicket/utils/bookingStatus.js +0 -70
  74. package/dist/solution/BookingTicket/utils/cartView.d.ts +1 -9
  75. package/dist/solution/BookingTicket/utils/cartView.js +7 -94
  76. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -5
  77. package/dist/solution/BookingTicket/utils/scan/index.js +8 -20
  78. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  79. package/dist/solution/Checkout/index.d.ts +0 -1
  80. package/dist/solution/Checkout/index.js +9 -10
  81. package/dist/solution/RegisterAndLogin/config.js +10 -2
  82. package/dist/solution/ScanOrder/index.d.ts +3 -9
  83. package/dist/solution/ScanOrder/index.js +134 -241
  84. package/dist/solution/ScanOrder/types.d.ts +5 -9
  85. package/dist/solution/ScanOrder/types.js +3 -2
  86. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  87. package/dist/solution/ScanOrder/utils.js +22 -84
  88. package/dist/solution/VenueBooking/index.d.ts +2 -5
  89. package/dist/solution/VenueBooking/index.js +59 -110
  90. package/dist/solution/VenueBooking/sales-section-4-annotated.json +2 -0
  91. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  92. package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
  93. package/dist/types/index.d.ts +0 -10
  94. package/lib/model/strategy/adapter/promotion/evaluator.js +1 -2
  95. package/lib/model/strategy/adapter/walletPass/utils.js +2 -3
  96. package/lib/modules/Cart/utils/cartProduct.js +3 -20
  97. package/lib/modules/Cart/utils/changePrice.js +20 -12
  98. package/lib/modules/Customer/index.d.ts +0 -20
  99. package/lib/modules/Customer/index.js +11 -64
  100. package/lib/modules/Customer/types.d.ts +0 -2
  101. package/lib/modules/Discount/index.js +1 -5
  102. package/lib/modules/Discount/types.d.ts +0 -1
  103. package/lib/modules/OpenData/index.d.ts +0 -8
  104. package/lib/modules/OpenData/index.js +5 -19
  105. package/lib/modules/Order/index.d.ts +18 -268
  106. package/lib/modules/Order/index.js +344 -2149
  107. package/lib/modules/Order/types.d.ts +31 -279
  108. package/lib/modules/Order/types.js +0 -1
  109. package/lib/modules/Order/utils.d.ts +5 -147
  110. package/lib/modules/Order/utils.js +46 -614
  111. package/lib/modules/Payment/index.d.ts +13 -10
  112. package/lib/modules/Payment/index.js +150 -18
  113. package/lib/modules/Payment/types.d.ts +0 -2
  114. package/lib/modules/Payment/utils.js +1 -2
  115. package/lib/modules/Payment/walletpass.js +3 -7
  116. package/lib/modules/ProductList/index.d.ts +12 -16
  117. package/lib/modules/ProductList/index.js +4 -41
  118. package/lib/modules/ProductList/types.d.ts +0 -14
  119. package/lib/modules/Quotation/index.d.ts +1 -0
  120. package/lib/modules/Quotation/index.js +16 -19
  121. package/lib/modules/Rules/index.d.ts +0 -4
  122. package/lib/modules/Rules/index.js +120 -136
  123. package/lib/modules/Rules/types.d.ts +0 -1
  124. package/lib/modules/SalesSummary/index.d.ts +25 -8
  125. package/lib/modules/SalesSummary/index.js +4 -30
  126. package/lib/modules/SalesSummary/types.d.ts +1 -4
  127. package/lib/modules/SalesSummary/utils.d.ts +25 -2
  128. package/lib/modules/SalesSummary/utils.js +91 -645
  129. package/lib/modules/Schedule/index.d.ts +0 -7
  130. package/lib/modules/Schedule/index.js +1 -17
  131. package/lib/modules/Summary/index.js +4 -5
  132. package/lib/modules/index.d.ts +0 -2
  133. package/lib/modules/index.js +1 -5
  134. package/lib/plugins/request.d.ts +0 -1
  135. package/lib/server/index.d.ts +1 -204
  136. package/lib/server/index.js +57 -1889
  137. package/lib/server/modules/index.d.ts +0 -2
  138. package/lib/server/modules/index.js +0 -3
  139. package/lib/server/modules/order/index.d.ts +4 -120
  140. package/lib/server/modules/order/index.js +142 -919
  141. package/lib/server/modules/order/types.d.ts +3 -32
  142. package/lib/server/modules/order/utils/filterBookings.js +5 -24
  143. package/lib/server/modules/order/utils/filterOrders.js +6 -15
  144. package/lib/server/modules/products/index.d.ts +7 -34
  145. package/lib/server/modules/products/index.js +54 -189
  146. package/lib/server/modules/resource/index.d.ts +0 -2
  147. package/lib/server/modules/resource/index.js +3 -27
  148. package/lib/server/modules/schedule/index.d.ts +4 -4
  149. package/lib/server/modules/schedule/index.js +40 -47
  150. package/lib/solution/BaseSales/index.d.ts +9 -131
  151. package/lib/solution/BaseSales/index.js +63 -1106
  152. package/lib/solution/BaseSales/types.d.ts +6 -76
  153. package/lib/solution/BaseSales/types.js +1 -3
  154. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
  155. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +18 -106
  156. package/lib/solution/BaseSales/utils.d.ts +1 -1
  157. package/lib/solution/BaseSales/utils.js +10 -54
  158. package/lib/solution/BookingByStep/index.d.ts +1 -1
  159. package/lib/solution/BookingTicket/index.d.ts +10 -270
  160. package/lib/solution/BookingTicket/index.js +29 -922
  161. package/lib/solution/BookingTicket/types.d.ts +1 -118
  162. package/lib/solution/BookingTicket/types.js +0 -11
  163. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
  164. package/lib/solution/BookingTicket/utils/bookingStatus.js +2 -44
  165. package/lib/solution/BookingTicket/utils/cartView.d.ts +1 -9
  166. package/lib/solution/BookingTicket/utils/cartView.js +6 -61
  167. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -5
  168. package/lib/solution/BookingTicket/utils/scan/index.js +3 -17
  169. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  170. package/lib/solution/Checkout/index.d.ts +0 -1
  171. package/lib/solution/Checkout/index.js +2 -1
  172. package/lib/solution/RegisterAndLogin/config.js +10 -2
  173. package/lib/solution/ScanOrder/index.d.ts +3 -9
  174. package/lib/solution/ScanOrder/index.js +70 -153
  175. package/lib/solution/ScanOrder/types.d.ts +5 -9
  176. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  177. package/lib/solution/ScanOrder/utils.js +17 -83
  178. package/lib/solution/VenueBooking/index.d.ts +2 -5
  179. package/lib/solution/VenueBooking/index.js +17 -54
  180. package/lib/solution/VenueBooking/sales-section-4-annotated.json +2 -0
  181. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  182. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
  183. package/lib/types/index.d.ts +0 -10
  184. package/package.json +1 -1
  185. package/dist/modules/BookingContext/index.d.ts +0 -48
  186. package/dist/modules/BookingContext/index.js +0 -566
  187. package/dist/modules/BookingContext/types.d.ts +0 -102
  188. package/dist/modules/BookingContext/types.js +0 -51
  189. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  190. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -284
  191. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  192. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -145
  193. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  194. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -218
  195. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
  196. package/dist/modules/BookingContext/utils/flexible.js +0 -56
  197. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  198. package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
  199. package/dist/modules/BookingContext/utils/index.d.ts +0 -11
  200. package/dist/modules/BookingContext/utils/index.js +0 -11
  201. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
  202. package/dist/modules/BookingContext/utils/noResource.js +0 -77
  203. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  204. package/dist/modules/BookingContext/utils/orderLineDisplay.js +0 -36
  205. package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
  206. package/dist/modules/BookingContext/utils/productExtend.js +0 -339
  207. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  208. package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
  209. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  210. package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
  211. package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
  212. package/dist/modules/BookingContext/utils/resources.js +0 -486
  213. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  214. package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
  215. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  216. package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
  217. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  218. package/dist/modules/Order/utils/manualProductDiscount.js +0 -210
  219. package/dist/modules/SurchargeList/index.d.ts +0 -16
  220. package/dist/modules/SurchargeList/index.js +0 -162
  221. package/dist/modules/SurchargeList/types.d.ts +0 -11
  222. package/dist/modules/SurchargeList/types.js +0 -1
  223. package/dist/server/modules/payment/index.d.ts +0 -28
  224. package/dist/server/modules/payment/index.js +0 -305
  225. package/dist/server/modules/payment/types.d.ts +0 -9
  226. package/dist/server/modules/payment/types.js +0 -1
  227. package/dist/server/test.json +0 -713
  228. package/dist/server/utils/small-ticket.d.ts +0 -71
  229. package/dist/server/utils/small-ticket.js +0 -830
  230. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
  231. package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1438
  232. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  233. package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
  234. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
  235. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
  236. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
  237. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +0 -95
  238. package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  239. package/dist/solution/BookingTicket/utils/exampleData.js +0 -183
  240. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  241. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -438
  242. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
  243. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -399
  244. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
  245. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -56
  246. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  247. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +0 -150
  248. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
  249. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +0 -78
  250. package/lib/modules/BookingContext/index.d.ts +0 -48
  251. package/lib/modules/BookingContext/index.js +0 -368
  252. package/lib/modules/BookingContext/types.d.ts +0 -102
  253. package/lib/modules/BookingContext/types.js +0 -34
  254. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  255. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -276
  256. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  257. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -151
  258. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  259. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -201
  260. package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
  261. package/lib/modules/BookingContext/utils/flexible.js +0 -80
  262. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  263. package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
  264. package/lib/modules/BookingContext/utils/index.d.ts +0 -11
  265. package/lib/modules/BookingContext/utils/index.js +0 -43
  266. package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
  267. package/lib/modules/BookingContext/utils/noResource.js +0 -90
  268. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  269. package/lib/modules/BookingContext/utils/orderLineDisplay.js +0 -56
  270. package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
  271. package/lib/modules/BookingContext/utils/productExtend.js +0 -283
  272. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  273. package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
  274. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  275. package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
  276. package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
  277. package/lib/modules/BookingContext/utils/resources.js +0 -377
  278. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  279. package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
  280. package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  281. package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
  282. package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  283. package/lib/modules/Order/utils/manualProductDiscount.js +0 -206
  284. package/lib/modules/SurchargeList/index.d.ts +0 -16
  285. package/lib/modules/SurchargeList/index.js +0 -89
  286. package/lib/modules/SurchargeList/types.d.ts +0 -11
  287. package/lib/modules/SurchargeList/types.js +0 -17
  288. package/lib/server/modules/payment/index.d.ts +0 -28
  289. package/lib/server/modules/payment/index.js +0 -192
  290. package/lib/server/modules/payment/types.d.ts +0 -9
  291. package/lib/server/modules/payment/types.js +0 -17
  292. package/lib/server/test.json +0 -713
  293. package/lib/server/utils/small-ticket.d.ts +0 -71
  294. package/lib/server/utils/small-ticket.js +0 -781
  295. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
  296. package/lib/solution/BaseSales/utils/cartPromotion.js +0 -992
  297. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  298. package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
  299. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
  300. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
  301. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
  302. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +0 -125
  303. package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  304. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  305. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  306. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -254
  307. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
  308. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -168
  309. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
  310. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -51
  311. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  312. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +0 -127
  313. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
  314. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +0 -85
@@ -1,7 +0,0 @@
1
- import type { QuotationModule } from '../../../modules/Quotation';
2
- import type { BaseSalesCalculateProductBookingPriceParams, BaseSalesProductBookingPriceResult } from '../types';
3
- interface BuildBaseSalesQuotationPriceParams extends BaseSalesCalculateProductBookingPriceParams {
4
- quotation?: Pick<QuotationModule, 'getPriceForProduct' | 'getQuotationShelfId'> | null;
5
- }
6
- export declare function calculateBaseSalesProductBookingPrice(params: BuildBaseSalesQuotationPriceParams): BaseSalesProductBookingPriceResult;
7
- export {};
@@ -1,277 +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/solution/BaseSales/utils/quotationPrice.ts
30
- var quotationPrice_exports = {};
31
- __export(quotationPrice_exports, {
32
- calculateBaseSalesProductBookingPrice: () => calculateBaseSalesProductBookingPrice
33
- });
34
- module.exports = __toCommonJS(quotationPrice_exports);
35
- var import_dayjs = __toESM(require("dayjs"));
36
- var import_decimal = __toESM(require("decimal.js"));
37
- function toFiniteNumber(value, fallback = 0) {
38
- const parsedValue = Number(value);
39
- if (!Number.isFinite(parsedValue))
40
- return fallback;
41
- return parsedValue;
42
- }
43
- function toPositiveInt(value, fallback = 1) {
44
- const parsedValue = Math.floor(Number(value));
45
- if (!Number.isFinite(parsedValue) || parsedValue < 1)
46
- return fallback;
47
- return parsedValue;
48
- }
49
- function toPriceString(value) {
50
- return new import_decimal.default(Number(value) || 0).toDecimalPlaces(2).toFixed(2);
51
- }
52
- function normalizeDateTime(value) {
53
- if (typeof value !== "string" || !value.trim())
54
- return null;
55
- const normalized = value.includes(":") ? value : `${value} 00:00:00`;
56
- const datetime = (0, import_dayjs.default)(normalized);
57
- if (!datetime.isValid())
58
- return null;
59
- return datetime;
60
- }
61
- function buildBookingDateTime(date, time) {
62
- if (typeof date !== "string" || !date.trim())
63
- return null;
64
- const timeText = typeof time === "string" && time.trim() ? time.trim() : "00:00";
65
- const datetime = (0, import_dayjs.default)(`${date.trim()} ${timeText}`);
66
- if (!datetime.isValid())
67
- return null;
68
- return datetime;
69
- }
70
- function getDurationUnit(type) {
71
- const normalizedType = String(type || "").toLowerCase();
72
- if (normalizedType === "day" || normalizedType === "days")
73
- return "day";
74
- if (normalizedType === "minute" || normalizedType === "minutes")
75
- return "minute";
76
- return null;
77
- }
78
- function getProductId(product) {
79
- const productId = toFiniteNumber(product.product_id ?? product.id, NaN);
80
- if (!Number.isFinite(productId))
81
- return null;
82
- return productId;
83
- }
84
- function getProductVariantId(product) {
85
- const variantId = toFiniteNumber(
86
- product.product_variant_id ?? product.variant_id,
87
- 0
88
- );
89
- if (!Number.isFinite(variantId) || variantId <= 0)
90
- return void 0;
91
- return variantId;
92
- }
93
- function getFallbackPrice(params) {
94
- const product = params.product || {};
95
- return toPriceString(
96
- params.fallback_price ?? product.price ?? product.selling_price ?? product.original_price ?? 0
97
- );
98
- }
99
- function getProductQuantity(product) {
100
- return toPositiveInt(product.num ?? product.quantity, 1);
101
- }
102
- function getBundleProductId(bundle) {
103
- const productId = toFiniteNumber(
104
- bundle.bundle_product_id ?? bundle._bundle_product_id,
105
- NaN
106
- );
107
- if (!Number.isFinite(productId))
108
- return null;
109
- return productId;
110
- }
111
- function getBundleVariantId(bundle) {
112
- const variantId = toFiniteNumber(
113
- bundle.bundle_variant_id ?? bundle.variant_id,
114
- 0
115
- );
116
- if (!Number.isFinite(variantId) || variantId <= 0)
117
- return void 0;
118
- return variantId;
119
- }
120
- function getBundleFallbackPrice(bundle) {
121
- return toPriceString(
122
- bundle.bundle_selling_price ?? bundle.price ?? bundle.original_price ?? bundle.base_price ?? 0
123
- );
124
- }
125
- function shouldSplitByDuration(duration, start, end) {
126
- if (!duration)
127
- return false;
128
- if (!start || !end || !end.isAfter(start))
129
- return false;
130
- const unit = getDurationUnit(duration.type);
131
- const value = toFiniteNumber(duration.value);
132
- return !!unit && value > 0;
133
- }
134
- function buildTimeSegments(params) {
135
- const booking = params.booking || {};
136
- const explicitDatetime = normalizeDateTime(params.datetime);
137
- const bookingStart = buildBookingDateTime(booking.start_date, booking.start_time);
138
- const start = bookingStart || explicitDatetime || (0, import_dayjs.default)();
139
- const bookingEnd = buildBookingDateTime(booking.end_date, booking.end_time);
140
- if (!shouldSplitByDuration(params.duration, start, bookingEnd)) {
141
- return [{ start }];
142
- }
143
- const unit = getDurationUnit(params.duration.type);
144
- const value = toFiniteNumber(params.duration.value);
145
- const segments = [];
146
- let cursor = start;
147
- let guard = 0;
148
- while (cursor.isBefore(bookingEnd) && guard < 1e4) {
149
- const next = cursor.add(value, unit);
150
- segments.push({
151
- start: cursor,
152
- end: next.isBefore(bookingEnd) ? next : bookingEnd ?? void 0
153
- });
154
- cursor = next;
155
- guard += 1;
156
- }
157
- return segments.length ? segments : [{ start }];
158
- }
159
- function formatTimePoint(datetime) {
160
- return datetime.format("YYYY-MM-DD HH:mm:ss");
161
- }
162
- function buildPriceSegment(params) {
163
- const timePoint = formatTimePoint(params.segment.start);
164
- const quotedPrice = params.quotation && params.productId !== null ? params.quotation.getPriceForProduct({
165
- productId: params.productId,
166
- variantId: params.variantId,
167
- datetime: timePoint,
168
- customer_id: params.customerId
169
- }) : null;
170
- const unitPrice = toPriceString(quotedPrice ?? params.fallbackPrice);
171
- const quotationShelfId = quotedPrice !== null && params.quotation && params.productId !== null ? params.quotation.getQuotationShelfId({
172
- productId: params.productId,
173
- variantId: params.variantId,
174
- datetime: timePoint,
175
- customer_id: params.customerId
176
- }) : 0;
177
- return {
178
- start_datetime: timePoint,
179
- end_datetime: params.segment.end ? formatTimePoint(params.segment.end) : void 0,
180
- time_point: timePoint,
181
- unit_price: unitPrice,
182
- quantity: 1,
183
- total_price: unitPrice,
184
- quotation_shelf_id: quotationShelfId,
185
- source: quotedPrice !== null ? "quotation" : "fallback"
186
- };
187
- }
188
- function calculatePriceForProduct(params) {
189
- var _a;
190
- const segments = params.segments.map((segment) => buildPriceSegment({
191
- quotation: params.quotation,
192
- productId: params.productId,
193
- variantId: params.variantId,
194
- customerId: params.customerId,
195
- fallbackPrice: params.fallbackPrice,
196
- segment
197
- }));
198
- const unitPrice = segments.reduce(
199
- (total, segment) => total.plus(segment.total_price),
200
- new import_decimal.default(0)
201
- );
202
- const totalPrice = unitPrice.times(params.quantity);
203
- const quotationShelfId = ((_a = segments.find((segment) => segment.quotation_shelf_id)) == null ? void 0 : _a.quotation_shelf_id) || 0;
204
- return {
205
- unitPrice,
206
- totalPrice,
207
- quotationShelfId,
208
- segments
209
- };
210
- }
211
- function calculateBundlePrices(params, segments) {
212
- var _a;
213
- const bundleList = ((_a = params.product) == null ? void 0 : _a.product_bundle) || [];
214
- if (!bundleList.length)
215
- return void 0;
216
- return bundleList.map((bundle) => {
217
- const productId = getBundleProductId(bundle);
218
- const variantId = getBundleVariantId(bundle);
219
- const quantity = getProductQuantity(bundle);
220
- const price = calculatePriceForProduct({
221
- quotation: params.quotation,
222
- productId,
223
- variantId,
224
- customerId: params.customer_id,
225
- quantity,
226
- fallbackPrice: getBundleFallbackPrice(bundle),
227
- segments
228
- });
229
- return {
230
- bundle_id: bundle.bundle_id ?? bundle.id,
231
- group_id: bundle.group_id,
232
- bundle_group_id: bundle.bundle_group_id,
233
- bundle_product_id: productId,
234
- bundle_variant_id: variantId ?? 0,
235
- unit_price: price.unitPrice.toDecimalPlaces(2).toFixed(2),
236
- total_price: price.totalPrice.toDecimalPlaces(2).toFixed(2),
237
- quantity,
238
- quotation_shelf_id: price.quotationShelfId,
239
- source: price.segments.some((segment) => segment.source === "quotation") ? "quotation" : "fallback",
240
- segments: price.segments
241
- };
242
- });
243
- }
244
- function calculateBaseSalesProductBookingPrice(params) {
245
- const product = params.product || {};
246
- const productId = getProductId(product);
247
- const variantId = getProductVariantId(product);
248
- const productQuantity = getProductQuantity(product);
249
- const fallbackPrice = getFallbackPrice(params);
250
- const timeSegments = buildTimeSegments(params);
251
- const price = calculatePriceForProduct({
252
- quotation: params.quotation,
253
- productId,
254
- variantId,
255
- customerId: params.customer_id,
256
- quantity: productQuantity,
257
- fallbackPrice,
258
- segments: timeSegments
259
- });
260
- const bundlePrices = calculateBundlePrices(params, timeSegments);
261
- return {
262
- product_id: productId,
263
- product_variant_id: variantId ?? 0,
264
- customer_id: params.customer_id,
265
- unit_price: price.unitPrice.toDecimalPlaces(2).toFixed(2),
266
- total_price: price.totalPrice.toDecimalPlaces(2).toFixed(2),
267
- quantity: productQuantity,
268
- duration: params.duration,
269
- quotation_shelf_id: price.quotationShelfId,
270
- segments: price.segments,
271
- ...bundlePrices ? { product_bundle: bundlePrices } : {}
272
- };
273
- }
274
- // Annotate the CommonJS export names for ESM import in node:
275
- 0 && (module.exports = {
276
- calculateBaseSalesProductBookingPrice
277
- });
@@ -1,117 +0,0 @@
1
- import { BookingCalcContext } from '../../../modules/BookingContext';
2
- import type { ProductData } from '../../../modules/Product/types';
3
- import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from '../../../modules/Order/types';
4
- /**
5
- * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
6
- *
7
- * 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
8
- * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(门禁:`getIsAutoClose` on prepared cacheItem)
9
- * 3. `add`:两关均通过,直接 transform + 加车
10
- */
11
- export type AddProductDecision = {
12
- action: 'add';
13
- cacheItem: any;
14
- } | {
15
- action: 'requiresDetail';
16
- payload: AddProductRequiresDetailPayload;
17
- } | {
18
- action: 'requiresBookingEdit';
19
- cacheItem: any;
20
- payload: AddProductRequiresBookingEditPayload;
21
- }
22
- /** session 商品 catalog 日期与 TimeBar 不一致,需 reload products 后由用户重试加购。 */
23
- | {
24
- action: 'reloadCatalog';
25
- };
26
- /** 资源 / 时间编辑抽屉所需的最小 payload。 */
27
- export interface AddProductRequiresBookingEditPayload {
28
- cacheItem: any;
29
- customerId?: number | string;
30
- date: string | null;
31
- }
32
- /**
33
- * 加车主决策:对齐 `handleSelectProduct` 两段分支。
34
- */
35
- export declare function decideAddProduct(item: any, ctx?: AddProductDecideContext): AddProductDecision;
36
- /**
37
- * 规格弹窗 callback 后的第二段决策(对齐 `handleBooking4Service` 内 `cacheItem.autoClose` 分支)。
38
- */
39
- export declare function decideAfterDetail(cacheItem: any, ctx?: AddProductDecideContext): AddProductDecision;
40
- /**
41
- * @deprecated 请用 `decideAddProduct`;保留兼容:autoClose=true 仅表示可直接加车(action=add)。
42
- */
43
- export interface AddProductRequiresDetailPayload {
44
- item: ProductData | Record<string, any>;
45
- /** UI 需展示的子弹窗开关。 */
46
- showConfig: {
47
- option: boolean;
48
- session: boolean;
49
- variant: boolean;
50
- package: boolean;
51
- number: boolean;
52
- };
53
- /** 仅 session 商品(且无 variant/option/package)→ true,UI 可只渲染 session 选择。 */
54
- isOnlySession: boolean;
55
- /** 0/1,与 info2 `getIsEject` 等价含义。 */
56
- isEject: 0 | 1;
57
- /** 当前选中客户 id(透传给 detail 弹窗用)。 */
58
- customerId?: number | string;
59
- /** 当前选择的日期。 */
60
- date: string | null;
61
- /** 透传完整商品数据,UI 渲染时直接用。 */
62
- productData: ProductData | Record<string, any>;
63
- }
64
- export interface AddProductDecideContext extends BookingCalcContext {
65
- type?: 'select' | 'detail';
66
- quantity?: number;
67
- customerId?: number | string;
68
- }
69
- /**
70
- * 统一补齐预约商品的运行态字段。
71
- *
72
- * 新链路不再让决策和提交各自重建 cacheItem;这里作为唯一入口补齐
73
- * `_extend.resource / capacity / startDate / endDate` 等后续 booking mapper 需要的字段。
74
- */
75
- export declare function prepareBookingCacheItem(cacheItem: any, ctx?: AddProductDecideContext): any;
76
- export declare function decideAutoClose(item: any, ctx?: AddProductDecideContext): {
77
- autoClose: boolean;
78
- cacheItem?: any;
79
- };
80
- /**
81
- * 替代 info2 `getIsEject`:商品是否需要弹窗(含 type='detail' / option_group / bundle_group / variant / session / sold_by_weight)。
82
- */
83
- export declare function getIsEject(item: any, type?: 'select' | 'detail'): 0 | 1;
84
- /** 仅 session 商品(且没有 variant/option/package)。 */
85
- export declare function getIsOnlySession(item: any): boolean;
86
- /**
87
- * 拼装 requiresDetail payload;showConfig 与 info2 弹窗内部判断一致。
88
- */
89
- export declare function buildRequiresDetailPayload(item: any, ctx?: AddProductDecideContext): AddProductRequiresDetailPayload;
90
- /**
91
- * 用 item.cartDetailValue 拼装一个 cacheItem 雏形(与 info2 `handleDirectAddService` 等价路径)。
92
- * 这里只补 `_extend.start_date / quantity / other` 等运行态字段;后续走 getProductExtend 才会补齐资源 / 时间。
93
- */
94
- export declare function buildCacheItemFromCartDetail(item: any, ctx?: AddProductDecideContext): any;
95
- /**
96
- * 用 Info2 callback 的 (e, extension_type, detail) 拼装 cacheItem。
97
- *
98
- * 保留 detail._extend 中的 pricing / note(规格弹窗改价、备注等),
99
- * 再叠加 session 时间、ctx.quantity 等运行态字段;other 以 callback `e` 为准。
100
- */
101
- export declare function buildCacheItemFromDetail(item: any, detailResult: {
102
- e: any;
103
- extension_type?: any;
104
- detail?: any;
105
- }, ctx?: AddProductDecideContext): any;
106
- /**
107
- * `transformDetailToProductAndBooking`:把 cacheItem 拆成 OS `addProductToOrder` 所需的 `(product, booking)`。
108
- *
109
- * - `product` 走 `transformBaseProductToOrderProduct`(沿用 BaseSales 现有 mapper)。
110
- * - `booking` 走 `cacheItemToBookingInput`(严格按 TEMP_ORDER_FIELDS_SUMMARY.md 协议)。
111
- * - 普通商品(无 duration / 无 schedules)不产 booking,与 info2 一致。
112
- */
113
- export declare function transformDetailToProductAndBooking(cacheItem: any, ctx?: AddProductDecideContext): {
114
- product: Partial<OrderProduct> & OrderProductIdentity;
115
- booking?: AddProductBookingInput;
116
- cacheItem: any;
117
- };