@pisell/pisellos 0.0.568 → 0.0.570

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 (455) hide show
  1. package/dist/effects/index.d.ts +2 -2
  2. package/dist/model/strategy/adapter/dataVariant/type.d.ts +3 -3
  3. package/dist/model/strategy/adapter/itemRule/type.d.ts +6 -6
  4. package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
  5. package/dist/model/strategy/adapter/promotion/type.d.ts +5 -5
  6. package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
  7. package/dist/model/strategy/type.d.ts +1 -1
  8. package/dist/modules/BaseModule.d.ts +2 -2
  9. package/dist/modules/BaseModule.js +4 -4
  10. package/dist/modules/BookingContext/index.d.ts +48 -0
  11. package/dist/modules/BookingContext/index.js +566 -0
  12. package/dist/modules/BookingContext/types.d.ts +102 -0
  13. package/dist/modules/BookingContext/types.js +51 -0
  14. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  15. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
  16. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  17. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
  18. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  19. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
  20. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  21. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  22. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  23. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  24. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  25. package/dist/modules/BookingContext/utils/index.js +11 -0
  26. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  27. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  28. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  29. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  30. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  31. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  32. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  33. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  34. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  35. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  36. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  37. package/dist/modules/BookingContext/utils/resources.js +486 -0
  38. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  39. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  40. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  41. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  42. package/dist/modules/Cart/utils/cartProduct.js +26 -5
  43. package/dist/modules/Cart/utils/changePrice.js +27 -20
  44. package/dist/modules/Customer/index.d.ts +20 -0
  45. package/dist/modules/Customer/index.js +172 -83
  46. package/dist/modules/Customer/types.d.ts +3 -1
  47. package/dist/modules/Discount/index.d.ts +2 -1
  48. package/dist/modules/Discount/index.js +37 -9
  49. package/dist/modules/Discount/types.d.ts +2 -1
  50. package/dist/modules/Holder/types.d.ts +1 -1
  51. package/dist/modules/OpenData/index.d.ts +8 -0
  52. package/dist/modules/OpenData/index.js +36 -16
  53. package/dist/modules/OpenData/types.d.ts +1 -1
  54. package/dist/modules/Order/index.d.ts +448 -23
  55. package/dist/modules/Order/index.js +5417 -561
  56. package/dist/modules/Order/types.d.ts +693 -88
  57. package/dist/modules/Order/types.js +68 -1
  58. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  59. package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
  60. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  61. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  62. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  63. package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
  64. package/dist/modules/Order/utils.d.ts +167 -18
  65. package/dist/modules/Order/utils.js +960 -165
  66. package/dist/modules/Payment/index.d.ts +10 -9
  67. package/dist/modules/Payment/index.js +465 -703
  68. package/dist/modules/Payment/types.d.ts +47 -23
  69. package/dist/modules/Payment/utils.d.ts +1 -1
  70. package/dist/modules/Payment/utils.js +4 -3
  71. package/dist/modules/Payment/walletpass.js +44 -29
  72. package/dist/modules/Product/index.d.ts +1 -1
  73. package/dist/modules/Product/types.d.ts +29 -7
  74. package/dist/modules/ProductList/index.d.ts +17 -13
  75. package/dist/modules/ProductList/index.js +184 -74
  76. package/dist/modules/ProductList/types.d.ts +17 -0
  77. package/dist/modules/Quotation/index.d.ts +22 -2
  78. package/dist/modules/Quotation/index.js +108 -42
  79. package/dist/modules/Quotation/types.d.ts +19 -0
  80. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  81. package/dist/modules/ResourcePlanner/index.js +181 -0
  82. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  83. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  84. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  85. package/dist/modules/ResourcePlanner/types.js +1 -0
  86. package/dist/modules/Rules/index.d.ts +8 -10
  87. package/dist/modules/Rules/index.js +222 -109
  88. package/dist/modules/Rules/types.d.ts +15 -4
  89. package/dist/modules/SalesSummary/index.d.ts +23 -26
  90. package/dist/modules/SalesSummary/index.js +152 -46
  91. package/dist/modules/SalesSummary/types.d.ts +9 -1
  92. package/dist/modules/SalesSummary/utils.d.ts +3 -22
  93. package/dist/modules/SalesSummary/utils.js +803 -163
  94. package/dist/modules/ScanOrderLogger/types.d.ts +2 -2
  95. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  96. package/dist/modules/Schedule/getDateIsInSchedule.js +14 -7
  97. package/dist/modules/Schedule/index.d.ts +18 -5
  98. package/dist/modules/Schedule/index.js +78 -24
  99. package/dist/modules/Schedule/type.d.ts +7 -7
  100. package/dist/modules/Schedule/types.d.ts +11 -9
  101. package/dist/modules/Summary/index.js +4 -3
  102. package/dist/modules/SurchargeList/index.d.ts +18 -0
  103. package/dist/modules/SurchargeList/index.js +185 -0
  104. package/dist/modules/SurchargeList/types.d.ts +15 -0
  105. package/dist/modules/SurchargeList/types.js +1 -0
  106. package/dist/modules/index.d.ts +3 -0
  107. package/dist/modules/index.js +4 -1
  108. package/dist/plugins/app.d.ts +2 -0
  109. package/dist/plugins/request.d.ts +3 -2
  110. package/dist/server/index.d.ts +462 -8
  111. package/dist/server/index.js +6112 -656
  112. package/dist/server/modules/floor-plan/index.d.ts +39 -0
  113. package/dist/server/modules/floor-plan/index.js +595 -0
  114. package/dist/server/modules/floor-plan/types.d.ts +43 -0
  115. package/dist/server/modules/floor-plan/types.js +13 -0
  116. package/dist/server/modules/index.d.ts +7 -2
  117. package/dist/server/modules/index.js +6 -0
  118. package/dist/server/modules/menu/types.d.ts +1 -1
  119. package/dist/server/modules/order/index.d.ts +207 -14
  120. package/dist/server/modules/order/index.js +2326 -379
  121. package/dist/server/modules/order/types.d.ts +91 -20
  122. package/dist/server/modules/order/types.js +14 -1
  123. package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
  124. package/dist/server/modules/order/utils/filterBookings.js +118 -11
  125. package/dist/server/modules/order/utils/filterOrders.js +242 -14
  126. package/dist/server/modules/payment/index.d.ts +28 -0
  127. package/dist/server/modules/payment/index.js +305 -0
  128. package/dist/server/modules/payment/types.d.ts +9 -0
  129. package/dist/server/modules/payment/types.js +1 -0
  130. package/dist/server/modules/products/index.d.ts +105 -14
  131. package/dist/server/modules/products/index.js +1393 -516
  132. package/dist/server/modules/products/types.d.ts +35 -2
  133. package/dist/server/modules/products/types.js +4 -0
  134. package/dist/server/modules/quotation/index.d.ts +39 -0
  135. package/dist/server/modules/quotation/index.js +278 -66
  136. package/dist/server/modules/resource/index.d.ts +2 -3
  137. package/dist/server/modules/resource/index.js +108 -86
  138. package/dist/server/modules/resource/types.d.ts +1 -1
  139. package/dist/server/modules/schedule/index.d.ts +6 -4
  140. package/dist/server/modules/schedule/index.js +116 -85
  141. package/dist/server/modules/schedule/utils.d.ts +1 -1
  142. package/dist/server/test.json +713 -0
  143. package/dist/server/types.d.ts +6 -4
  144. package/dist/server/utils/product.js +2 -2
  145. package/dist/server/utils/small-ticket.d.ts +71 -0
  146. package/dist/server/utils/small-ticket.js +963 -0
  147. package/dist/solution/BaseSales/index.d.ts +378 -0
  148. package/dist/solution/BaseSales/index.js +4006 -0
  149. package/dist/solution/BaseSales/types.d.ts +394 -0
  150. package/dist/solution/BaseSales/types.js +40 -0
  151. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  152. package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
  153. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
  154. package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
  155. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
  156. package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
  157. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
  158. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
  159. package/dist/solution/BaseSales/utils.d.ts +40 -0
  160. package/dist/solution/BaseSales/utils.js +263 -0
  161. package/dist/solution/BookingByStep/index.d.ts +2 -2
  162. package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
  163. package/dist/solution/BookingTicket/index.d.ts +382 -25
  164. package/dist/solution/BookingTicket/index.js +2506 -443
  165. package/dist/solution/BookingTicket/types.d.ts +191 -6
  166. package/dist/solution/BookingTicket/types.js +83 -10
  167. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  168. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  169. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  170. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  171. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  172. package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
  173. package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
  174. package/dist/solution/BookingTicket/utils/cartView.js +209 -0
  175. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  176. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  177. package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  178. package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
  179. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  180. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  181. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  182. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  183. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
  184. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +41 -1
  185. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  186. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  187. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  188. package/dist/solution/BookingTicket/utils/scan/handleScan.js +11 -3
  189. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  190. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  191. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  192. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  193. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  194. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  195. package/dist/solution/Checkout/index.d.ts +1 -0
  196. package/dist/solution/Checkout/index.js +25 -34
  197. package/dist/solution/Checkout/utils/index.js +4 -4
  198. package/dist/solution/RegisterAndLogin/config.js +2 -10
  199. package/dist/solution/Sales/index.d.ts +50 -5
  200. package/dist/solution/Sales/index.js +484 -92
  201. package/dist/solution/Sales/types.d.ts +29 -5
  202. package/dist/solution/ScanOrder/index.d.ts +27 -21
  203. package/dist/solution/ScanOrder/index.js +499 -434
  204. package/dist/solution/ScanOrder/types.d.ts +38 -16
  205. package/dist/solution/ScanOrder/types.js +4 -5
  206. package/dist/solution/ScanOrder/utils.d.ts +4 -1
  207. package/dist/solution/ScanOrder/utils.js +109 -34
  208. package/dist/solution/ShopDiscount/index.js +4 -4
  209. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  210. package/dist/solution/ShopDiscount/utils.d.ts +2 -2
  211. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  212. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  213. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  214. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  215. package/dist/solution/VenueBooking/index.d.ts +29 -20
  216. package/dist/solution/VenueBooking/index.js +301 -213
  217. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  218. package/dist/solution/VenueBooking/types.d.ts +1 -1
  219. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  220. package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
  221. package/dist/solution/index.d.ts +2 -0
  222. package/dist/solution/index.js +3 -1
  223. package/dist/types/index.d.ts +12 -2
  224. package/dist/utils/task.d.ts +2 -2
  225. package/dist/utils/watch.d.ts +2 -2
  226. package/lib/effects/index.d.ts +2 -2
  227. package/lib/model/strategy/adapter/dataVariant/type.d.ts +3 -3
  228. package/lib/model/strategy/adapter/itemRule/type.d.ts +6 -6
  229. package/lib/model/strategy/adapter/promotion/evaluator.js +3 -2
  230. package/lib/model/strategy/adapter/promotion/type.d.ts +5 -5
  231. package/lib/model/strategy/adapter/walletPass/utils.js +6 -4
  232. package/lib/model/strategy/type.d.ts +1 -1
  233. package/lib/modules/BaseModule.d.ts +2 -2
  234. package/lib/modules/BaseModule.js +4 -4
  235. package/lib/modules/BookingContext/index.d.ts +48 -0
  236. package/lib/modules/BookingContext/index.js +390 -0
  237. package/lib/modules/BookingContext/types.d.ts +102 -0
  238. package/lib/modules/BookingContext/types.js +48 -0
  239. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  240. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +286 -0
  241. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  242. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
  243. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  244. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +242 -0
  245. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  246. package/lib/modules/BookingContext/utils/flexible.js +63 -0
  247. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  248. package/lib/modules/BookingContext/utils/formatResourceList.js +35 -0
  249. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  250. package/lib/modules/BookingContext/utils/index.js +126 -0
  251. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  252. package/lib/modules/BookingContext/utils/noResource.js +78 -0
  253. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  254. package/lib/modules/BookingContext/utils/orderLineDisplay.js +29 -0
  255. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  256. package/lib/modules/BookingContext/utils/productExtend.js +330 -0
  257. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  258. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  259. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  260. package/lib/modules/BookingContext/utils/resourceSelection.js +24 -0
  261. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  262. package/lib/modules/BookingContext/utils/resources.js +419 -0
  263. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  264. package/lib/modules/BookingContext/utils/serviceTimes.js +161 -0
  265. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  266. package/lib/modules/BookingContext/utils/timeSlices.js +114 -0
  267. package/lib/modules/Cart/utils/cartProduct.js +27 -5
  268. package/lib/modules/Cart/utils/changePrice.js +20 -14
  269. package/lib/modules/Customer/index.d.ts +20 -0
  270. package/lib/modules/Customer/index.js +63 -10
  271. package/lib/modules/Customer/types.d.ts +3 -1
  272. package/lib/modules/Discount/index.d.ts +2 -1
  273. package/lib/modules/Discount/index.js +18 -2
  274. package/lib/modules/Discount/types.d.ts +2 -1
  275. package/lib/modules/Holder/types.d.ts +1 -1
  276. package/lib/modules/OpenData/index.d.ts +8 -0
  277. package/lib/modules/OpenData/index.js +21 -3
  278. package/lib/modules/OpenData/types.d.ts +1 -1
  279. package/lib/modules/Order/index.d.ts +448 -23
  280. package/lib/modules/Order/index.js +3641 -308
  281. package/lib/modules/Order/types.d.ts +693 -88
  282. package/lib/modules/Order/types.js +55 -1
  283. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  284. package/lib/modules/Order/utils/bundleDiscountHydration.js +106 -0
  285. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  286. package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
  287. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  288. package/lib/modules/Order/utils/orderCollectionIdentity.js +353 -0
  289. package/lib/modules/Order/utils.d.ts +167 -18
  290. package/lib/modules/Order/utils.js +974 -138
  291. package/lib/modules/Payment/index.d.ts +10 -9
  292. package/lib/modules/Payment/index.js +30 -124
  293. package/lib/modules/Payment/types.d.ts +47 -23
  294. package/lib/modules/Payment/utils.d.ts +1 -1
  295. package/lib/modules/Payment/utils.js +4 -3
  296. package/lib/modules/Payment/walletpass.js +16 -6
  297. package/lib/modules/Product/index.d.ts +1 -1
  298. package/lib/modules/Product/types.d.ts +29 -7
  299. package/lib/modules/ProductList/index.d.ts +17 -13
  300. package/lib/modules/ProductList/index.js +92 -51
  301. package/lib/modules/ProductList/types.d.ts +17 -0
  302. package/lib/modules/Quotation/index.d.ts +22 -2
  303. package/lib/modules/Quotation/index.js +76 -20
  304. package/lib/modules/Quotation/types.d.ts +19 -0
  305. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  306. package/lib/modules/ResourcePlanner/index.js +147 -0
  307. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  308. package/lib/modules/ResourcePlanner/planner.js +895 -0
  309. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  310. package/lib/modules/ResourcePlanner/types.js +5 -0
  311. package/lib/modules/Rules/index.d.ts +8 -10
  312. package/lib/modules/Rules/index.js +153 -61
  313. package/lib/modules/Rules/types.d.ts +15 -4
  314. package/lib/modules/SalesSummary/index.d.ts +23 -26
  315. package/lib/modules/SalesSummary/index.js +84 -16
  316. package/lib/modules/SalesSummary/types.d.ts +9 -1
  317. package/lib/modules/SalesSummary/utils.d.ts +3 -22
  318. package/lib/modules/SalesSummary/utils.js +616 -111
  319. package/lib/modules/ScanOrderLogger/types.d.ts +2 -2
  320. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  321. package/lib/modules/Schedule/getDateIsInSchedule.js +14 -7
  322. package/lib/modules/Schedule/index.d.ts +18 -5
  323. package/lib/modules/Schedule/index.js +49 -14
  324. package/lib/modules/Schedule/type.d.ts +7 -7
  325. package/lib/modules/Schedule/types.d.ts +11 -9
  326. package/lib/modules/Summary/index.js +2 -2
  327. package/lib/modules/SurchargeList/index.d.ts +18 -0
  328. package/lib/modules/SurchargeList/index.js +95 -0
  329. package/lib/modules/SurchargeList/types.d.ts +15 -0
  330. package/lib/modules/SurchargeList/types.js +5 -0
  331. package/lib/modules/index.d.ts +3 -0
  332. package/lib/modules/index.js +33 -0
  333. package/lib/plugins/app.d.ts +2 -0
  334. package/lib/plugins/request.d.ts +3 -2
  335. package/lib/server/index.d.ts +462 -8
  336. package/lib/server/index.js +3901 -205
  337. package/lib/server/modules/floor-plan/index.d.ts +39 -0
  338. package/lib/server/modules/floor-plan/index.js +306 -0
  339. package/lib/server/modules/floor-plan/types.d.ts +43 -0
  340. package/lib/server/modules/floor-plan/types.js +19 -0
  341. package/lib/server/modules/index.d.ts +7 -2
  342. package/lib/server/modules/index.js +21 -0
  343. package/lib/server/modules/menu/types.d.ts +1 -1
  344. package/lib/server/modules/order/index.d.ts +207 -14
  345. package/lib/server/modules/order/index.js +1324 -141
  346. package/lib/server/modules/order/types.d.ts +91 -20
  347. package/lib/server/modules/order/types.js +11 -1
  348. package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
  349. package/lib/server/modules/order/utils/filterBookings.js +119 -11
  350. package/lib/server/modules/order/utils/filterOrders.js +238 -13
  351. package/lib/server/modules/payment/index.d.ts +28 -0
  352. package/lib/server/modules/payment/index.js +168 -0
  353. package/lib/server/modules/payment/types.d.ts +9 -0
  354. package/lib/server/modules/payment/types.js +5 -0
  355. package/lib/server/modules/products/index.d.ts +105 -14
  356. package/lib/server/modules/products/index.js +588 -97
  357. package/lib/server/modules/products/types.d.ts +35 -2
  358. package/lib/server/modules/products/types.js +3 -0
  359. package/lib/server/modules/quotation/index.d.ts +39 -0
  360. package/lib/server/modules/quotation/index.js +145 -1
  361. package/lib/server/modules/resource/index.d.ts +2 -3
  362. package/lib/server/modules/resource/index.js +71 -45
  363. package/lib/server/modules/resource/types.d.ts +1 -1
  364. package/lib/server/modules/schedule/index.d.ts +6 -4
  365. package/lib/server/modules/schedule/index.js +55 -44
  366. package/lib/server/modules/schedule/utils.d.ts +1 -1
  367. package/lib/server/test.json +713 -0
  368. package/lib/server/types.d.ts +6 -4
  369. package/lib/server/utils/product.js +2 -2
  370. package/lib/server/utils/small-ticket.d.ts +71 -0
  371. package/lib/server/utils/small-ticket.js +926 -0
  372. package/lib/solution/BaseSales/index.d.ts +378 -0
  373. package/lib/solution/BaseSales/index.js +2367 -0
  374. package/lib/solution/BaseSales/types.d.ts +394 -0
  375. package/lib/solution/BaseSales/types.js +47 -0
  376. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  377. package/lib/solution/BaseSales/utils/cartPromotion.js +1155 -0
  378. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
  379. package/lib/solution/BaseSales/utils/parseSalesResponse.js +140 -0
  380. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
  381. package/lib/solution/BaseSales/utils/quotationPrice.js +231 -0
  382. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
  383. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +215 -0
  384. package/lib/solution/BaseSales/utils.d.ts +40 -0
  385. package/lib/solution/BaseSales/utils.js +259 -0
  386. package/lib/solution/BookingByStep/index.d.ts +2 -2
  387. package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
  388. package/lib/solution/BookingTicket/index.d.ts +382 -25
  389. package/lib/solution/BookingTicket/index.js +1350 -76
  390. package/lib/solution/BookingTicket/types.d.ts +191 -6
  391. package/lib/solution/BookingTicket/types.js +71 -10
  392. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  393. package/lib/solution/BookingTicket/utils/addProductDecision.js +353 -0
  394. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  395. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +94 -0
  396. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  397. package/lib/solution/BookingTicket/utils/bookingStatus.js +136 -0
  398. package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
  399. package/lib/solution/BookingTicket/utils/cartView.js +200 -0
  400. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  401. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  402. package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  403. package/lib/solution/BookingTicket/utils/orderCustomer.js +35 -0
  404. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  405. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +387 -0
  406. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  407. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +220 -0
  408. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
  409. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +24 -3
  410. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  411. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +64 -0
  412. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  413. package/lib/solution/BookingTicket/utils/scan/handleScan.js +4 -2
  414. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  415. package/lib/solution/BookingTicket/utils/scan/index.js +14 -2
  416. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  417. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +115 -0
  418. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  419. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +83 -0
  420. package/lib/solution/Checkout/index.d.ts +1 -0
  421. package/lib/solution/Checkout/index.js +18 -19
  422. package/lib/solution/Checkout/utils/index.js +4 -4
  423. package/lib/solution/RegisterAndLogin/config.js +2 -10
  424. package/lib/solution/Sales/index.d.ts +50 -5
  425. package/lib/solution/Sales/index.js +296 -39
  426. package/lib/solution/Sales/types.d.ts +29 -5
  427. package/lib/solution/ScanOrder/index.d.ts +27 -21
  428. package/lib/solution/ScanOrder/index.js +144 -103
  429. package/lib/solution/ScanOrder/types.d.ts +38 -16
  430. package/lib/solution/ScanOrder/types.js +4 -5
  431. package/lib/solution/ScanOrder/utils.d.ts +4 -1
  432. package/lib/solution/ScanOrder/utils.js +98 -26
  433. package/lib/solution/ShopDiscount/index.js +3 -3
  434. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  435. package/lib/solution/ShopDiscount/utils.d.ts +2 -2
  436. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  437. package/lib/solution/UnifiedBookingSales/index.js +1050 -0
  438. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  439. package/lib/solution/UnifiedBookingSales/types.js +14 -0
  440. package/lib/solution/VenueBooking/index.d.ts +29 -20
  441. package/lib/solution/VenueBooking/index.js +169 -94
  442. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  443. package/lib/solution/VenueBooking/types.d.ts +1 -1
  444. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  445. package/lib/solution/VenueBooking/utils/slotMerge.js +9 -3
  446. package/lib/solution/index.d.ts +2 -0
  447. package/lib/solution/index.js +22 -0
  448. package/lib/types/index.d.ts +12 -2
  449. package/lib/utils/task.d.ts +2 -2
  450. package/lib/utils/watch.d.ts +2 -2
  451. package/package.json +18 -19
  452. package/dist/model/strategy/adapter/promotion/index.d.ts +0 -4
  453. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  454. package/lib/model/strategy/adapter/promotion/index.d.ts +0 -4
  455. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -9,6 +9,7 @@ var _exportNames = {
9
9
  exports.ProductList = void 0;
10
10
  var _BaseModule = require("../BaseModule");
11
11
  var _lodashEs = require("lodash-es");
12
+ var _dayjs = _interopRequireDefault(require("dayjs"));
12
13
  var _types = require("./types");
13
14
  Object.keys(_types).forEach(function (key) {
14
15
  if (key === "default" || key === "__esModule") return;
@@ -21,6 +22,7 @@ Object.keys(_types).forEach(function (key) {
21
22
  }
22
23
  });
23
24
  });
25
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
26
  class ProductList extends _BaseModule.BaseModule {
25
27
  defaultName = 'productList';
26
28
  defaultVersion = '1.0.0';
@@ -43,9 +45,34 @@ class ProductList extends _BaseModule.BaseModule {
43
45
  }
44
46
  this.request = core.getPlugin('request');
45
47
  }
48
+
49
+ /**
50
+ * 更新运行态参数,供父级解决方案 setOtherParams 后同步查询上下文。
51
+ *
52
+ * @example
53
+ * productList.updateOtherParams({ channel: 'pos' });
54
+ */
55
+ updateOtherParams(params) {
56
+ this.otherParams = params || {};
57
+ }
46
58
  async storeChange(path, value) {
47
59
  // No longer needed - products are stored as plain objects instead of Product instances
48
60
  }
61
+
62
+ /**
63
+ * 获取加时商品列表。
64
+ *
65
+ * @example
66
+ * const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
67
+ */
68
+ async getAddTimeProducts(params = {}) {
69
+ return this.loadProducts({
70
+ schedule_date: (0, _dayjs.default)().format('YYYY-MM-DD'),
71
+ status: 'published',
72
+ ...params,
73
+ extension_type: ['product_add_time']
74
+ });
75
+ }
49
76
  async loadProducts({
50
77
  category_ids = [],
51
78
  product_ids = [],
@@ -57,8 +84,11 @@ class ProductList extends _BaseModule.BaseModule {
57
84
  schedule_date,
58
85
  cacheId,
59
86
  with_schedule,
87
+ extension_type,
88
+ status = 'published',
89
+ strategy_context,
60
90
  with_extra = []
61
- }, options) {
91
+ } = {}, options) {
62
92
  // // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
63
93
  // if (!schedule_ids?.length) {
64
94
  // const schedule_ids_data = this.store.schedule
@@ -78,58 +108,64 @@ class ProductList extends _BaseModule.BaseModule {
78
108
  } catch (error) {
79
109
  console.error(error);
80
110
  }
111
+ // 如果没传schedule_date,则从
81
112
  const channelMap = {
82
- 'online_store': 'online-store',
83
- 'scan_to_order': 'online-store',
84
- 'scan_to_order_2': 'online-store',
85
- 'scan_to_order_3': 'online-store'
113
+ online_store: 'online-store',
114
+ scan_to_order: 'online-store',
115
+ 'scan-to-order': 'online-store',
116
+ scan_to_order_2: 'mobile_order',
117
+ scan_to_order_3: 'scantoorder3'
86
118
  };
87
- const saleChannel = channelMap[this.otherParams?.channel] || this.otherParams?.channel;
88
- try {
89
- // 如果没传schedule_date,则从
90
- const productsData = await this.request.post(`/product/query`, {
91
- open_quotation: 1,
92
- open_bundle: 0,
93
- exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
94
- with: ['category', 'collection', 'resourceRelation', ...with_extra],
95
- status: 'published',
96
- num: 500,
97
- skip: 1,
98
- customer_id,
99
- category_ids,
100
- ids: product_ids,
101
- collection,
102
- front_end_cache_id: cacheId,
103
- menu_list_ids,
104
- with_count,
105
- // client_schedule_ids: schedule_ids,
106
- schedule_date,
107
- schedule_datetime,
108
- // application_code: this.otherParams?.channel === 'online_store' ? 'online-store' : this.otherParams?.channel,
109
- application_code: saleChannel,
110
- with_schedule,
111
- is_eject: 1,
112
- open_deposit: 1
113
- }, {
114
- osServer: true,
115
- callback: options?.callback,
116
- subscriberId: options?.subscriberId,
117
- useCache: true,
118
- customToast: () => {}
119
- });
120
- const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
121
- // if (sortedList.length) {
122
- // sortedList.forEach((n: any) => {
123
- // if (n.is_eject !== 1 && n['schedule.ids'] && n['schedule.ids'].length) {
124
- // n.is_eject = 1
125
- // }
126
- // })
127
- // }
128
- this.addProduct(sortedList);
129
- return sortedList;
130
- } catch (error) {
131
- return error;
132
- }
119
+ const rawApplicationCode = this.otherParams?.channel;
120
+ const mappedApplicationCode = typeof rawApplicationCode === 'string' ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
121
+ const queryPayload = {
122
+ open_quotation: 1,
123
+ open_bundle: 0,
124
+ exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
125
+ with: ['category', 'collection', 'resourceRelation', ...with_extra],
126
+ status,
127
+ num: 500,
128
+ skip: 1,
129
+ customer_id,
130
+ ...(Array.isArray(category_ids) && category_ids.length ? {
131
+ category_ids
132
+ } : {}),
133
+ ...(Array.isArray(product_ids) && product_ids.length ? {
134
+ ids: product_ids
135
+ } : {}),
136
+ ...(Array.isArray(collection) && collection.length ? {
137
+ collection
138
+ } : {}),
139
+ front_end_cache_id: cacheId,
140
+ ...(Array.isArray(menu_list_ids) && menu_list_ids.length ? {
141
+ menu_list_ids
142
+ } : {}),
143
+ with_count,
144
+ // client_schedule_ids: schedule_ids,
145
+ schedule_date,
146
+ application_code: mappedApplicationCode,
147
+ is_eject: 1,
148
+ with_schedule,
149
+ schedule_datetime,
150
+ extension_type,
151
+ strategy_context
152
+ };
153
+ const productsData = await this.request.post(`/product/query`, queryPayload, {
154
+ osServer: true,
155
+ callback: options?.callback,
156
+ subscriberId: options?.subscriberId,
157
+ customToast: () => {}
158
+ });
159
+ const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
160
+ // if (sortedList.length) {
161
+ // sortedList.forEach((n: any) => {
162
+ // if (n.is_eject !== 1 && n['schedule.ids'] && n['schedule.ids'].length) {
163
+ // n.is_eject = 1
164
+ // }
165
+ // })
166
+ // }
167
+ this.addProduct(sortedList);
168
+ return sortedList;
133
169
  }
134
170
  async loadProductsPrice({
135
171
  ids = [],
@@ -156,6 +192,11 @@ class ProductList extends _BaseModule.BaseModule {
156
192
  const product = this.store.list.find(product => product.id === id);
157
193
  return product ? (0, _lodashEs.cloneDeep)(product) : undefined;
158
194
  }
195
+ async getProductByIds(ids) {
196
+ await this.core.effects.emit(`${this.name}:onGetProductByIds`, this.store.list);
197
+ const products = this.store.list.filter(product => ids.includes(product.id));
198
+ return products;
199
+ }
159
200
  async addProduct(products) {
160
201
  // list 需要根据 id 去重
161
202
  if (!this.store.list) {
@@ -1,4 +1,21 @@
1
1
  import { ProductData } from '../Product/types';
2
+ export interface ProductListLoadProductsParams {
3
+ category_ids?: number[];
4
+ product_ids?: number[];
5
+ collection?: number | string[];
6
+ schedule_date?: string;
7
+ cacheId?: string;
8
+ customer_id?: number;
9
+ menu_list_ids?: number[];
10
+ schedule_datetime?: string;
11
+ with_count?: string[];
12
+ with_schedule?: number;
13
+ extension_type?: string[];
14
+ status?: string;
15
+ /** 智能定价条件上下文,仅影响策略命中,不参与商品集合筛选 */
16
+ strategy_context?: Record<string, any>;
17
+ with_extra?: any;
18
+ }
2
19
  export interface ProductListData {
3
20
  list: ProductData[];
4
21
  selectProducts: ProductData[];
@@ -1,8 +1,8 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
3
  import type { ScheduleItem } from '../Schedule/types';
4
- import type { QuotationItem } from './types';
5
- export type { QuotationItem, QuotationProductData, QuotationSchedule, QuotationState } from './types';
4
+ import type { QuotationItem, QuotationCustomerScopeInfo } from './types';
5
+ export type { QuotationItem, QuotationProductData, QuotationSchedule, QuotationState, QuotationCustomer, QuotationCustomerScope, QuotationCustomerScopeInfo, } from './types';
6
6
  export declare class QuotationModule extends BaseModule implements Module {
7
7
  protected defaultName: string;
8
8
  protected defaultVersion: string;
@@ -13,8 +13,10 @@ export declare class QuotationModule extends BaseModule implements Module {
13
13
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
14
14
  loadQuotations(params?: {
15
15
  channel?: string;
16
+ customer_id?: number | string;
16
17
  }): Promise<void>;
17
18
  getQuotationList(): QuotationItem[];
19
+ getQuotationCustomerScopeInfo(): QuotationCustomerScopeInfo;
18
20
  /**
19
21
  * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
20
22
  * Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
@@ -27,11 +29,25 @@ export declare class QuotationModule extends BaseModule implements Module {
27
29
  productId: number;
28
30
  variantId?: number;
29
31
  datetime: string;
32
+ channel?: string;
33
+ customer_id?: number | string;
30
34
  }): string | null;
35
+ getQuotationMatchForProduct(params: {
36
+ productId: number;
37
+ variantId?: number;
38
+ datetime: string;
39
+ channel?: string;
40
+ customer_id?: number | string;
41
+ }): {
42
+ price: string | null;
43
+ quotationShelfId: number;
44
+ } | null;
31
45
  getQuotationShelfId(params: {
32
46
  productId: number;
33
47
  variantId?: number;
34
48
  datetime: string;
49
+ channel?: string;
50
+ customer_id?: number | string;
35
51
  }): number;
36
52
  /**
37
53
  * Batch pre-compute quotation prices for a set of products across multiple time points.
@@ -41,8 +57,12 @@ export declare class QuotationModule extends BaseModule implements Module {
41
57
  buildProductPriceMap(params: {
42
58
  productIds: number[];
43
59
  timePoints: string[];
60
+ customer_id?: number | string;
44
61
  }): Map<string, string | null>;
45
62
  setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
63
+ private isQuotationVisibleForCustomer;
64
+ private hasValidCustomerId;
65
+ private normalizeCustomerId;
46
66
  private isQuotationActiveAt;
47
67
  private findProductData;
48
68
  }
@@ -32,7 +32,8 @@ class QuotationModule extends _BaseModule.BaseModule {
32
32
  query.channel = 'online-store';
33
33
  }
34
34
  const res = await this.request.get('/quotation/available', query, {
35
- useCache: false
35
+ useCache: false,
36
+ osServer: true
36
37
  });
37
38
  const list = res?.data?.list || res?.list || [];
38
39
  list.sort((a, b) => b.sort - a.sort);
@@ -41,6 +42,38 @@ class QuotationModule extends _BaseModule.BaseModule {
41
42
  getQuotationList() {
42
43
  return this.store.list;
43
44
  }
45
+ getQuotationCustomerScopeInfo() {
46
+ const customerById = new Map();
47
+ const quotationScopes = this.store.list.filter(quotation => Array.isArray(quotation.customer) && quotation.customer.length > 0).map(quotation => {
48
+ const customerIds = [];
49
+ const customers = [];
50
+ const localSeen = new Set();
51
+ const quotationCustomers = quotation.customer || [];
52
+ quotationCustomers.forEach(customer => {
53
+ const customerId = this.normalizeCustomerId(customer?.id);
54
+ if (!customerId || localSeen.has(customerId)) return;
55
+ localSeen.add(customerId);
56
+ customerIds.push(customerId);
57
+ customers.push(customer);
58
+ if (!customerById.has(customerId)) customerById.set(customerId, customer);
59
+ });
60
+ return {
61
+ quotationId: quotation.id,
62
+ quotationName: quotation.name,
63
+ customerIds,
64
+ customers
65
+ };
66
+ });
67
+ const result = {
68
+ quotationCount: this.store.list.length,
69
+ hasCustomerScopedQuotations: quotationScopes.length > 0,
70
+ allQuotationsCustomerScoped: this.store.list.length > 0 && quotationScopes.length === this.store.list.length,
71
+ customerIds: Array.from(customerById.keys()),
72
+ customers: Array.from(customerById.values()),
73
+ quotationScopes
74
+ };
75
+ return result;
76
+ }
44
77
 
45
78
  /**
46
79
  * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
@@ -51,33 +84,32 @@ class QuotationModule extends _BaseModule.BaseModule {
51
84
  * the requested productId wins.
52
85
  */
53
86
  getPriceForProduct(params) {
87
+ return this.getQuotationMatchForProduct(params)?.price ?? null;
88
+ }
89
+ getQuotationMatchForProduct(params) {
54
90
  const {
55
91
  productId,
56
92
  variantId,
57
- datetime
93
+ datetime,
94
+ customer_id
58
95
  } = params;
59
96
  for (const quotation of this.store.list) {
60
- if (!this.isQuotationActiveAt(quotation, datetime)) continue;
97
+ const visible = this.isQuotationVisibleForCustomer(quotation, customer_id);
98
+ if (!visible) continue;
99
+ const active = this.isQuotationActiveAt(quotation, datetime);
100
+ if (!active) continue;
61
101
  const match = this.findProductData(quotation.product_data, productId, variantId);
62
102
  if (!match) continue;
63
103
  if (match.value === 0) continue;
64
- return String(match.value);
104
+ return {
105
+ price: String(match.value),
106
+ quotationShelfId: quotation.id
107
+ };
65
108
  }
66
109
  return null;
67
110
  }
68
111
  getQuotationShelfId(params) {
69
- const {
70
- productId,
71
- variantId,
72
- datetime
73
- } = params;
74
- for (const quotation of this.store.list) {
75
- if (!this.isQuotationActiveAt(quotation, datetime)) continue;
76
- const match = this.findProductData(quotation.product_data, productId, variantId);
77
- if (!match || match.value === 0) continue;
78
- return quotation.id;
79
- }
80
- return 0;
112
+ return this.getQuotationMatchForProduct(params)?.quotationShelfId ?? 0;
81
113
  }
82
114
 
83
115
  /**
@@ -93,7 +125,8 @@ class QuotationModule extends _BaseModule.BaseModule {
93
125
  const key = `${productId}:${timePoint}`;
94
126
  const price = this.getPriceForProduct({
95
127
  productId,
96
- datetime: timePoint
128
+ datetime: timePoint,
129
+ customer_id: params.customer_id
97
130
  });
98
131
  if (price !== null) {
99
132
  map.set(key, price);
@@ -105,18 +138,41 @@ class QuotationModule extends _BaseModule.BaseModule {
105
138
  setScheduleResolver(resolver) {
106
139
  this.scheduleResolver = resolver;
107
140
  }
141
+ isQuotationVisibleForCustomer(quotation, customerId) {
142
+ const customers = quotation.customer || [];
143
+ if (customers.length === 0) return true;
144
+ if (!this.hasValidCustomerId(customerId)) return false;
145
+ return customers.some(customer => String(customer.id) === String(customerId));
146
+ }
147
+ hasValidCustomerId(customerId) {
148
+ if (customerId === undefined || customerId === null || customerId === '') return false;
149
+ return Number(customerId) > 0;
150
+ }
151
+ normalizeCustomerId(customerId) {
152
+ if (customerId === undefined || customerId === null || customerId === '') return null;
153
+ return String(customerId);
154
+ }
108
155
  isQuotationActiveAt(quotation, datetime) {
109
156
  if (!quotation.schedule?.length) return false;
110
- const scheduleItems = quotation.schedule.map(s => {
157
+ const scheduleItems = [];
158
+ quotation.schedule.forEach(s => {
111
159
  const full = this.scheduleResolver?.(s.id);
112
- if (full) return full;
113
- return {
160
+ if (full) {
161
+ scheduleItems.push(full);
162
+ return;
163
+ }
164
+ if (this.scheduleResolver) {
165
+ return;
166
+ }
167
+ const fallbackSchedule = {
114
168
  ...s,
115
169
  repeat_type: s.repeat_type || 'none',
116
170
  repeat_rule: s.repeat_rule || null,
117
171
  time_slot: s.time_slot || []
118
172
  };
173
+ scheduleItems.push(fallbackSchedule);
119
174
  });
175
+ if (!scheduleItems.length) return false;
120
176
  return (0, _getDateIsInSchedule.getDateIsInSchedule)(datetime, scheduleItems);
121
177
  }
122
178
  findProductData(productData, productId, variantId) {
@@ -22,6 +22,10 @@ export interface QuotationSchedule {
22
22
  }>;
23
23
  pivot?: Record<string, any>;
24
24
  }
25
+ export interface QuotationCustomer {
26
+ id: number | string;
27
+ [key: string]: any;
28
+ }
25
29
  export interface QuotationItem {
26
30
  id: number;
27
31
  shop_id: number;
@@ -34,9 +38,24 @@ export interface QuotationItem {
34
38
  created_at?: string;
35
39
  updated_at?: string;
36
40
  deleted_at?: string | null;
41
+ customer?: QuotationCustomer[];
37
42
  schedule: QuotationSchedule[];
38
43
  product_data: QuotationProductData[];
39
44
  }
40
45
  export interface QuotationState {
41
46
  list: QuotationItem[];
42
47
  }
48
+ export interface QuotationCustomerScope {
49
+ quotationId: number;
50
+ quotationName: string;
51
+ customerIds: string[];
52
+ customers: QuotationCustomer[];
53
+ }
54
+ export interface QuotationCustomerScopeInfo {
55
+ quotationCount: number;
56
+ hasCustomerScopedQuotations: boolean;
57
+ allQuotationsCustomerScoped: boolean;
58
+ customerIds: string[];
59
+ customers: QuotationCustomer[];
60
+ quotationScopes: QuotationCustomerScope[];
61
+ }
@@ -0,0 +1,24 @@
1
+ import { BaseModule } from '../BaseModule';
2
+ import type { Module, ModuleOptions, PisellCore } from '../../types';
3
+ import type { ResourcePlannerAssignmentResult, ResourcePlannerAssignableSlotResult, ResourcePlannerContextInput, ResourcePlannerProjection, ResourcePlannerQuery, ResourcePlannerSelectionPatch, ResourcePlannerSnapshot, ResourcePlannerValidationResult } from './types';
4
+ export * from './types';
5
+ export * from './planner';
6
+ export declare enum ResourcePlannerHooks {
7
+ onContextChanged = "resourcePlanner:onContextChanged",
8
+ onSelectionChanged = "resourcePlanner:onSelectionChanged",
9
+ onProjectionChanged = "resourcePlanner:onProjectionChanged"
10
+ }
11
+ export declare class ResourcePlannerModule extends BaseModule implements Module {
12
+ protected defaultName: string;
13
+ protected defaultVersion: string;
14
+ private store;
15
+ initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
16
+ setContext(input: ResourcePlannerContextInput): ResourcePlannerSnapshot;
17
+ mergeContext(input: ResourcePlannerContextInput): ResourcePlannerSnapshot;
18
+ setSelectionPatch(patch: ResourcePlannerSelectionPatch): ResourcePlannerSnapshot;
19
+ queryAvailability(query?: ResourcePlannerQuery): ResourcePlannerProjection;
20
+ autoAssign(query?: ResourcePlannerQuery): ResourcePlannerAssignmentResult;
21
+ resolveAssignableSlots(query?: ResourcePlannerQuery): ResourcePlannerAssignableSlotResult;
22
+ validateSelection(): ResourcePlannerValidationResult;
23
+ getSnapshot(): ResourcePlannerSnapshot;
24
+ }
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ ResourcePlannerHooks: true,
8
+ ResourcePlannerModule: true
9
+ };
10
+ exports.ResourcePlannerModule = exports.ResourcePlannerHooks = void 0;
11
+ var _BaseModule = require("../BaseModule");
12
+ var _planner = require("./planner");
13
+ Object.keys(_planner).forEach(function (key) {
14
+ if (key === "default" || key === "__esModule") return;
15
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
16
+ if (key in exports && exports[key] === _planner[key]) return;
17
+ Object.defineProperty(exports, key, {
18
+ enumerable: true,
19
+ get: function () {
20
+ return _planner[key];
21
+ }
22
+ });
23
+ });
24
+ var _types = require("./types");
25
+ Object.keys(_types).forEach(function (key) {
26
+ if (key === "default" || key === "__esModule") return;
27
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
28
+ if (key in exports && exports[key] === _types[key]) return;
29
+ Object.defineProperty(exports, key, {
30
+ enumerable: true,
31
+ get: function () {
32
+ return _types[key];
33
+ }
34
+ });
35
+ });
36
+ let ResourcePlannerHooks = exports.ResourcePlannerHooks = /*#__PURE__*/function (ResourcePlannerHooks) {
37
+ ResourcePlannerHooks["onContextChanged"] = "resourcePlanner:onContextChanged";
38
+ ResourcePlannerHooks["onSelectionChanged"] = "resourcePlanner:onSelectionChanged";
39
+ ResourcePlannerHooks["onProjectionChanged"] = "resourcePlanner:onProjectionChanged";
40
+ return ResourcePlannerHooks;
41
+ }({});
42
+ class ResourcePlannerModule extends _BaseModule.BaseModule {
43
+ defaultName = 'resourcePlanner';
44
+ defaultVersion = '1.0.0';
45
+ store;
46
+ async initialize(core, options) {
47
+ this.core = core;
48
+ const initialState = options.initialState;
49
+ this.store = {
50
+ context: (0, _planner.normalizePlannerContext)(initialState?.context || _planner.DEFAULT_RESOURCE_PLANNER_CONTEXT),
51
+ selection: initialState?.selection || {
52
+ ..._planner.DEFAULT_RESOURCE_PLANNER_SELECTION
53
+ },
54
+ projection: initialState?.projection || null,
55
+ version: initialState?.version || 0
56
+ };
57
+ }
58
+ setContext(input) {
59
+ this.store.context = (0, _planner.normalizePlannerContext)(input);
60
+ this.store.version += 1;
61
+ this.store.projection = null;
62
+ const snapshot = this.getSnapshot();
63
+ void this.core.effects.emit(`${this.name}:contextChanged`, snapshot);
64
+ return snapshot;
65
+ }
66
+ mergeContext(input) {
67
+ return this.setContext({
68
+ ...this.store.context,
69
+ ...input,
70
+ products: input.products || this.store.context.products,
71
+ resources: input.resources || this.store.context.resources,
72
+ externalEvents: input.externalEvents || this.store.context.externalEvents
73
+ });
74
+ }
75
+ setSelectionPatch(patch) {
76
+ const assignments = patch.assignments ? patch.replaceAssignments === false ? [...this.store.selection.assignments, ...patch.assignments] : patch.assignments : this.store.selection.assignments;
77
+ this.store.selection = {
78
+ ...this.store.selection,
79
+ ...patch,
80
+ productIds: patch.productIds || this.store.selection.productIds,
81
+ resourceIds: patch.resourceIds || this.store.selection.resourceIds,
82
+ assignments
83
+ };
84
+ this.store.version += 1;
85
+ const snapshot = this.getSnapshot();
86
+ void this.core.effects.emit(`${this.name}:selectionChanged`, snapshot);
87
+ return snapshot;
88
+ }
89
+ queryAvailability(query = {}) {
90
+ const mergedQuery = {
91
+ mode: this.store.selection.mode,
92
+ productIds: this.store.selection.productIds,
93
+ date: this.store.selection.date,
94
+ startTime: this.store.selection.startTime,
95
+ endTime: this.store.selection.endTime,
96
+ resourceIds: this.store.selection.resourceIds,
97
+ ...query
98
+ };
99
+ const projection = (0, _planner.queryPlannerAvailability)(this.store.context, mergedQuery);
100
+ this.store.projection = projection;
101
+ this.store.version += 1;
102
+ void this.core.effects.emit(`${this.name}:projectionChanged`, this.getSnapshot());
103
+ return projection;
104
+ }
105
+ autoAssign(query = {}) {
106
+ const result = (0, _planner.autoAssignResources)(this.store.context, {
107
+ mode: this.store.selection.mode,
108
+ productIds: this.store.selection.productIds,
109
+ date: this.store.selection.date,
110
+ startTime: this.store.selection.startTime,
111
+ endTime: this.store.selection.endTime,
112
+ resourceIds: this.store.selection.resourceIds,
113
+ ...query
114
+ });
115
+ const resourceIds = Array.from(new Map(result.assignments.map(assignment => [String(assignment.resourceId), assignment.resourceId])).values());
116
+ this.setSelectionPatch({
117
+ assignments: result.assignments,
118
+ ...(resourceIds.length ? {
119
+ resourceIds
120
+ } : {})
121
+ });
122
+ return result;
123
+ }
124
+ resolveAssignableSlots(query = {}) {
125
+ return (0, _planner.resolveAssignableSlots)(this.store.context, {
126
+ mode: this.store.selection.mode,
127
+ productIds: this.store.selection.productIds,
128
+ date: this.store.selection.date,
129
+ startTime: this.store.selection.startTime,
130
+ endTime: this.store.selection.endTime,
131
+ resourceIds: this.store.selection.resourceIds,
132
+ ...query
133
+ });
134
+ }
135
+ validateSelection() {
136
+ return (0, _planner.validateAssignments)(this.store.context, this.store.selection);
137
+ }
138
+ getSnapshot() {
139
+ return {
140
+ context: this.store.context,
141
+ selection: this.store.selection,
142
+ projection: this.store.projection,
143
+ version: this.store.version
144
+ };
145
+ }
146
+ }
147
+ exports.ResourcePlannerModule = ResourcePlannerModule;
@@ -0,0 +1,14 @@
1
+ import type { ResourcePlannerAssignmentResult, ResourcePlannerAssignableSlotResult, ResourcePlannerAvailabilityCell, ResourcePlannerContextInput, ResourcePlannerDemandInterval, ResourcePlannerProduct, ResourcePlannerProjection, ResourcePlannerQuery, ResourcePlannerResource, ResourcePlannerSelection, ResourcePlannerValidationResult } from './types';
2
+ export declare const DEFAULT_RESOURCE_PLANNER_CONTEXT: Required<ResourcePlannerContextInput>;
3
+ export declare const DEFAULT_RESOURCE_PLANNER_SELECTION: ResourcePlannerSelection;
4
+ export declare function normalizePlannerContext(input?: ResourcePlannerContextInput): Required<ResourcePlannerContextInput>;
5
+ export declare function buildDemandIntervals(products: ResourcePlannerProduct[], query: ResourcePlannerQuery, context?: Required<ResourcePlannerContextInput>): ResourcePlannerDemandInterval[];
6
+ export declare function evaluateResourceForInterval(params: {
7
+ resource: ResourcePlannerResource;
8
+ interval: ResourcePlannerDemandInterval;
9
+ context: Required<ResourcePlannerContextInput>;
10
+ }): ResourcePlannerAvailabilityCell;
11
+ export declare function queryPlannerAvailability(contextInput: ResourcePlannerContextInput, query?: ResourcePlannerQuery): ResourcePlannerProjection;
12
+ export declare function resolveAssignableSlots(contextInput: ResourcePlannerContextInput, query?: ResourcePlannerQuery): ResourcePlannerAssignableSlotResult;
13
+ export declare function autoAssignResources(contextInput: ResourcePlannerContextInput, query?: ResourcePlannerQuery): ResourcePlannerAssignmentResult;
14
+ export declare function validateAssignments(contextInput: ResourcePlannerContextInput, selection: ResourcePlannerSelection): ResourcePlannerValidationResult;