@pisell/pisellos 0.0.568 → 0.0.569

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 (413) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
  2. package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
  3. package/dist/modules/BaseModule.d.ts +2 -2
  4. package/dist/modules/BaseModule.js +4 -4
  5. package/dist/modules/BookingContext/index.d.ts +48 -0
  6. package/dist/modules/BookingContext/index.js +566 -0
  7. package/dist/modules/BookingContext/types.d.ts +102 -0
  8. package/dist/modules/BookingContext/types.js +51 -0
  9. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  10. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
  11. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  12. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
  13. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  14. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
  15. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  16. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  17. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  18. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  19. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  20. package/dist/modules/BookingContext/utils/index.js +11 -0
  21. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  22. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  23. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  24. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  25. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  26. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  27. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  28. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  29. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  30. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  31. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  32. package/dist/modules/BookingContext/utils/resources.js +486 -0
  33. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  34. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  35. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  36. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  37. package/dist/modules/Cart/utils/cartProduct.js +26 -5
  38. package/dist/modules/Cart/utils/changePrice.js +27 -20
  39. package/dist/modules/Customer/index.d.ts +20 -0
  40. package/dist/modules/Customer/index.js +172 -83
  41. package/dist/modules/Customer/types.d.ts +2 -0
  42. package/dist/modules/Discount/index.d.ts +2 -1
  43. package/dist/modules/Discount/index.js +37 -9
  44. package/dist/modules/Discount/types.d.ts +1 -0
  45. package/dist/modules/OpenData/index.d.ts +8 -0
  46. package/dist/modules/OpenData/index.js +36 -16
  47. package/dist/modules/Order/index.d.ts +448 -23
  48. package/dist/modules/Order/index.js +5417 -561
  49. package/dist/modules/Order/types.d.ts +693 -88
  50. package/dist/modules/Order/types.js +68 -1
  51. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  52. package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
  53. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  54. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  55. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  56. package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
  57. package/dist/modules/Order/utils.d.ts +167 -18
  58. package/dist/modules/Order/utils.js +960 -165
  59. package/dist/modules/Payment/index.d.ts +10 -9
  60. package/dist/modules/Payment/index.js +465 -703
  61. package/dist/modules/Payment/types.d.ts +40 -16
  62. package/dist/modules/Payment/utils.d.ts +1 -1
  63. package/dist/modules/Payment/utils.js +4 -3
  64. package/dist/modules/Payment/walletpass.js +44 -29
  65. package/dist/modules/Product/types.d.ts +29 -7
  66. package/dist/modules/ProductList/index.d.ts +17 -13
  67. package/dist/modules/ProductList/index.js +184 -74
  68. package/dist/modules/ProductList/types.d.ts +17 -0
  69. package/dist/modules/Quotation/index.d.ts +22 -2
  70. package/dist/modules/Quotation/index.js +108 -42
  71. package/dist/modules/Quotation/types.d.ts +19 -0
  72. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  73. package/dist/modules/ResourcePlanner/index.js +181 -0
  74. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  75. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  76. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  77. package/dist/modules/ResourcePlanner/types.js +1 -0
  78. package/dist/modules/Rules/index.d.ts +8 -10
  79. package/dist/modules/Rules/index.js +221 -109
  80. package/dist/modules/Rules/types.d.ts +14 -3
  81. package/dist/modules/SalesSummary/index.d.ts +23 -26
  82. package/dist/modules/SalesSummary/index.js +152 -46
  83. package/dist/modules/SalesSummary/types.d.ts +9 -1
  84. package/dist/modules/SalesSummary/utils.d.ts +3 -22
  85. package/dist/modules/SalesSummary/utils.js +803 -163
  86. package/dist/modules/Schedule/getDateIsInSchedule.js +14 -7
  87. package/dist/modules/Schedule/index.d.ts +18 -5
  88. package/dist/modules/Schedule/index.js +78 -24
  89. package/dist/modules/Schedule/types.d.ts +2 -0
  90. package/dist/modules/Summary/index.js +4 -3
  91. package/dist/modules/SurchargeList/index.d.ts +18 -0
  92. package/dist/modules/SurchargeList/index.js +185 -0
  93. package/dist/modules/SurchargeList/types.d.ts +15 -0
  94. package/dist/modules/SurchargeList/types.js +1 -0
  95. package/dist/modules/index.d.ts +3 -0
  96. package/dist/modules/index.js +4 -1
  97. package/dist/plugins/app.d.ts +2 -0
  98. package/dist/plugins/request.d.ts +1 -0
  99. package/dist/server/index.d.ts +462 -8
  100. package/dist/server/index.js +6112 -656
  101. package/dist/server/modules/floor-plan/index.d.ts +39 -0
  102. package/dist/server/modules/floor-plan/index.js +595 -0
  103. package/dist/server/modules/floor-plan/types.d.ts +43 -0
  104. package/dist/server/modules/floor-plan/types.js +13 -0
  105. package/dist/server/modules/index.d.ts +7 -2
  106. package/dist/server/modules/index.js +6 -0
  107. package/dist/server/modules/order/index.d.ts +207 -14
  108. package/dist/server/modules/order/index.js +2326 -379
  109. package/dist/server/modules/order/types.d.ts +76 -5
  110. package/dist/server/modules/order/types.js +14 -1
  111. package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
  112. package/dist/server/modules/order/utils/filterBookings.js +118 -11
  113. package/dist/server/modules/order/utils/filterOrders.js +242 -14
  114. package/dist/server/modules/payment/index.d.ts +28 -0
  115. package/dist/server/modules/payment/index.js +305 -0
  116. package/dist/server/modules/payment/types.d.ts +9 -0
  117. package/dist/server/modules/payment/types.js +1 -0
  118. package/dist/server/modules/products/index.d.ts +105 -14
  119. package/dist/server/modules/products/index.js +1393 -516
  120. package/dist/server/modules/products/types.d.ts +34 -1
  121. package/dist/server/modules/products/types.js +4 -0
  122. package/dist/server/modules/quotation/index.d.ts +39 -0
  123. package/dist/server/modules/quotation/index.js +278 -66
  124. package/dist/server/modules/resource/index.d.ts +2 -3
  125. package/dist/server/modules/resource/index.js +108 -86
  126. package/dist/server/modules/schedule/index.d.ts +6 -4
  127. package/dist/server/modules/schedule/index.js +116 -85
  128. package/dist/server/test.json +713 -0
  129. package/dist/server/types.d.ts +2 -0
  130. package/dist/server/utils/product.js +2 -2
  131. package/dist/server/utils/small-ticket.d.ts +71 -0
  132. package/dist/server/utils/small-ticket.js +963 -0
  133. package/dist/solution/BaseSales/index.d.ts +378 -0
  134. package/dist/solution/BaseSales/index.js +4006 -0
  135. package/dist/solution/BaseSales/types.d.ts +394 -0
  136. package/dist/solution/BaseSales/types.js +40 -0
  137. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  138. package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
  139. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
  140. package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
  141. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
  142. package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
  143. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
  144. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
  145. package/dist/solution/BaseSales/utils.d.ts +40 -0
  146. package/dist/solution/BaseSales/utils.js +263 -0
  147. package/dist/solution/BookingByStep/index.d.ts +1 -1
  148. package/dist/solution/BookingTicket/index.d.ts +394 -25
  149. package/dist/solution/BookingTicket/index.js +2506 -443
  150. package/dist/solution/BookingTicket/types.d.ts +191 -6
  151. package/dist/solution/BookingTicket/types.js +83 -10
  152. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  153. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  154. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  155. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  156. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  157. package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
  158. package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
  159. package/dist/solution/BookingTicket/utils/cartView.js +209 -0
  160. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  161. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  162. package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  163. package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
  164. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  165. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  166. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  167. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  168. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
  169. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +41 -1
  170. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  171. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  172. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  173. package/dist/solution/BookingTicket/utils/scan/handleScan.js +11 -3
  174. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  175. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  176. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  177. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  178. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  179. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  180. package/dist/solution/Checkout/index.d.ts +1 -0
  181. package/dist/solution/Checkout/index.js +25 -34
  182. package/dist/solution/Checkout/utils/index.js +4 -4
  183. package/dist/solution/RegisterAndLogin/config.js +2 -10
  184. package/dist/solution/Sales/index.d.ts +50 -5
  185. package/dist/solution/Sales/index.js +484 -92
  186. package/dist/solution/Sales/types.d.ts +26 -2
  187. package/dist/solution/ScanOrder/index.d.ts +27 -21
  188. package/dist/solution/ScanOrder/index.js +499 -434
  189. package/dist/solution/ScanOrder/types.d.ts +33 -11
  190. package/dist/solution/ScanOrder/types.js +4 -5
  191. package/dist/solution/ScanOrder/utils.d.ts +4 -1
  192. package/dist/solution/ScanOrder/utils.js +109 -34
  193. package/dist/solution/ShopDiscount/index.js +4 -4
  194. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  195. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  196. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  197. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  198. package/dist/solution/VenueBooking/index.d.ts +29 -20
  199. package/dist/solution/VenueBooking/index.js +301 -213
  200. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  201. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  202. package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
  203. package/dist/solution/index.d.ts +2 -0
  204. package/dist/solution/index.js +3 -1
  205. package/dist/types/index.d.ts +11 -1
  206. package/lib/model/strategy/adapter/promotion/evaluator.js +3 -2
  207. package/lib/model/strategy/adapter/walletPass/utils.js +6 -4
  208. package/lib/modules/BaseModule.d.ts +2 -2
  209. package/lib/modules/BaseModule.js +4 -4
  210. package/lib/modules/BookingContext/index.d.ts +48 -0
  211. package/lib/modules/BookingContext/index.js +390 -0
  212. package/lib/modules/BookingContext/types.d.ts +102 -0
  213. package/lib/modules/BookingContext/types.js +48 -0
  214. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  215. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +286 -0
  216. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  217. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
  218. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  219. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +242 -0
  220. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  221. package/lib/modules/BookingContext/utils/flexible.js +63 -0
  222. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  223. package/lib/modules/BookingContext/utils/formatResourceList.js +35 -0
  224. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  225. package/lib/modules/BookingContext/utils/index.js +126 -0
  226. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  227. package/lib/modules/BookingContext/utils/noResource.js +78 -0
  228. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  229. package/lib/modules/BookingContext/utils/orderLineDisplay.js +29 -0
  230. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  231. package/lib/modules/BookingContext/utils/productExtend.js +330 -0
  232. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  233. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  234. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  235. package/lib/modules/BookingContext/utils/resourceSelection.js +24 -0
  236. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  237. package/lib/modules/BookingContext/utils/resources.js +419 -0
  238. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  239. package/lib/modules/BookingContext/utils/serviceTimes.js +161 -0
  240. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  241. package/lib/modules/BookingContext/utils/timeSlices.js +114 -0
  242. package/lib/modules/Cart/utils/cartProduct.js +27 -5
  243. package/lib/modules/Cart/utils/changePrice.js +20 -14
  244. package/lib/modules/Customer/index.d.ts +20 -0
  245. package/lib/modules/Customer/index.js +63 -10
  246. package/lib/modules/Customer/types.d.ts +2 -0
  247. package/lib/modules/Discount/index.d.ts +2 -1
  248. package/lib/modules/Discount/index.js +18 -2
  249. package/lib/modules/Discount/types.d.ts +1 -0
  250. package/lib/modules/OpenData/index.d.ts +8 -0
  251. package/lib/modules/OpenData/index.js +21 -3
  252. package/lib/modules/Order/index.d.ts +448 -23
  253. package/lib/modules/Order/index.js +3641 -308
  254. package/lib/modules/Order/types.d.ts +693 -88
  255. package/lib/modules/Order/types.js +55 -1
  256. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  257. package/lib/modules/Order/utils/bundleDiscountHydration.js +106 -0
  258. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  259. package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
  260. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  261. package/lib/modules/Order/utils/orderCollectionIdentity.js +353 -0
  262. package/lib/modules/Order/utils.d.ts +167 -18
  263. package/lib/modules/Order/utils.js +974 -138
  264. package/lib/modules/Payment/index.d.ts +10 -9
  265. package/lib/modules/Payment/index.js +30 -124
  266. package/lib/modules/Payment/types.d.ts +40 -16
  267. package/lib/modules/Payment/utils.d.ts +1 -1
  268. package/lib/modules/Payment/utils.js +4 -3
  269. package/lib/modules/Payment/walletpass.js +16 -6
  270. package/lib/modules/Product/types.d.ts +29 -7
  271. package/lib/modules/ProductList/index.d.ts +17 -13
  272. package/lib/modules/ProductList/index.js +92 -51
  273. package/lib/modules/ProductList/types.d.ts +17 -0
  274. package/lib/modules/Quotation/index.d.ts +22 -2
  275. package/lib/modules/Quotation/index.js +76 -20
  276. package/lib/modules/Quotation/types.d.ts +19 -0
  277. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  278. package/lib/modules/ResourcePlanner/index.js +147 -0
  279. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  280. package/lib/modules/ResourcePlanner/planner.js +895 -0
  281. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  282. package/lib/modules/ResourcePlanner/types.js +5 -0
  283. package/lib/modules/Rules/index.d.ts +8 -10
  284. package/lib/modules/Rules/index.js +152 -60
  285. package/lib/modules/Rules/types.d.ts +14 -3
  286. package/lib/modules/SalesSummary/index.d.ts +23 -26
  287. package/lib/modules/SalesSummary/index.js +84 -16
  288. package/lib/modules/SalesSummary/types.d.ts +9 -1
  289. package/lib/modules/SalesSummary/utils.d.ts +3 -22
  290. package/lib/modules/SalesSummary/utils.js +616 -111
  291. package/lib/modules/Schedule/getDateIsInSchedule.js +14 -7
  292. package/lib/modules/Schedule/index.d.ts +18 -5
  293. package/lib/modules/Schedule/index.js +49 -14
  294. package/lib/modules/Schedule/types.d.ts +2 -0
  295. package/lib/modules/Summary/index.js +2 -2
  296. package/lib/modules/SurchargeList/index.d.ts +18 -0
  297. package/lib/modules/SurchargeList/index.js +95 -0
  298. package/lib/modules/SurchargeList/types.d.ts +15 -0
  299. package/lib/modules/SurchargeList/types.js +5 -0
  300. package/lib/modules/index.d.ts +3 -0
  301. package/lib/modules/index.js +33 -0
  302. package/lib/plugins/app.d.ts +2 -0
  303. package/lib/plugins/request.d.ts +1 -0
  304. package/lib/server/index.d.ts +462 -8
  305. package/lib/server/index.js +3901 -205
  306. package/lib/server/modules/floor-plan/index.d.ts +39 -0
  307. package/lib/server/modules/floor-plan/index.js +306 -0
  308. package/lib/server/modules/floor-plan/types.d.ts +43 -0
  309. package/lib/server/modules/floor-plan/types.js +19 -0
  310. package/lib/server/modules/index.d.ts +7 -2
  311. package/lib/server/modules/index.js +21 -0
  312. package/lib/server/modules/order/index.d.ts +207 -14
  313. package/lib/server/modules/order/index.js +1324 -141
  314. package/lib/server/modules/order/types.d.ts +76 -5
  315. package/lib/server/modules/order/types.js +11 -1
  316. package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
  317. package/lib/server/modules/order/utils/filterBookings.js +119 -11
  318. package/lib/server/modules/order/utils/filterOrders.js +238 -13
  319. package/lib/server/modules/payment/index.d.ts +28 -0
  320. package/lib/server/modules/payment/index.js +168 -0
  321. package/lib/server/modules/payment/types.d.ts +9 -0
  322. package/lib/server/modules/payment/types.js +5 -0
  323. package/lib/server/modules/products/index.d.ts +105 -14
  324. package/lib/server/modules/products/index.js +588 -97
  325. package/lib/server/modules/products/types.d.ts +34 -1
  326. package/lib/server/modules/products/types.js +3 -0
  327. package/lib/server/modules/quotation/index.d.ts +39 -0
  328. package/lib/server/modules/quotation/index.js +145 -1
  329. package/lib/server/modules/resource/index.d.ts +2 -3
  330. package/lib/server/modules/resource/index.js +71 -45
  331. package/lib/server/modules/schedule/index.d.ts +6 -4
  332. package/lib/server/modules/schedule/index.js +55 -44
  333. package/lib/server/test.json +713 -0
  334. package/lib/server/types.d.ts +2 -0
  335. package/lib/server/utils/product.js +2 -2
  336. package/lib/server/utils/small-ticket.d.ts +71 -0
  337. package/lib/server/utils/small-ticket.js +926 -0
  338. package/lib/solution/BaseSales/index.d.ts +378 -0
  339. package/lib/solution/BaseSales/index.js +2367 -0
  340. package/lib/solution/BaseSales/types.d.ts +394 -0
  341. package/lib/solution/BaseSales/types.js +47 -0
  342. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  343. package/lib/solution/BaseSales/utils/cartPromotion.js +1155 -0
  344. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
  345. package/lib/solution/BaseSales/utils/parseSalesResponse.js +140 -0
  346. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
  347. package/lib/solution/BaseSales/utils/quotationPrice.js +231 -0
  348. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
  349. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +215 -0
  350. package/lib/solution/BaseSales/utils.d.ts +40 -0
  351. package/lib/solution/BaseSales/utils.js +259 -0
  352. package/lib/solution/BookingByStep/index.d.ts +1 -1
  353. package/lib/solution/BookingTicket/index.d.ts +394 -25
  354. package/lib/solution/BookingTicket/index.js +1350 -76
  355. package/lib/solution/BookingTicket/types.d.ts +191 -6
  356. package/lib/solution/BookingTicket/types.js +71 -10
  357. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  358. package/lib/solution/BookingTicket/utils/addProductDecision.js +353 -0
  359. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  360. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +94 -0
  361. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  362. package/lib/solution/BookingTicket/utils/bookingStatus.js +136 -0
  363. package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
  364. package/lib/solution/BookingTicket/utils/cartView.js +200 -0
  365. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  366. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  367. package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  368. package/lib/solution/BookingTicket/utils/orderCustomer.js +35 -0
  369. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  370. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +387 -0
  371. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  372. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +220 -0
  373. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
  374. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +24 -3
  375. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  376. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +64 -0
  377. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  378. package/lib/solution/BookingTicket/utils/scan/handleScan.js +4 -2
  379. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  380. package/lib/solution/BookingTicket/utils/scan/index.js +14 -2
  381. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  382. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +115 -0
  383. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  384. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +83 -0
  385. package/lib/solution/Checkout/index.d.ts +1 -0
  386. package/lib/solution/Checkout/index.js +18 -19
  387. package/lib/solution/Checkout/utils/index.js +4 -4
  388. package/lib/solution/RegisterAndLogin/config.js +2 -10
  389. package/lib/solution/Sales/index.d.ts +50 -5
  390. package/lib/solution/Sales/index.js +296 -39
  391. package/lib/solution/Sales/types.d.ts +26 -2
  392. package/lib/solution/ScanOrder/index.d.ts +27 -21
  393. package/lib/solution/ScanOrder/index.js +144 -103
  394. package/lib/solution/ScanOrder/types.d.ts +33 -11
  395. package/lib/solution/ScanOrder/types.js +4 -5
  396. package/lib/solution/ScanOrder/utils.d.ts +4 -1
  397. package/lib/solution/ScanOrder/utils.js +98 -26
  398. package/lib/solution/ShopDiscount/index.js +3 -3
  399. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  400. package/lib/solution/UnifiedBookingSales/index.js +1050 -0
  401. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  402. package/lib/solution/UnifiedBookingSales/types.js +14 -0
  403. package/lib/solution/VenueBooking/index.d.ts +29 -20
  404. package/lib/solution/VenueBooking/index.js +169 -94
  405. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  406. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  407. package/lib/solution/VenueBooking/utils/slotMerge.js +9 -3
  408. package/lib/solution/index.d.ts +2 -0
  409. package/lib/solution/index.js +22 -0
  410. package/lib/types/index.d.ts +11 -1
  411. package/package.json +1 -1
  412. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  413. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -1,73 +1,208 @@
1
1
  import { CartItem } from '../Cart/types';
2
- import type { ScanOrderTempOrder, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderSummary } from '../../solution/ScanOrder/types';
3
2
  import type { DiscountModule } from '../Discount';
4
3
  import type { RulesModule } from '../Rules';
5
4
  import type { Discount } from '../Discount/types';
5
+ import type { UnavailableReason } from '../Rules/types';
6
6
  import type { SubmitPayloadEnhancer } from './utils';
7
+ import type { PaymentItem } from '../Payment/types';
8
+ import type { ICustomer } from '../AccountList/types';
9
+ import type { OrderProductDiscountItem } from '../../server/modules/order/types';
10
+ export type { OrderProductDiscountItem } from '../../server/modules/order/types';
7
11
  export declare enum OrderHooks {
8
12
  OnOrderCreate = "order:onOrderCreate",
9
13
  OnOrderUpdate = "order:onOrderUpdate",
10
14
  OnOrderCancel = "order:onOrderCancel",
11
- OnOrderStatusChange = "order:onOrderStatusChange"
15
+ OnOrderStatusChange = "order:onOrderStatusChange",
16
+ OnOrderCustomerChange = "order:onOrderCustomerChange",
17
+ OnPromotionApplied = "order:onPromotionApplied"
12
18
  }
13
- export interface OrderState {
14
- tempOrder: ScanOrderTempOrder | null;
15
- discountList: any[];
16
- discount: DiscountModule | null;
17
- rules: RulesModule | null;
18
- availableWalletIds?: number[];
19
+ /**
20
+ * 促销评估器协议(OS 与 PromotionEvaluator 之间的桥接接口)。
21
+ *
22
+ * 与 `pisell_os/src/model/strategy/adapter/promotion/evaluator.ts` 中的
23
+ * `PromotionEvaluator` 实例结构保持兼容。SalesSdkProvider 会从 `appHelper.utils.promotionEvaluator`
24
+ * 读取实例并通过 `setPromotionEvaluator` 注入到 OrderModule。
25
+ *
26
+ * 这里只声明 OrderModule 需要调用的子集,避免反向依赖具体 evaluator 实现。
27
+ */
28
+ export interface OrderPromotionEvaluator {
29
+ evaluateCartWithPricing(input: {
30
+ products: any[];
31
+ channel?: string;
32
+ }): any;
33
+ getProductsApplicableStrategies(input: {
34
+ products: any[];
35
+ channel?: string;
36
+ }, matchVariant?: boolean): any[];
37
+ getStrategyConfigs?: () => unknown[];
19
38
  }
20
- /** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 identity_key / 选项指纹等 */
21
- export interface UpdateProductInOrderParams {
22
- product_id: number | null;
23
- product_variant_id: number;
24
- updates: Partial<ScanOrderOrderProduct>;
25
- identity_key?: string;
26
- product_option_item?: any[];
27
- product_bundle?: any[];
39
+ /** 赠品解析回调 context(OS → SDK 的请求体) */
40
+ export interface OrderGiftSelectContext {
41
+ strategyId: string;
42
+ strategyName: string | Record<string, string>;
43
+ giftCount: number;
44
+ giftOptions: Array<{
45
+ product_id: number;
46
+ product_variant_id: number;
47
+ }>;
48
+ /** 触发此赠品的主商品 metadata.unique_identification_number 列表 */
49
+ sourceProductIds: string[];
28
50
  }
29
51
  /**
30
- * 订单信息
52
+ * 赠品 resolver 返回值。
53
+ *
54
+ * @example
55
+ * return { products: [giftProduct], bookings: [giftBooking] };
31
56
  */
32
- export interface CommitOrderParams {
33
- url?: string;
34
- query: {
35
- cartItems: CartItem[];
36
- type: 'virtual' | 'appointment_booking';
37
- platform?: 'pc' | 'h5';
38
- extraData?: Record<string, any>;
39
- business_code?: string;
57
+ export interface OrderGiftSelectResult {
58
+ /** 完整赠品购物车行,必须带 metadata._giftInfo。 */
59
+ products: Partial<OrderProduct>[];
60
+ /** 预约赠品对应的 booking,按 products 下标一一关联。 */
61
+ bookings?: AddProductBookingInput[];
62
+ }
63
+ /**
64
+ * 赠品解析回调签名(SDK → OS 的返回值)。
65
+ *
66
+ * - 单选项:SDK 内部自动构造商品,不弹窗
67
+ * - 多选项:SDK 弹窗等用户确认后构造
68
+ * - 用户取消:抛错或返回空数组(OS 视为放弃本次添加)
69
+ *
70
+ * 返回数组时沿用旧协议,只写 tempOrder.products;返回对象时可同时写入预约 bookings。
71
+ */
72
+ export type OrderGiftSelectResolver = (ctx: OrderGiftSelectContext) => Promise<Partial<OrderProduct>[] | OrderGiftSelectResult | null>;
73
+ /** 未满足的促销策略(购物车底部 alert 渲染源) */
74
+ export interface OrderUnfulfilledPromotion {
75
+ strategyId: string;
76
+ strategyName: string | Record<string, string>;
77
+ actionType: string;
78
+ needQuantity: number;
79
+ currentQuantity: number;
80
+ requiredQuantity: number;
81
+ eligibleProducts: Array<{
82
+ product_id: number;
83
+ product_variant_id: number;
84
+ }>;
85
+ strategyMetadata?: any;
86
+ display?: {
87
+ text: string | Record<string, string>;
88
+ type: string;
40
89
  };
41
90
  }
42
- export interface SubmitScanOrderProduct {
43
- order_detail_id: number | null;
91
+ /** 上一次 applyPromotion 计算出的赠品操作(仅供调试/读取使用) */
92
+ export interface OrderLastGiftActions {
93
+ toAdd: Array<{
94
+ strategyId: string;
95
+ strategyName: string | Record<string, string>;
96
+ giftCount: number;
97
+ giftOptions: Array<{
98
+ product_id: number;
99
+ product_variant_id: number;
100
+ }>;
101
+ sourceProductIds: string[];
102
+ }>;
103
+ toReduce: Array<{
104
+ strategyId: string;
105
+ items: Array<{
106
+ uid: string;
107
+ currentQuantity: number;
108
+ newQuantity: number;
109
+ }>;
110
+ }>;
111
+ toRemove: string[];
112
+ }
113
+ /** onPromotionApplied 事件 payload */
114
+ export interface OrderPromotionAppliedPayload {
115
+ unfulfilledPromotions: OrderUnfulfilledPromotion[];
116
+ giftActions: OrderLastGiftActions;
117
+ /** evaluator 返回的赠品摘要 */
118
+ gifts: Array<{
119
+ strategyId: string;
120
+ strategyName: string | Record<string, string>;
121
+ giftCount: number;
122
+ giftOptions: Array<{
123
+ product_id: number;
124
+ product_variant_id: number;
125
+ }>;
126
+ }>;
127
+ /** 处理后的商品列表 */
128
+ products: OrderProduct[];
129
+ }
130
+ /**
131
+ * tempOrder 上的下单客户协议字段视图。
132
+ * 这些字段会随订单提交到后端。
133
+ *
134
+ * customer_id 与 OrderTempOrder.customer_id 保持一致(number | null),
135
+ * 调用方若持有 string id(如 ICustomer.id 联合类型),需自行 Number() 转型。
136
+ */
137
+ export interface OrderCustomerView {
138
+ customer_id: number | null;
139
+ customer_name: string;
140
+ phone: string;
141
+ email: string;
142
+ country_calling_code: string;
143
+ }
144
+ /**
145
+ * 写入下单客户的协议字段输入。
146
+ * `customer_id` 必传(null 表示无客户);其余字段缺省视为「清空」(全量覆盖语义)。
147
+ */
148
+ export interface OrderCustomerPatch {
149
+ customer_id: number | null;
150
+ id?: number | null;
151
+ customer_name?: string;
152
+ phone?: string;
153
+ email?: string;
154
+ country_calling_code?: string;
155
+ }
156
+ /**
157
+ * 下单客户变更事件 payload。
158
+ * - `patch`:tempOrder 上的协议字段视图(会随订单提交)
159
+ * - `snapshot`:UI 富字段快照(仅本地,不随订单提交)
160
+ * 清空时整个 payload 为 null。
161
+ */
162
+ export interface OrderCustomerChangePayload {
163
+ patch: OrderCustomerView;
164
+ snapshot: ICustomer | null;
165
+ }
166
+ export interface OrderScanCodeResult {
167
+ isAvailable: boolean;
168
+ discountList: Discount[];
169
+ scannedDiscountList: Discount[];
170
+ type: 'server' | 'clientCalc';
171
+ unavailableReason?: UnavailableReason;
172
+ }
173
+ export interface OrderProductIdentity {
44
174
  product_id: number | null;
45
- num: number;
46
175
  product_variant_id: number;
47
- product_option_item: any[];
48
- /**
49
- * 行 composite 券后单价。
50
- * 公式:`metadata.main_product_selling_price` + Σ(bundle_selling_price × num)。
51
- * 主商品(含 option、含主商品折扣)的单价存在 `metadata.main_product_selling_price`。
52
- */
176
+ unique_identification_number?: string;
177
+ product_sku?: OrderProductSku;
178
+ product_bundle?: any[];
179
+ }
180
+ export interface OrderProductSku {
181
+ option: any[];
182
+ [key: string]: any;
183
+ }
184
+ export interface OrderLocalizedText {
185
+ [locale: string]: string | null;
186
+ }
187
+ export interface OrderProduct extends OrderProductIdentity {
188
+ order_detail_id: number | null;
189
+ num: number;
190
+ bundle_edit?: number;
191
+ product_sku: OrderProductSku;
192
+ gift_card?: number;
53
193
  selling_price: string;
54
- /**
55
- * 行 composite 券前单价。
56
- * 公式:`metadata.main_product_original_price` + Σ(bundle 原价 × num)。
57
- * 主商品(含 option、不含折扣)的单价存在 `metadata.main_product_original_price`。
58
- */
59
194
  original_price: string;
60
- /** 出站兼容字段,直接由 `selling_price` 派生,语义同 composite。 */
61
- payment_price: string;
62
195
  tax_fee: string;
63
196
  is_charge_tax: number;
64
- discount_list: any[];
197
+ discount_list: OrderProductDiscountItem[];
65
198
  product_bundle: any[];
199
+ booking_uid?: string;
200
+ product_title?: OrderLocalizedText;
201
+ product_cover?: string;
66
202
  metadata: Record<string, any>;
67
- /** 商品行备注 */
68
203
  note?: string;
69
204
  }
70
- export interface SubmitScanOrderSummary {
205
+ export interface OrderSummary {
71
206
  product_quantity: number;
72
207
  product_original_amount: string;
73
208
  product_amount: string;
@@ -77,15 +212,192 @@ export interface SubmitScanOrderSummary {
77
212
  shipping_tax_fee: string;
78
213
  tax_fee: string;
79
214
  surcharge_fee: string;
215
+ surcharges: any[];
80
216
  discount_amount: string;
81
217
  deposit_amount: string;
218
+ deposit?: {
219
+ total: string;
220
+ deposit_policy_ids: number[];
221
+ deposit_policy_data?: any[];
222
+ hasDeposit: boolean;
223
+ };
82
224
  expect_amount: string;
83
225
  total_amount: string;
226
+ total_refund_amount: string;
227
+ customer_paid_amount: string;
228
+ order_paid_amount: string;
84
229
  amount_gap: string;
85
230
  rounding_amount: string;
86
231
  pay_service_charge_amount: string;
232
+ tax_title?: string;
233
+ tax_rate?: number;
234
+ }
235
+ export interface OrderTempOrder {
236
+ order_id: number | null;
237
+ external_sale_number: string;
238
+ order_number: string | null;
239
+ shop_order_number: string | null;
240
+ shop_full_order_number: string | null;
241
+ type: string;
242
+ business_code?: string;
243
+ platform: string;
244
+ sales_channel: string;
245
+ order_sales_channel: string;
246
+ vouchers: any[];
247
+ status: string;
248
+ payment_status: string;
249
+ shipping_status: string;
250
+ customer_id: number | null;
251
+ customer_name: string;
252
+ country_calling_code: string;
253
+ phone: string;
254
+ email: string;
255
+ customer?: Record<string, any> | null;
256
+ is_price_include_tax: number;
257
+ tax_title: string;
258
+ tax_country_code: string;
259
+ currency_code: string;
260
+ currency_symbol: string;
261
+ currency_format: string;
262
+ is_deposit: number;
263
+ deposit_amount: string;
264
+ shop_discount: string;
265
+ surcharge_fee: string;
266
+ note: string;
267
+ buzzer?: string;
268
+ delivery_type?: string;
269
+ table_number?: Record<string, any>;
270
+ schedule_date: string;
271
+ created_at: string | undefined;
272
+ request_unique_idempotency_token?: string;
273
+ products: OrderProduct[];
274
+ bookings: any[];
275
+ payments: any[];
276
+ surcharges: any[];
277
+ discount_list?: any[];
278
+ relation_forms: any[];
279
+ contacts: any[];
280
+ contacts_info: Record<string, any> | null;
281
+ holder: Record<string, any> | null;
282
+ metadata: Record<string, any>;
283
+ summary?: OrderSummary;
284
+ _extend?: {
285
+ productsByUid?: Record<string, Record<string, any>>;
286
+ [key: string]: any;
287
+ };
288
+ }
289
+ export interface OrderSubmitProduct extends Omit<OrderProduct, 'unique_identification_number' | 'num'> {
290
+ product_quantity: number;
291
+ payment_price: string;
292
+ product_sku: OrderProductSku;
293
+ }
294
+ export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | 'discount_list' | 'created_at'> {
295
+ platform: string;
296
+ created_at?: string | undefined;
297
+ request_unique_idempotency_token?: string;
298
+ form_record_ids?: Array<{
299
+ form_id: number | string;
300
+ form_record_id: number | string;
301
+ }>;
302
+ products: OrderSubmitProduct[];
303
+ summary?: OrderSummary;
304
+ small_ticket_data_flag?: number;
305
+ }
306
+ export interface OrderState {
307
+ tempOrder: OrderTempOrder | null;
308
+ summary?: OrderSummary;
309
+ lastOrderInfo?: Record<string, any>;
310
+ syncState?: OrderSyncState;
311
+ discountList: any[];
312
+ availableWalletIds?: number[];
313
+ discount: DiscountModule | null;
314
+ rules: RulesModule | null;
315
+ }
316
+ export interface ReplaceTempOrderOptions {
317
+ recalculateSummary?: boolean;
318
+ persist?: boolean;
319
+ saveDraft?: boolean;
320
+ }
321
+ export type AddProductBookingInput = Record<string, any>;
322
+ /** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 unique_identification_number / 选项指纹等 */
323
+ export interface UpdateOrderProductParams {
324
+ product_id: number | null;
325
+ product_variant_id: number;
326
+ updates: Partial<OrderProduct>;
327
+ unique_identification_number?: string;
328
+ identity_key?: string;
329
+ product_sku?: OrderProductSku;
330
+ product_bundle?: any[];
331
+ booking?: AddProductBookingInput;
332
+ /**
333
+ * 预约时间 / 时长变更后允许使用本次报价覆盖已落库订单行历史价。
334
+ *
335
+ * @example
336
+ * await order.updateOrderProduct({
337
+ * product_id: 1,
338
+ * product_variant_id: 0,
339
+ * updates: { selling_price: '6.00', metadata: { source_product_price: '6.00' } },
340
+ * booking: { duration: 2 },
341
+ * allow_booking_reprice: true,
342
+ * });
343
+ */
344
+ allow_booking_reprice?: boolean;
345
+ /**
346
+ * Change time 重报价后,允许当前预约商品行重新应用已选编辑态折扣卡。
347
+ *
348
+ * @example
349
+ * await order.updateOrderProduct({
350
+ * product_id: 1,
351
+ * product_variant_id: 0,
352
+ * updates: { discount_list: [] },
353
+ * booking: { duration: 2 },
354
+ * allow_booking_discount_reapply: true,
355
+ * });
356
+ */
357
+ allow_booking_discount_reapply?: boolean;
358
+ }
359
+ /** 仅更新购物车行数量;行定位语义与 updateOrderProduct / removeProductFromOrder 保持一致 */
360
+ export interface UpdateOrderProductQuantityParams extends OrderProductIdentity {
361
+ num: number;
362
+ identity_key?: string;
87
363
  }
88
- export interface SubmitScanOrderBooking {
364
+ export interface UpdateOrderBookingParams {
365
+ unique_identification_number: string;
366
+ updates: AddProductBookingInput;
367
+ }
368
+ export interface OrderProductMergeDecisionContext {
369
+ incomingProduct: Partial<OrderProduct> & OrderProductIdentity;
370
+ normalizedIncoming: OrderProduct;
371
+ matchedProduct: OrderProduct;
372
+ matchedIndex: number;
373
+ incomingFingerprint: string;
374
+ existedFingerprint: string;
375
+ tempOrder: OrderTempOrder;
376
+ booking?: AddProductBookingInput;
377
+ defaultShouldMerge: boolean;
378
+ }
379
+ export type OrderProductMergeDecisionResult = boolean | {
380
+ shouldMerge: boolean;
381
+ reason?: string;
382
+ [key: string]: any;
383
+ };
384
+ export interface OrderHooksConfig {
385
+ onBeforeMergeProductToOrder?: (context: OrderProductMergeDecisionContext) => OrderProductMergeDecisionResult | Promise<OrderProductMergeDecisionResult>;
386
+ }
387
+ /**
388
+ * 订单信息
389
+ */
390
+ export interface CommitOrderParams {
391
+ url?: string;
392
+ query: {
393
+ cartItems: CartItem[];
394
+ type: 'virtual' | 'appointment_booking';
395
+ platform?: string;
396
+ extraData?: Record<string, any>;
397
+ business_code?: string;
398
+ };
399
+ }
400
+ export interface OrderSubmitBooking {
89
401
  relation_id?: string;
90
402
  form_id?: string;
91
403
  collect_pax?: number;
@@ -95,22 +407,21 @@ export interface SubmitScanOrderBooking {
95
407
  resources?: Array<Record<string, any>>;
96
408
  product_uid?: string;
97
409
  }
98
- export interface SubmitScanOrderFormRecord {
410
+ export interface OrderSubmitFormRecord {
99
411
  form_id: number | string;
100
412
  form_record_id: number | string;
101
413
  }
102
- export interface SubmitScanOrderParams {
414
+ export interface SubmitSalesOrderParams {
103
415
  url?: string;
104
416
  query: {
105
417
  order_id: number | null;
106
- relation_id?: string;
107
- table_form_id?: string;
108
- resource_id?: string;
109
- order_number: string;
110
- shop_order_number: string;
418
+ external_sale_number: string;
419
+ order_number: string | null;
420
+ shop_order_number: string | null;
421
+ shop_full_order_number: string | null;
111
422
  type: string;
112
- business_code: string;
113
- platform: 'H5' | 'PC';
423
+ business_code?: string;
424
+ platform: string;
114
425
  request_unique_idempotency_token?: string;
115
426
  sales_channel: string;
116
427
  order_sales_channel: string;
@@ -136,27 +447,20 @@ export interface SubmitScanOrderParams {
136
447
  delivery_type?: string;
137
448
  table_number?: Record<string, any>;
138
449
  schedule_date: string;
139
- created_at?: string;
140
- products: SubmitScanOrderProduct[];
141
- bookings: SubmitScanOrderBooking[];
450
+ created_at?: string | undefined;
451
+ products: OrderSubmitProduct[];
452
+ bookings: OrderSubmitBooking[];
142
453
  payments: any[];
454
+ vouchers: any[];
143
455
  surcharges?: any[];
144
- discount_list: any[];
145
456
  relation_forms: any[];
146
- form_record_ids?: SubmitScanOrderFormRecord[];
457
+ form_record_ids?: OrderSubmitFormRecord[];
147
458
  contacts: any[];
148
- contacts_info: any[];
459
+ contacts_info: Record<string, any> | null;
149
460
  holder: Record<string, any> | null;
150
- summary?: SubmitScanOrderSummary;
151
461
  metadata: Record<string, any>;
152
- };
153
- }
154
- export interface ScanOrderMoreParams {
155
- url?: string;
156
- query: {
157
- order_id: number | string;
158
- products: SubmitScanOrderProduct[];
159
- request_unique_idempotency_token?: string;
462
+ summary?: OrderSummary;
463
+ small_ticket_data_flag?: number;
160
464
  };
161
465
  }
162
466
  /**
@@ -169,15 +473,138 @@ export interface PaymentItemData {
169
473
  amount: string;
170
474
  /** 支付类型代码 */
171
475
  code: string;
172
- /** 支付类型id */
173
- id: number;
476
+ /** @deprecated use custom_payment_id */
477
+ id?: number;
478
+ /** 支付方式 ID */
479
+ custom_payment_id?: number;
174
480
  /** 支付类型名称 */
175
481
  name: string;
176
482
  /** 支付类型 */
177
483
  type: string;
178
- /** 是否已同步到后端 */
484
+ /** 支付时间 (格式: YYYY-MM-DD HH:mm:ss) */
485
+ payment_time?: string;
486
+ /** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss) */
487
+ created_at?: string;
488
+ /** @deprecated BaseSales/Sales 协议不提交该字段;旧 Checkout/Payment 内部仍可能使用 */
179
489
  isSynced?: boolean;
180
490
  }
491
+ export interface OrderPaymentMetadata {
492
+ rounding_rule?: Record<string, any>;
493
+ unique_payment_number?: string;
494
+ shop_wallet_pass_id?: number | string;
495
+ actual_paid_amount?: number | string;
496
+ change_given_amount?: number | string;
497
+ [key: string]: any;
498
+ }
499
+ export interface OrderPaymentData {
500
+ order_payment_id?: number | string;
501
+ amount: string;
502
+ code: string;
503
+ custom_payment_id: number;
504
+ custom_payment_type?: string;
505
+ name: string;
506
+ type: string;
507
+ voucher_id?: string | number;
508
+ origin_amount?: string;
509
+ service_fee?: string;
510
+ status?: 'active' | 'paid' | 'voided' | 'payment_pending' | string;
511
+ /** 支付时间 (格式: YYYY-MM-DD HH:mm:ss) */
512
+ payment_time?: string;
513
+ wallet_pass_usage_unit?: unknown;
514
+ wallet_pass_use_value?: string | number | null;
515
+ fund_record?: Record<string, any>;
516
+ metadata: OrderPaymentMetadata;
517
+ rounding_amount?: string;
518
+ service_charge?: {
519
+ percentage?: string;
520
+ amount?: string;
521
+ };
522
+ order_payment_type?: 'normal' | 'deposit';
523
+ /** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss) */
524
+ created_at?: string;
525
+ updated_at?: string;
526
+ }
527
+ export type OrderPaymentSource = PaymentItem | OrderPaymentData | Record<string, any>;
528
+ export interface MapOrderPaymentsOptions {
529
+ includeVoided?: boolean;
530
+ }
531
+ export type OrderSyncState = 'local' | 'submitting' | 'submitted' | 'failed' | 'remoteLoaded';
532
+ export interface LoadSalesDetailParams {
533
+ orderId?: number | string;
534
+ orderNumber?: string;
535
+ externalSaleNumber?: string;
536
+ external_sale_number?: string;
537
+ /**
538
+ * 已由调用方查询到的销售详情记录。
539
+ * 存在时 loadSalesDetail 会跳过远端 lookup,直接复用 hydrate 后半段逻辑。
540
+ */
541
+ preloadedSalesDetail?: Record<string, any>;
542
+ forceRemote?: boolean;
543
+ merge?: boolean;
544
+ }
545
+ export interface SalesOrderLookupParams {
546
+ lookup: number | string;
547
+ forceRemote?: boolean;
548
+ }
549
+ export interface SyncPaymentsToOrderParams {
550
+ payments: OrderPaymentSource[];
551
+ paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
552
+ submitWhenPaid?: boolean;
553
+ /**
554
+ * Whether the checkout should be queued as the local `sync_sales` task.
555
+ * Defaults to true to preserve the WebPOS retry path. Set to false when
556
+ * the caller must wait for the cloud checkout response before proceeding.
557
+ */
558
+ checkoutSyncTaskEnabled?: boolean;
559
+ smallTicketDataFlag?: number;
560
+ businessCode?: string;
561
+ channel?: string;
562
+ confirmPendingVoucherPayments?: boolean;
563
+ }
564
+ export interface SyncPaymentsToOrderResult<T = any> {
565
+ isFullyPaid: boolean;
566
+ isOrderFullyPaid: boolean;
567
+ isDepositFullyPaid: boolean;
568
+ paymentStage: 'deposit' | 'normal';
569
+ depositAmount: string;
570
+ orderExpectedAmount: string;
571
+ submitResult?: T;
572
+ }
573
+ export interface OrderIdentitySnapshot {
574
+ localId?: string;
575
+ orderId?: number | string | null;
576
+ externalSaleNumber?: string;
577
+ orderNumber?: string;
578
+ shopOrderNumber?: string;
579
+ shopFullOrderNumber?: string;
580
+ isSubmitted: boolean;
581
+ }
582
+ export interface OrderAmountSnapshot {
583
+ isDeposit: boolean;
584
+ depositAmount: string;
585
+ expectAmount: string;
586
+ totalAmount: string;
587
+ amountGap: string;
588
+ summary: OrderSummary;
589
+ }
590
+ export interface OrderSnapshot {
591
+ identity: OrderIdentitySnapshot;
592
+ syncState: OrderSyncState;
593
+ amount: OrderAmountSnapshot;
594
+ status: string;
595
+ paymentStatus: string;
596
+ shippingStatus: string;
597
+ note: string;
598
+ customer: {
599
+ customerId: number | null;
600
+ customerName: string;
601
+ phone: string;
602
+ email: string;
603
+ };
604
+ productCount: number;
605
+ lastOrderInfo?: Record<string, any>;
606
+ tempOrder: OrderTempOrder;
607
+ }
181
608
  /**
182
609
  * Checkout 专用订单创建参数
183
610
  */
@@ -198,6 +625,19 @@ export interface CheckoutOrderParams {
198
625
  small_ticket_data_flag?: number;
199
626
  [key: string]: any;
200
627
  }
628
+ /**
629
+ * 取消订单参数
630
+ */
631
+ export interface CancelOrderParams {
632
+ order_ids: Array<number | string>;
633
+ }
634
+ /**
635
+ * 变更预约状态参数
636
+ */
637
+ export interface ChangeBookingStatusParams {
638
+ booking_id: number | string;
639
+ appointment_status: string;
640
+ }
201
641
  /**
202
642
  * 订单模块 API
203
643
  */
@@ -214,28 +654,62 @@ export interface OrderModuleAPI {
214
654
  * @returns 后端返回的订单数据
215
655
  */
216
656
  createOrderByCheckout: (params: CheckoutOrderParams) => Promise<any>;
217
- submitScanOrder: <T = any>(params: SubmitScanOrderParams) => Promise<T>;
218
- scanOrderMore: <T = any>(params: ScanOrderMoreParams) => Promise<T>;
657
+ submitSalesOrder: <T = any>(params: SubmitSalesOrderParams) => Promise<T>;
219
658
  initTempOrder: (params: {
220
659
  cacheId?: string;
221
660
  salesSummaryModuleName?: string;
222
661
  }) => void;
223
- getTempOrder: () => ScanOrderTempOrder | null;
224
- ensureTempOrder: () => ScanOrderTempOrder;
225
- addNewOrder: () => Promise<ScanOrderTempOrder>;
226
- restoreOrder: () => ScanOrderTempOrder;
227
- getOrderProducts: () => ScanOrderOrderProduct[];
228
- getScanOrderSummary: () => Promise<ScanOrderSummary>;
662
+ getTempOrder: () => OrderTempOrder | null;
663
+ ensureTempOrder: () => OrderTempOrder;
664
+ replaceTempOrder: (tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions) => Promise<OrderTempOrder>;
665
+ addNewOrder: () => Promise<OrderTempOrder>;
666
+ restoreOrder: () => OrderTempOrder;
667
+ getOrderProducts: () => OrderProduct[];
668
+ getOrderSummary: () => Promise<OrderSummary>;
229
669
  recalculateSummary: (options?: {
230
670
  createIfMissing?: boolean;
231
- }) => Promise<ScanOrderSummary | null>;
232
- updateTempOrderNote: (note: string) => string;
671
+ }) => Promise<OrderSummary | null>;
672
+ getOrderIdentity: () => OrderIdentitySnapshot | null;
673
+ getOrderSnapshot: () => OrderSnapshot | null;
674
+ getOrderSyncState: () => OrderSyncState;
675
+ getOrderAmountSnapshot: () => OrderAmountSnapshot | null;
676
+ buildCurrentSubmitPayloadForLocalPrint: (params?: {
677
+ cacheId?: string;
678
+ platform?: string;
679
+ businessCode?: string;
680
+ channel?: string;
681
+ type?: string;
682
+ }) => OrderSubmitPayload;
683
+ applyLocalPrintOrderNumbers: (order?: Record<string, any> | null) => Promise<OrderTempOrder>;
684
+ getTempOrderNote: () => string;
685
+ updateTempOrderNote: {
686
+ (note: string): string;
687
+ (note: string, sync: true): Promise<string>;
688
+ (note: string, sync: boolean): string | Promise<string>;
689
+ };
690
+ updateTempOrderShopDiscount: (amount: string | number) => string;
691
+ updateTempOrderDepositAmount: (amount: string | number) => OrderSummary;
692
+ updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
233
693
  updateTempOrderBuzzer: (buzzer: string) => string;
234
- updateTempOrderContactsInfo: (contactsInfo: any[]) => any[];
235
- addProductToOrder: (product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
236
- updateProductInOrder: (params: UpdateProductInOrderParams) => Promise<ScanOrderOrderProduct[]>;
237
- removeProductFromOrder: (identity: ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
694
+ updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
695
+ addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput) => Promise<OrderProduct[]>;
696
+ updateOrderProduct: (params: UpdateOrderProductParams) => Promise<OrderProduct[]>;
697
+ /** 批量更新购物车行,末尾仅触发一次促销重算与 summary 刷新 */
698
+ updateOrderProducts: (paramsList: UpdateOrderProductParams[]) => Promise<OrderProduct[]>;
699
+ updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams) => Promise<OrderProduct[]>;
700
+ updateOrderBooking: (params: UpdateOrderBookingParams) => any[];
701
+ removeProductFromOrder: (identity: OrderProductIdentity) => Promise<OrderProduct[]>;
702
+ /** 批量删除购物车行,末尾仅触发一次促销重算与 summary 刷新 */
703
+ removeProductsFromOrder: (identities: OrderProductIdentity[]) => Promise<OrderProduct[]>;
704
+ /** @deprecated no-op;OrderModule 不再负责 tempOrder localStorage 持久化。 */
238
705
  persistTempOrder: () => void;
706
+ /**
707
+ * 控制 IndexedDB 草稿(saveDraft)开关;localStorage tempOrder 持久化已废弃。
708
+ * BigSale 弹窗等场景传 false 可跳过 saveDraft。
709
+ */
710
+ setEnableTempOrderPersist: (enabled: boolean) => void;
711
+ /** 是否允许 saveDraft 写入 IndexedDB 草稿。 */
712
+ isTempOrderPersistEnabled: () => boolean;
239
713
  /** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
240
714
  notifyTempOrderChanged: () => void;
241
715
  submitTempOrder: <T = any>(params?: {
@@ -244,13 +718,144 @@ export interface OrderModuleAPI {
244
718
  businessCode?: string;
245
719
  channel?: string;
246
720
  type?: string;
721
+ payments?: OrderPaymentSource[];
722
+ paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
723
+ smallTicketDataFlag?: number;
724
+ confirmPendingVoucherPayments?: boolean;
247
725
  enhancePayload?: SubmitPayloadEnhancer;
248
726
  }) => Promise<T>;
727
+ submitTempOrderAsync: <T = any>(params?: {
728
+ cacheId?: string;
729
+ platform?: string;
730
+ businessCode?: string;
731
+ channel?: string;
732
+ type?: string;
733
+ payments?: OrderPaymentSource[];
734
+ paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
735
+ smallTicketDataFlag?: number;
736
+ confirmPendingVoucherPayments?: boolean;
737
+ enhancePayload?: SubmitPayloadEnhancer;
738
+ }) => Promise<T>;
739
+ getOrderPayments: () => OrderPaymentData[];
740
+ setOrderPayments: (payments: OrderPaymentSource[]) => OrderPaymentData[];
741
+ addOrderPayment: (payment: OrderPaymentSource) => OrderPaymentData[];
742
+ updateOrderPayment: (paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>) => OrderPaymentData[];
743
+ deleteOrderPayment: (paymentIdentity: string | number) => OrderPaymentData[];
744
+ updateVoucherOrderPayments: (payments: OrderPaymentSource[], options?: {
745
+ status?: 'paid' | 'payment_pending';
746
+ }) => OrderPaymentData[];
747
+ confirmPendingVoucherPayments: (options?: {
748
+ persist?: boolean;
749
+ recalculateSummary?: boolean;
750
+ }) => OrderPaymentData[];
751
+ discardPendingVoucherPayments: (options?: {
752
+ persist?: boolean;
753
+ recalculateSummary?: boolean;
754
+ }) => OrderPaymentData[];
755
+ sendCustomerPayLink: <T = any>(params: SendCustomerPayLinkParams) => Promise<T>;
756
+ saveDraft: () => Promise<void>;
757
+ hydrateTempOrderFromRecord: (record: Record<string, any>, options?: {
758
+ recalcOnHydrate?: boolean;
759
+ }) => Promise<OrderTempOrder>;
760
+ syncPaymentsToOrder: <T = any>(params: SyncPaymentsToOrderParams) => Promise<SyncPaymentsToOrderResult<T>>;
761
+ getSalesOrderByLookup: (params: SalesOrderLookupParams) => Promise<any>;
762
+ getLastOrderInfo: () => Record<string, any> | undefined;
763
+ getOrderInfo: (order_id: number) => Promise<any>;
764
+ /**
765
+ * 写入当前下单客户。
766
+ *
767
+ * 语义为「全量覆盖」:`patch` 中未提供的协议字段会被清空(写为 '')。
768
+ * snapshot 用于保存 UI 富字段(wallet/会员/地址等),不会随订单提交。
769
+ *
770
+ * @param patch tempOrder 协议字段;传 null 等价于 clearOrderCustomer。
771
+ * @param snapshot UI 富字段快照。undefined 表示不动既有 snapshot;
772
+ * null 表示显式清空 snapshot;ICustomer 写入并 cloneDeep。
773
+ */
774
+ setOrderCustomer: (patch: OrderCustomerPatch | null, snapshot?: ICustomer | null) => void;
775
+ /** 读取 tempOrder 的客户协议字段;customer_id 缺失时返回 null。 */
776
+ getOrderCustomer: () => OrderCustomerView | null;
777
+ /** 读取 _extend.customerSnapshot;不存在时返回 null。 */
778
+ getOrderCustomerSnapshot: () => ICustomer | null;
779
+ /** 清空 tempOrder 协议字段 + _extend.customerSnapshot,并 emit 变更事件 payload=null。 */
780
+ clearOrderCustomer: () => void;
249
781
  loadDiscountConfig: (params: {
250
782
  customerId: number;
251
- action?: 'create';
252
- }) => Promise<void>;
783
+ action?: 'create' | 'edit';
784
+ orderId?: number;
785
+ apply?: boolean;
786
+ }) => Promise<Discount[]>;
253
787
  getDiscountList: () => Discount[];
254
788
  getAvailableWalletIds: () => number[];
255
789
  applyDiscount: () => void;
790
+ /**
791
+ * 注入促销评估器。
792
+ *
793
+ * SalesSdkProvider 在初始化 bookingTicket 后会自动从 `appHelper.utils.promotionEvaluator`
794
+ * 读取实例并调用本方法注入。host 透明,业务 UI 不感知。
795
+ *
796
+ * @example
797
+ * order.setPromotionEvaluator(appHelper.utils.promotionEvaluator);
798
+ */
799
+ setPromotionEvaluator: (evaluator: OrderPromotionEvaluator | null) => void;
800
+ /**
801
+ * 注入赠品选择 resolver。OS 在 applyPromotion 内部当需要新增赠品时会 await 调用 resolver。
802
+ *
803
+ * 缺省时 OS 会 `console.warn` 并跳过新增(既有赠品的 reduce/remove 仍会执行)。
804
+ *
805
+ * @example
806
+ * order.setGiftSelectResolver((ctx) => giftSelectBridge.request(ctx));
807
+ */
808
+ setGiftSelectResolver: (resolver: OrderGiftSelectResolver | null) => void;
809
+ /**
810
+ * 为商品目录追加促销标签。
811
+ *
812
+ * @example
813
+ * const taggedProducts = order.appendPromotionTags(products);
814
+ */
815
+ appendPromotionTags: <T extends Record<string, any>>(products: T[]) => T[];
816
+ /**
817
+ * 应用购物车促销(评估 → 差异化赠品 → 写回 tempOrder.products → emit onPromotionApplied)。
818
+ *
819
+ * 自动在 addProductToOrder / updateOrderProductQuantity / removeProductFromOrder /
820
+ * clearOrderCartLines / setOrderCustomer 等写路径末尾触发,业务一般无需手动调用。
821
+ *
822
+ * 多选项赠品依赖 giftSelectResolver;如未注入则跳过且 console.warn。
823
+ * 内部以 `_isApplyingPromotion` flag 防递归。
824
+ */
825
+ applyPromotion: () => Promise<void>;
826
+ /** 读取上次 applyPromotion 产出的未满足促销提示 */
827
+ getUnfulfilledPromotions: () => OrderUnfulfilledPromotion[];
828
+ /** 读取上次 applyPromotion 产出的赠品操作 diff(toAdd / toReduce / toRemove) */
829
+ getLastGiftActions: () => OrderLastGiftActions | null;
830
+ /**
831
+ * 取消订单
832
+ * @param params 取消订单参数
833
+ * @returns 后端返回结果
834
+ */
835
+ cancelOrder: (params: CancelOrderParams) => Promise<any>;
836
+ /**
837
+ * 变更预约状态
838
+ * @param params 预约状态参数
839
+ * @returns 后端返回结果
840
+ */
841
+ changeBookingStatus: (params: ChangeBookingStatusParams) => Promise<any>;
842
+ }
843
+ export interface UpdateTempOrderCustomerInput {
844
+ customer_id?: number | string | null;
845
+ customerId?: number | string | null;
846
+ id?: number | string | null;
847
+ customer_name?: string;
848
+ customerName?: string;
849
+ display_name?: string;
850
+ name?: string;
851
+ country_calling_code?: string;
852
+ countryCallingCode?: string;
853
+ phone?: string;
854
+ email?: string;
855
+ }
856
+ export interface SendCustomerPayLinkParams {
857
+ emails: string[];
858
+ orderIds?: Array<number | string>;
859
+ order_ids?: Array<number | string>;
860
+ notify_action?: string;
256
861
  }