@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,486 +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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
- 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; }
7
- 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; }
8
- 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; }
9
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
- 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); }
11
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
12
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
- import dayjs from 'dayjs';
15
- import { cloneDeep } from 'lodash-es';
16
- import { flexibleObj } from "./flexible";
17
- import { getNoResource2 } from "./noResource";
18
- import { getServeStartTime } from "./serviceTimes";
19
-
20
- /**
21
- * 资源运行态计算 helper(搬自 info2 `utilsByBooking.ts` + `service/addService/utils.tsx`)。
22
- *
23
- * 本文件输入输出全部为 plain object,不依赖 React / locales / @pisell/icon / mini-redux。
24
- * 调用方传入:resource origin map(`/form/schedule` 返回) / cacheItem(含 `_extend.duration / _extend.start_date / _extend.start_time` 等)。
25
- *
26
- * 三个 info2 独有特性保留:
27
- * 1. `resource_display_scope='all'`:取全部资源
28
- * 2. `extraResources`:拖入未绑定资源时兼容渲染
29
- * 3. `getNoResource2()`:占位"无资源"行
30
- */
31
-
32
- /**
33
- * 从已选资源中取「最早结束」的 usableTime,供灵活时长计算上限。
34
- * 与 info2 `service/addService/utils.tsx#getUsableTime` 等价。
35
- */
36
- export function getUsableTime(cacheItem) {
37
- try {
38
- var _cacheItem$_extend, _cacheItem$_data;
39
- var resourceByForm = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.resource) || {};
40
- var resourceMaps = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_data = cacheItem._data) === null || _cacheItem$_data === void 0 ? void 0 : _cacheItem$_data.resourceMaps) || {};
41
- var items = [];
42
- var _loop = function _loop() {
43
- var _resourceMaps$formId;
44
- var formId = _Object$keys[_i];
45
- var selected = resourceByForm[formId];
46
- var maps = (_resourceMaps$formId = resourceMaps[formId]) === null || _resourceMaps$formId === void 0 ? void 0 : _resourceMaps$formId.renderListMaps;
47
- if (!Array.isArray(selected) || !maps) return 1; // continue
48
- items = items.concat(selected.map(function (d) {
49
- return maps[d.relation_id];
50
- }).filter(Boolean));
51
- };
52
- for (var _i = 0, _Object$keys = Object.keys(resourceByForm); _i < _Object$keys.length; _i++) {
53
- if (_loop()) continue;
54
- }
55
- if (!items.length) return null;
56
- return items.reduce(function (pre, event) {
57
- var _event$_extend, _pre$_extend;
58
- var endAt = dayjs((_event$_extend = event._extend) === null || _event$_extend === void 0 || (_event$_extend = _event$_extend.usableTime) === null || _event$_extend === void 0 ? void 0 : _event$_extend.end_at);
59
- var preEnd = dayjs((_pre$_extend = pre._extend) === null || _pre$_extend === void 0 || (_pre$_extend = _pre$_extend.usableTime) === null || _pre$_extend === void 0 ? void 0 : _pre$_extend.end_at);
60
- return endAt.isBefore(preEnd) ? event : pre;
61
- }, items[0]);
62
- } catch (_unused) {
63
- return null;
64
- }
65
- }
66
-
67
- /** Σ cacheItem._extend.capacity[].value × _extend.quantity。 */
68
- export function getSumCapacity(cacheItem) {
69
- var _cacheItem$_extend2, _cacheItem$_extend3;
70
- var isCalcQuantity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
71
- var list = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.capacity) || [];
72
- var sum = 0;
73
- var _iterator = _createForOfIteratorHelper(list),
74
- _step;
75
- try {
76
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
77
- var item = _step.value;
78
- sum += Number((item === null || item === void 0 ? void 0 : item.value) || 0);
79
- }
80
- } catch (err) {
81
- _iterator.e(err);
82
- } finally {
83
- _iterator.f();
84
- }
85
- return sum * (isCalcQuantity ? (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend3 = cacheItem._extend) === null || _cacheItem$_extend3 === void 0 ? void 0 : _cacheItem$_extend3.quantity) || 1 : 1);
86
- }
87
-
88
- /** 当前 time 剩余容量 = totalCapacity - Σ event.pax。 */
89
- function getUseableEventCount(eventList, current) {
90
- return (eventList || []).reduce(function (pre, event) {
91
- return pre - ((event === null || event === void 0 ? void 0 : event.pax) || 0);
92
- }, current || 0);
93
- }
94
-
95
- /** 判断两个时间段是否有冲突。 */
96
- function isConflict(event, current) {
97
- var eventStart = dayjs(event.start_at);
98
- var eventEnd = dayjs(event.end_at);
99
- var currentStart = dayjs(current.start_at);
100
- var isBefore = currentStart.isBefore(eventEnd);
101
- var isAfter = true;
102
- if (current.end_at) {
103
- var currentEnd = dayjs(current.end_at);
104
- isAfter = currentEnd.isAfter(eventStart);
105
- }
106
- return isBefore && isAfter;
107
- }
108
-
109
- /**
110
- * 判断单个 time 是否可用,写回 `_extend` 标记位(isDateRange / isCountRange / isUsable / isMaxLimitRange)。
111
- * 与 info2 `utilsByBooking.ts#getResourceTimeIsUsable` 等价。
112
- */
113
- export function getResourceTimeIsUsable(item, cacheItem, resourceItem) {
114
- var startDate = dayjs("".concat(dayjs(cacheItem._extend.start_date).format('YYYY-MM-DD'), " ").concat(getServeStartTime(cacheItem._extend.start_time)));
115
- var isFlexible = flexibleObj.isFlexible(cacheItem._extend.duration);
116
- var isMaxLimitRange = false;
117
- var isDateRange = false;
118
- var isCountRange = false;
119
- var time = _objectSpread({}, item);
120
- var timeStartDate = dayjs("".concat(time.start_date, " ").concat(time.start_time)).subtract(1, 'second');
121
- var timeEndDate = dayjs("".concat(time.end_date, " ").concat(time.end_time)).add(1, 'second');
122
- var totalCount = getUseableEventCount(time.event_list, resourceItem.capacity);
123
- var currentCount = getSumCapacity(cacheItem);
124
- var eventList = time.event_list || [];
125
- if (cacheItem !== null && cacheItem !== void 0 && cacheItem.booking_id) {
126
- eventList = eventList.filter(function (event) {
127
- return event.id !== cacheItem.booking_id;
128
- });
129
- }
130
- var endDate = null;
131
- var isCalcCount = true;
132
- if (isFlexible) {
133
- isDateRange = startDate.isAfter(timeStartDate) && startDate.isBefore(timeEndDate);
134
- if (!isDateRange && eventList.length) {
135
- isCalcCount = false;
136
- isDateRange = true;
137
- isCountRange = false;
138
- }
139
- } else {
140
- endDate = startDate.add(flexibleObj.getValue(cacheItem._extend.duration), 'minute');
141
- var isTimeRange = startDate.isAfter(timeStartDate) && endDate.isBefore(timeEndDate);
142
- if (isTimeRange) isDateRange = true;
143
- }
144
- if (isCalcCount) {
145
- var conflict = (eventList || []).filter(function (d) {
146
- return isConflict({
147
- start_at: d.start_at,
148
- end_at: d.end_at
149
- }, {
150
- start_at: startDate,
151
- end_at: endDate
152
- });
153
- });
154
- if (resourceItem.resourceType === 'single') {
155
- isCountRange = conflict.length === 0;
156
- } else {
157
- var conflictCount = getUseableEventCount(conflict, resourceItem.capacity);
158
- isCountRange = currentCount <= conflictCount;
159
- // totalCount 当前未直接参与判定,保留 reference 以与原版接近。
160
- void totalCount;
161
- }
162
- }
163
- var isUsable = isDateRange && isCountRange;
164
- time._extend = {
165
- isMaxLimitRange: isMaxLimitRange,
166
- isDateRange: isDateRange,
167
- isCountRange: isCountRange,
168
- isUsable: isUsable
169
- };
170
- return time;
171
- }
172
-
173
- /**
174
- * 在 resource.times 中找到最佳可用 time,并写回 `_extend.usableTime`。
175
- * 与 info2 `utilsByBooking.ts#formatTimes` 等价。
176
- */
177
- export function formatTimes(resourceItem, cacheItem) {
178
- var usableTimes = [];
179
- var _resourceItem = _objectSpread({}, resourceItem);
180
- var sum = getSumCapacity(cacheItem);
181
- if (_resourceItem.capacity >= sum) {
182
- _resourceItem.times = (_resourceItem.times || []).map(function (time) {
183
- var _time$_extend;
184
- var _time = getResourceTimeIsUsable(time, cacheItem, _resourceItem);
185
- if (_time !== null && _time !== void 0 && (_time$_extend = _time._extend) !== null && _time$_extend !== void 0 && _time$_extend.isDateRange) usableTimes.push(_time);
186
- return _time;
187
- });
188
- }
189
- var _time = usableTimes.sort(function (a, b) {
190
- var aEnd = dayjs("".concat(a.end_date, " ").concat(a.end_time)).valueOf();
191
- var bEnd = dayjs("".concat(b.end_date, " ").concat(b.end_time)).valueOf();
192
- return aEnd - bEnd;
193
- })[0];
194
- resourceItem._extend = _objectSpread(_objectSpread({}, resourceItem._extend), {}, {
195
- usableTime: _time
196
- });
197
- return resourceItem;
198
- }
199
-
200
- /**
201
- * 单个 resource 的整体可用性 + labelText 填充。
202
- * 与 info2 `utilsByBooking.ts#formatResource` 等价;不再接收 formatLabel 回调(OS 不渲染 JSX)。
203
- */
204
- export function formatResource(resourceItem, cacheItem) {
205
- var _resourceItem$_extend;
206
- var _resourceItem = _objectSpread({}, resourceItem);
207
- _resourceItem = formatTimes(_resourceItem, cacheItem);
208
- _resourceItem.labelText = _resourceItem.main_field;
209
- var usable = (_resourceItem$_extend = _resourceItem._extend) === null || _resourceItem$_extend === void 0 || (_resourceItem$_extend = _resourceItem$_extend.usableTime) === null || _resourceItem$_extend === void 0 || (_resourceItem$_extend = _resourceItem$_extend._extend) === null || _resourceItem$_extend === void 0 ? void 0 : _resourceItem$_extend.isUsable;
210
- _resourceItem.usable = usable;
211
- return _resourceItem;
212
- }
213
-
214
- /**
215
- * 把单个 resource origin 类型(如「技师」)的 renderList 中每个资源跑一遍 formatResource,
216
- * 并维护 unbound 标记(拖入未绑定资源时 UI 用)。
217
- * 与 info2 `service/addService/utils.tsx#formatResources` 等价(剥 JSX)。
218
- */
219
- export function formatResources(params) {
220
- var cacheItem = params.cacheItem,
221
- resourcesOrigin = params.resourcesOrigin;
222
- try {
223
- var maps = {};
224
- var list = resourcesOrigin.map(function (item) {
225
- var _item = cloneDeep(item);
226
- var renderListMaps = {};
227
- _item.renderList = _item.renderList.map(function (d) {
228
- var res = formatResource(d, cacheItem);
229
- var unbound = !item.optional_resource.includes(res.id) && !item.default_resource.includes(res.id) && res.id !== 0;
230
- if (unbound) res.unbound = true;
231
- renderListMaps[res.id] = res;
232
- return res;
233
- }).sort(function (a, b) {
234
- return b.usable ? 1 : -1;
235
- });
236
- maps[_item.form_id] = _objectSpread(_objectSpread({}, _item), {}, {
237
- renderListMaps: renderListMaps
238
- });
239
- return _item;
240
- });
241
- return {
242
- list: list,
243
- maps: maps
244
- };
245
- } catch (err) {
246
- console.warn('[BookingContext] formatResources error', err);
247
- return {
248
- list: [],
249
- maps: {}
250
- };
251
- }
252
- }
253
-
254
- /** 取可用资源中"最大空闲时长"的那一个,作为自动分派候选。 */
255
- function getResourceMaxFreeTime(resource, isAutoAllocationOn) {
256
- var renderList = resource.renderList,
257
- form_id = resource.form_id;
258
- if (!isAutoAllocationOn(form_id)) return [];
259
- var usableList = (renderList || []).filter(function (d) {
260
- return d.usable && d.id !== 0;
261
- });
262
- var defaultResource = [];
263
- var maxFreeTime = 0;
264
- usableList.forEach(function (d) {
265
- var _d$times = d.times,
266
- times = _d$times === void 0 ? [] : _d$times;
267
- var currentMaxFreeTime = times.reduce(function (pre, cur) {
268
- var _cur$event_list, _cur$event_list2;
269
- var start = ((_cur$event_list = cur.event_list) === null || _cur$event_list === void 0 || (_cur$event_list = _cur$event_list[((_cur$event_list2 = cur.event_list) === null || _cur$event_list2 === void 0 ? void 0 : _cur$event_list2.length) - 1]) === null || _cur$event_list === void 0 ? void 0 : _cur$event_list.end_at) || cur.start_at;
270
- var end = cur.end_at;
271
- var diff = dayjs(end).diff(dayjs(start), 'minute');
272
- return diff > pre ? diff : pre;
273
- }, 0);
274
- if (currentMaxFreeTime > maxFreeTime) {
275
- maxFreeTime = currentMaxFreeTime;
276
- defaultResource = [d];
277
- }
278
- });
279
- return defaultResource;
280
- }
281
-
282
- /**
283
- * 计算每类资源的默认值(写入 cacheItem._extend.resource)。
284
- * 与 info2 `service/addService/utils.tsx#setDefaultResource` 等价;
285
- * `resourceIdFromCalendar` 替代原版 sessionStorage `serviceParams.resource_id` 读取。
286
- */
287
- export function setDefaultResource(params) {
288
- var cacheItem = params.cacheItem,
289
- resources = params.resources,
290
- resourceIdFromCalendar = params.resourceIdFromCalendar,
291
- _params$isAutoAllocat = params.isAutoAllocationOn,
292
- isAutoAllocationOn = _params$isAutoAllocat === void 0 ? function () {
293
- return true;
294
- } : _params$isAutoAllocat;
295
- var obj = {};
296
- var resourceId = Number(resourceIdFromCalendar) || 0;
297
- var _iterator2 = _createForOfIteratorHelper(resources),
298
- _step2;
299
- try {
300
- var _loop2 = function _loop2() {
301
- var item = _step2.value;
302
- var _item$select_type = item.select_type,
303
- select_type = _item$select_type === void 0 ? {} : _item$select_type,
304
- _item$optional_resour = item.optional_resource,
305
- optional_resource = _item$optional_resour === void 0 ? [] : _item$optional_resour,
306
- _item$default_resourc = item.default_resource,
307
- default_resource = _item$default_resourc === void 0 ? [] : _item$default_resourc;
308
- var renderList = item.renderList.filter(function (d) {
309
- if ((select_type === null || select_type === void 0 ? void 0 : select_type.type) === 'single') {
310
- if (resourceId && (optional_resource.includes(resourceId) || default_resource.includes(resourceId))) {
311
- return d.id === resourceId;
312
- }
313
- return d.is_default === 1;
314
- }
315
- return d.is_default === 1 || d.id === resourceId;
316
- });
317
- var defaultOriginalResource = [];
318
- if (renderList.length === 0) {
319
- defaultOriginalResource = getResourceMaxFreeTime(item, isAutoAllocationOn);
320
- } else {
321
- defaultOriginalResource = renderList;
322
- }
323
- obj[item.form_id] = defaultOriginalResource.map(function (d) {
324
- return {
325
- children: d.children,
326
- relation_type: d.relation_type,
327
- form_id: item.form_id,
328
- relation_id: d.id,
329
- like_status: 'common',
330
- metadata: {
331
- form_name: item.title,
332
- resource_name: d.main_field
333
- }
334
- };
335
- });
336
- // errors 字段由调用方在需要时通过 getResourceErrors 单独算,OS 这里不耦合。
337
- };
338
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
339
- _loop2();
340
- }
341
- } catch (err) {
342
- _iterator2.e(err);
343
- } finally {
344
- _iterator2.f();
345
- }
346
- return obj;
347
- }
348
-
349
- /**
350
- * 计算默认容量(与 info2 `setDefaultCapacitys` 等价)。
351
- * package:按 _extend.other.bundle 拆 quantity;custom:按 capacity.custom[].min;其他:[{id:0,value:1}]。
352
- */
353
- export function setDefaultCapacitys(params) {
354
- var capacitys = params.capacitys,
355
- cacheItem = params.cacheItem;
356
- if ((capacitys === null || capacitys === void 0 ? void 0 : capacitys.type) === 'package') {
357
- var _cacheItem$_extend4;
358
- return ((cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend4 = cacheItem._extend) === null || _cacheItem$_extend4 === void 0 || (_cacheItem$_extend4 = _cacheItem$_extend4.other) === null || _cacheItem$_extend4 === void 0 ? void 0 : _cacheItem$_extend4.bundle) || []).map(function (d) {
359
- var id = d._bundle_product_id;
360
- var item = ((capacitys === null || capacitys === void 0 ? void 0 : capacitys.package) || []).find(function (p) {
361
- return p.product_id === id;
362
- });
363
- return {
364
- id: id,
365
- value: item ? d.quantity || 0 : 0,
366
- name: (item === null || item === void 0 ? void 0 : item.name) || (d === null || d === void 0 ? void 0 : d.title)
367
- };
368
- });
369
- }
370
- if ((capacitys === null || capacitys === void 0 ? void 0 : capacitys.type) === 'custom') {
371
- return ((capacitys === null || capacitys === void 0 ? void 0 : capacitys.custom) || []).map(function (d) {
372
- return {
373
- id: d.id,
374
- value: d.min,
375
- name: d.name
376
- };
377
- });
378
- }
379
- return [{
380
- id: 0,
381
- value: 1,
382
- name: ''
383
- }];
384
- }
385
-
386
- /**
387
- * 通过商品 `product_resource.resources[]` 关联的 form/resource id,从 resourcesOriginMap 还原资源数据。
388
- * 与 info2 `service/addService/utils.tsx#getResourceByIds` 等价(保留三特性)。
389
- */
390
- export function getResourceByIds(resourcesOriginMap, cacheItem, extraParams) {
391
- var _cacheItem$product_re;
392
- var _resources = _toConsumableArray((cacheItem === null || cacheItem === void 0 || (_cacheItem$product_re = cacheItem.product_resource) === null || _cacheItem$product_re === void 0 ? void 0 : _cacheItem$product_re.resources) || []).filter(function (d) {
393
- return Number(d === null || d === void 0 ? void 0 : d.status) === 1;
394
- }).map(function (item) {
395
- return _objectSpread({}, item);
396
- });
397
- var _ref = extraParams || {},
398
- _ref$extraResources = _ref.extraResources,
399
- extraResources = _ref$extraResources === void 0 ? [] : _ref$extraResources,
400
- _ref$resourcesOrigin = _ref.resourcesOrigin,
401
- resourcesOrigin = _ref$resourcesOrigin === void 0 ? [] : _ref$resourcesOrigin,
402
- _ref$resourceTab = _ref.resourceTab,
403
- resourceTab = _ref$resourceTab === void 0 ? {} : _ref$resourceTab;
404
- var _iterator3 = _createForOfIteratorHelper(_resources),
405
- _step3;
406
- try {
407
- var _loop3 = function _loop3() {
408
- var _resourceTab$item$cod;
409
- var item = _step3.value;
410
- var form_id = item.id;
411
- var isAllResource = (resourceTab === null || resourceTab === void 0 || (_resourceTab$item$cod = resourceTab[item.code]) === null || _resourceTab$item$cod === void 0 ? void 0 : _resourceTab$item$cod.resource_display_scope) === 'all';
412
- var extraResourceIds = [];
413
- if (isAllResource) {
414
- extraResourceIds = (resourcesOrigin || []).filter(function (d) {
415
- return d.form_code === item.code;
416
- }).map(function (d) {
417
- return d.id;
418
- });
419
- } else {
420
- extraResourceIds = extraResources.filter(function (_extraItem) {
421
- return _extraItem.form_id === form_id && !!_extraItem.id && !item.optional_resource.includes(_extraItem.id) && !item.default_resource.includes(_extraItem.id);
422
- }).map(function (_extraItem) {
423
- return _extraItem.id;
424
- });
425
- }
426
- extraResourceIds = Array.from(new Set(extraResourceIds));
427
- item.optional_resource = (item.optional_resource || []).filter(function (d) {
428
- return item.default_resource.indexOf(d) === -1;
429
- });
430
- var getChildrenMetadata = function getChildrenMetadata(id) {
431
- var combiningResources = [];
432
- var origin = resourcesOriginMap[id];
433
- if (origin !== null && origin !== void 0 && origin.combined_resource && origin.combined_resource.status === 1) {
434
- (origin.combined_resource.resource_ids || []).forEach(function (cid) {
435
- if (resourcesOriginMap[cid]) {
436
- var _resourcesOriginMap$c, _resourcesOriginMap$c2;
437
- combiningResources.push(_objectSpread(_objectSpread({}, resourcesOriginMap[cid]), {}, {
438
- relation_id: ((_resourcesOriginMap$c = resourcesOriginMap[cid]) === null || _resourcesOriginMap$c === void 0 ? void 0 : _resourcesOriginMap$c.relation_id) || ((_resourcesOriginMap$c2 = resourcesOriginMap[cid]) === null || _resourcesOriginMap$c2 === void 0 ? void 0 : _resourcesOriginMap$c2.id)
439
- }));
440
- }
441
- });
442
- }
443
- return {
444
- children: combiningResources,
445
- metadata: _objectSpread(_objectSpread({}, (origin === null || origin === void 0 ? void 0 : origin.metadata) || {}), {}, {
446
- combined_resource: origin === null || origin === void 0 ? void 0 : origin.combined_resource
447
- })
448
- };
449
- };
450
- var optional_resource = Array.from(new Set([].concat(_toConsumableArray(item.optional_resource), _toConsumableArray(extraResourceIds)))).map(function (d) {
451
- if (!resourcesOriginMap[d]) return null;
452
- return Object.assign({}, resourcesOriginMap[d], _objectSpread({
453
- form_id: form_id,
454
- resourceType: item.type
455
- }, getChildrenMetadata(d)));
456
- }).filter(function (d) {
457
- return d;
458
- }).concat(getNoResource2({
459
- form_id: form_id
460
- }));
461
- var default_resource = (item.default_resource || []).map(function (d) {
462
- var origin = resourcesOriginMap[d];
463
- if (origin) {
464
- origin.is_default = 1;
465
- return Object.assign({}, origin, _objectSpread({
466
- form_id: form_id,
467
- resourceType: item.type
468
- }, getChildrenMetadata(d)));
469
- }
470
- return null;
471
- }).filter(function (d) {
472
- return d;
473
- });
474
- item.renderList = optional_resource.concat(default_resource);
475
- item.form_id = form_id;
476
- };
477
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
478
- _loop3();
479
- }
480
- } catch (err) {
481
- _iterator3.e(err);
482
- } finally {
483
- _iterator3.f();
484
- }
485
- return _resources;
486
- }
@@ -1,55 +0,0 @@
1
- import { Dayjs } from 'dayjs';
2
- import { getDurationValue } from './flexible';
3
- /**
4
- * 判断商品是否为跨日预约(duration.type === 'days')。与 info2 isMultiDayProduct 等价。
5
- */
6
- export declare function isMultiDayProduct(product: any): boolean;
7
- /**
8
- * 判断 cacheItem 是否为 session 商品(extension_type ∈ session_product / session_ticket)。
9
- */
10
- export declare function isSessionProduct(cacheItem: any): boolean;
11
- /** 从 catalog `cartDetailValue` 或 `_extend.other` 取 session 快照。 */
12
- export declare function getSessionFromItem(item: any): Record<string, any> | null;
13
- /**
14
- * 将 cartDetailValue.session 写入 _extend 的起止时间(与 info2 getServiceStartTimeAndEndTime 的 session 分支一致)。
15
- * 日历日优先用 ctx.date,时分取自 session.start_at / end_at 或 session.start_time / end_time。
16
- */
17
- export declare function applySessionTimesToExtend(item: any, extend: Record<string, any>, ctx?: {
18
- date?: string | Dayjs | null;
19
- }): Record<string, any>;
20
- /**
21
- * 是否应写入 booking(与 Product.utils isNormalProduct 对齐,并覆盖 session_ticket / cartDetailValue.session)。
22
- */
23
- export declare function isBookingProduct(item: any): boolean;
24
- /**
25
- * 处理 'now' 时间占位:'now' → 当前 HH:mm;其他原样返回。
26
- * 与 info2 `getServeStartTime` 等价。
27
- */
28
- export declare function getServeStartTime(startTime: string | undefined | null): string;
29
- /**
30
- * 计算商品的开始结束时间(统一为 dayjs 实例)。
31
- * 与 info2 `getServiceTimes` 行为等价:
32
- * - 跨日商品:startDate = start_date + start_time,endDate = _extend.end_date 原样
33
- * - session 商品:从 _extend.other.session 取 start_at / end_at
34
- * - 普通商品:startDate + duration(含 flexible 处理)
35
- */
36
- export declare function getServiceTimes(service: any): {
37
- startDate: Dayjs;
38
- endDate: Dayjs;
39
- };
40
- /**
41
- * 跨日预约相关:把 _extend.start_date / end_date 都对齐到 dayjs startOf('day')。
42
- * 与 info2 `formatDayDate` 等价。
43
- */
44
- export declare function formatDayDate(_extend: any): {
45
- start_date: Dayjs;
46
- end_date: Dayjs;
47
- };
48
- /**
49
- * 计算跨日预约时长:
50
- * - type='days' → end - start 的天数
51
- * - type='minutes' → end - start 的分钟数
52
- * 与 info2 `getDays` 等价。
53
- */
54
- export declare function getDays(cacheItem: any, type: 'minutes' | 'days'): number;
55
- export { getDurationValue };