@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,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,237 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import dayjs from 'dayjs';
8
- import Decimal from 'decimal.js';
9
- function toFiniteNumber(value) {
10
- var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
11
- var parsedValue = Number(value);
12
- if (!Number.isFinite(parsedValue)) return fallback;
13
- return parsedValue;
14
- }
15
- function toPositiveInt(value) {
16
- var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
17
- var parsedValue = Math.floor(Number(value));
18
- if (!Number.isFinite(parsedValue) || parsedValue < 1) return fallback;
19
- return parsedValue;
20
- }
21
- function toPriceString(value) {
22
- return new Decimal(Number(value) || 0).toDecimalPlaces(2).toFixed(2);
23
- }
24
- function normalizeDateTime(value) {
25
- if (typeof value !== 'string' || !value.trim()) return null;
26
- var normalized = value.includes(':') ? value : "".concat(value, " 00:00:00");
27
- var datetime = dayjs(normalized);
28
- if (!datetime.isValid()) return null;
29
- return datetime;
30
- }
31
- function buildBookingDateTime(date, time) {
32
- if (typeof date !== 'string' || !date.trim()) return null;
33
- var timeText = typeof time === 'string' && time.trim() ? time.trim() : '00:00';
34
- var datetime = dayjs("".concat(date.trim(), " ").concat(timeText));
35
- if (!datetime.isValid()) return null;
36
- return datetime;
37
- }
38
- function getDurationUnit(type) {
39
- var normalizedType = String(type || '').toLowerCase();
40
- if (normalizedType === 'day' || normalizedType === 'days') return 'day';
41
- if (normalizedType === 'minute' || normalizedType === 'minutes') return 'minute';
42
- return null;
43
- }
44
- function getProductId(product) {
45
- var _product$product_id;
46
- var productId = toFiniteNumber((_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id, NaN);
47
- if (!Number.isFinite(productId)) return null;
48
- return productId;
49
- }
50
- function getProductVariantId(product) {
51
- var _product$product_vari;
52
- var variantId = toFiniteNumber((_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id, 0);
53
- if (!Number.isFinite(variantId) || variantId <= 0) return undefined;
54
- return variantId;
55
- }
56
- function getFallbackPrice(params) {
57
- var _ref, _ref2, _ref3, _params$fallback_pric;
58
- var product = params.product || {};
59
- return toPriceString((_ref = (_ref2 = (_ref3 = (_params$fallback_pric = params.fallback_price) !== null && _params$fallback_pric !== void 0 ? _params$fallback_pric : product.price) !== null && _ref3 !== void 0 ? _ref3 : product.selling_price) !== null && _ref2 !== void 0 ? _ref2 : product.original_price) !== null && _ref !== void 0 ? _ref : 0);
60
- }
61
- function getProductQuantity(product) {
62
- var _product$num;
63
- return toPositiveInt((_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity, 1);
64
- }
65
- function getBundleProductId(bundle) {
66
- var _bundle$bundle_produc;
67
- var productId = toFiniteNumber((_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id, NaN);
68
- if (!Number.isFinite(productId)) return null;
69
- return productId;
70
- }
71
- function getBundleVariantId(bundle) {
72
- var _bundle$bundle_varian;
73
- var variantId = toFiniteNumber((_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id, 0);
74
- if (!Number.isFinite(variantId) || variantId <= 0) return undefined;
75
- return variantId;
76
- }
77
- function getBundleFallbackPrice(bundle) {
78
- var _ref4, _ref5, _ref6, _bundle$bundle_sellin;
79
- return toPriceString((_ref4 = (_ref5 = (_ref6 = (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.price) !== null && _ref6 !== void 0 ? _ref6 : bundle.original_price) !== null && _ref5 !== void 0 ? _ref5 : bundle.base_price) !== null && _ref4 !== void 0 ? _ref4 : 0);
80
- }
81
- function shouldSplitByDuration(duration, start, end) {
82
- if (!duration) return false;
83
- if (!start || !end || !end.isAfter(start)) return false;
84
- var unit = getDurationUnit(duration.type);
85
- var value = toFiniteNumber(duration.value);
86
- return !!unit && value > 0;
87
- }
88
- function buildTimeSegments(params) {
89
- var booking = params.booking || {};
90
- var explicitDatetime = normalizeDateTime(params.datetime);
91
- var bookingStart = buildBookingDateTime(booking.start_date, booking.start_time);
92
- var start = bookingStart || explicitDatetime || dayjs();
93
- var bookingEnd = buildBookingDateTime(booking.end_date, booking.end_time);
94
- if (!shouldSplitByDuration(params.duration, start, bookingEnd)) {
95
- return [{
96
- start: start
97
- }];
98
- }
99
- var unit = getDurationUnit(params.duration.type);
100
- var value = toFiniteNumber(params.duration.value);
101
- var segments = [];
102
- var cursor = start;
103
- var guard = 0;
104
- while (cursor.isBefore(bookingEnd) && guard < 10000) {
105
- var next = cursor.add(value, unit);
106
- segments.push({
107
- start: cursor,
108
- end: next.isBefore(bookingEnd) ? next : bookingEnd !== null && bookingEnd !== void 0 ? bookingEnd : undefined
109
- });
110
- cursor = next;
111
- guard += 1;
112
- }
113
- return segments.length ? segments : [{
114
- start: start
115
- }];
116
- }
117
- function formatTimePoint(datetime) {
118
- return datetime.format('YYYY-MM-DD HH:mm:ss');
119
- }
120
- function buildPriceSegment(params) {
121
- var timePoint = formatTimePoint(params.segment.start);
122
- var quotedPrice = params.quotation && params.productId !== null ? params.quotation.getPriceForProduct({
123
- productId: params.productId,
124
- variantId: params.variantId,
125
- datetime: timePoint,
126
- customer_id: params.customerId
127
- }) : null;
128
- var unitPrice = toPriceString(quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : params.fallbackPrice);
129
- var quotationShelfId = quotedPrice !== null && params.quotation && params.productId !== null ? params.quotation.getQuotationShelfId({
130
- productId: params.productId,
131
- variantId: params.variantId,
132
- datetime: timePoint,
133
- customer_id: params.customerId
134
- }) : 0;
135
- return {
136
- start_datetime: timePoint,
137
- end_datetime: params.segment.end ? formatTimePoint(params.segment.end) : undefined,
138
- time_point: timePoint,
139
- unit_price: unitPrice,
140
- quantity: 1,
141
- total_price: unitPrice,
142
- quotation_shelf_id: quotationShelfId,
143
- source: quotedPrice !== null ? 'quotation' : 'fallback'
144
- };
145
- }
146
- function calculatePriceForProduct(params) {
147
- var _segments$find;
148
- var segments = params.segments.map(function (segment) {
149
- return buildPriceSegment({
150
- quotation: params.quotation,
151
- productId: params.productId,
152
- variantId: params.variantId,
153
- customerId: params.customerId,
154
- fallbackPrice: params.fallbackPrice,
155
- segment: segment
156
- });
157
- });
158
- var unitPrice = segments.reduce(function (total, segment) {
159
- return total.plus(segment.total_price);
160
- }, new Decimal(0));
161
- var totalPrice = unitPrice.times(params.quantity);
162
- var quotationShelfId = ((_segments$find = segments.find(function (segment) {
163
- return segment.quotation_shelf_id;
164
- })) === null || _segments$find === void 0 ? void 0 : _segments$find.quotation_shelf_id) || 0;
165
- return {
166
- unitPrice: unitPrice,
167
- totalPrice: totalPrice,
168
- quotationShelfId: quotationShelfId,
169
- segments: segments
170
- };
171
- }
172
- function calculateBundlePrices(params, segments) {
173
- var _params$product;
174
- var bundleList = ((_params$product = params.product) === null || _params$product === void 0 ? void 0 : _params$product.product_bundle) || [];
175
- if (!bundleList.length) return undefined;
176
- return bundleList.map(function (bundle) {
177
- var _bundle$bundle_id;
178
- var productId = getBundleProductId(bundle);
179
- var variantId = getBundleVariantId(bundle);
180
- var quantity = getProductQuantity(bundle);
181
- var price = calculatePriceForProduct({
182
- quotation: params.quotation,
183
- productId: productId,
184
- variantId: variantId,
185
- customerId: params.customer_id,
186
- quantity: quantity,
187
- fallbackPrice: getBundleFallbackPrice(bundle),
188
- segments: segments
189
- });
190
- return {
191
- bundle_id: (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id,
192
- group_id: bundle.group_id,
193
- bundle_group_id: bundle.bundle_group_id,
194
- bundle_product_id: productId,
195
- bundle_variant_id: variantId !== null && variantId !== void 0 ? variantId : 0,
196
- unit_price: price.unitPrice.toDecimalPlaces(2).toFixed(2),
197
- total_price: price.totalPrice.toDecimalPlaces(2).toFixed(2),
198
- quantity: quantity,
199
- quotation_shelf_id: price.quotationShelfId,
200
- source: price.segments.some(function (segment) {
201
- return segment.source === 'quotation';
202
- }) ? 'quotation' : 'fallback',
203
- segments: price.segments
204
- };
205
- });
206
- }
207
- export function calculateBaseSalesProductBookingPrice(params) {
208
- var product = params.product || {};
209
- var productId = getProductId(product);
210
- var variantId = getProductVariantId(product);
211
- var productQuantity = getProductQuantity(product);
212
- var fallbackPrice = getFallbackPrice(params);
213
- var timeSegments = buildTimeSegments(params);
214
- var price = calculatePriceForProduct({
215
- quotation: params.quotation,
216
- productId: productId,
217
- variantId: variantId,
218
- customerId: params.customer_id,
219
- quantity: productQuantity,
220
- fallbackPrice: fallbackPrice,
221
- segments: timeSegments
222
- });
223
- var bundlePrices = calculateBundlePrices(params, timeSegments);
224
- return _objectSpread({
225
- product_id: productId,
226
- product_variant_id: variantId !== null && variantId !== void 0 ? variantId : 0,
227
- customer_id: params.customer_id,
228
- unit_price: price.unitPrice.toDecimalPlaces(2).toFixed(2),
229
- total_price: price.totalPrice.toDecimalPlaces(2).toFixed(2),
230
- quantity: productQuantity,
231
- duration: params.duration,
232
- quotation_shelf_id: price.quotationShelfId,
233
- segments: price.segments
234
- }, bundlePrices ? {
235
- product_bundle: bundlePrices
236
- } : {});
237
- }
@@ -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
- };