@pisell/pisellos 2.2.244 → 2.2.245

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 (317) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
  2. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  3. package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
  4. package/dist/modules/BookingContext/index.d.ts +48 -0
  5. package/dist/modules/BookingContext/index.js +566 -0
  6. package/dist/modules/BookingContext/types.d.ts +102 -0
  7. package/dist/modules/BookingContext/types.js +51 -0
  8. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  9. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +284 -0
  10. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  11. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +145 -0
  12. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  13. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +218 -0
  14. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  15. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  16. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  17. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  18. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  19. package/dist/modules/BookingContext/utils/index.js +11 -0
  20. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  21. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  22. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  23. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  24. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  25. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  26. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  27. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  28. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  29. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  30. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  31. package/dist/modules/BookingContext/utils/resources.js +486 -0
  32. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  33. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  34. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  35. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  36. package/dist/modules/Cart/utils/cartProduct.js +24 -3
  37. package/dist/modules/Cart/utils/changePrice.js +11 -11
  38. package/dist/modules/Customer/index.d.ts +20 -0
  39. package/dist/modules/Customer/index.js +172 -83
  40. package/dist/modules/Customer/types.d.ts +2 -0
  41. package/dist/modules/Discount/index.d.ts +1 -1
  42. package/dist/modules/Discount/index.js +13 -6
  43. package/dist/modules/Discount/types.d.ts +1 -0
  44. package/dist/modules/OpenData/index.d.ts +8 -0
  45. package/dist/modules/OpenData/index.js +37 -17
  46. package/dist/modules/Order/index.d.ts +275 -19
  47. package/dist/modules/Order/index.js +3493 -809
  48. package/dist/modules/Order/types.d.ts +286 -31
  49. package/dist/modules/Order/types.js +38 -0
  50. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  51. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  52. package/dist/modules/Order/utils.d.ts +147 -5
  53. package/dist/modules/Order/utils.js +750 -104
  54. package/dist/modules/Payment/index.d.ts +10 -13
  55. package/dist/modules/Payment/index.js +467 -837
  56. package/dist/modules/Payment/types.d.ts +2 -0
  57. package/dist/modules/Payment/utils.js +2 -1
  58. package/dist/modules/Payment/walletpass.js +41 -25
  59. package/dist/modules/ProductList/index.d.ts +16 -12
  60. package/dist/modules/ProductList/index.js +133 -59
  61. package/dist/modules/ProductList/types.d.ts +14 -0
  62. package/dist/modules/Quotation/index.d.ts +0 -1
  63. package/dist/modules/Quotation/index.js +25 -22
  64. package/dist/modules/Rules/index.d.ts +4 -0
  65. package/dist/modules/Rules/index.js +97 -70
  66. package/dist/modules/Rules/types.d.ts +1 -0
  67. package/dist/modules/SalesSummary/index.d.ts +8 -25
  68. package/dist/modules/SalesSummary/index.js +86 -35
  69. package/dist/modules/SalesSummary/types.d.ts +4 -1
  70. package/dist/modules/SalesSummary/utils.d.ts +2 -25
  71. package/dist/modules/SalesSummary/utils.js +794 -162
  72. package/dist/modules/Schedule/index.d.ts +7 -0
  73. package/dist/modules/Schedule/index.js +24 -2
  74. package/dist/modules/Summary/index.js +4 -3
  75. package/dist/modules/SurchargeList/index.d.ts +16 -0
  76. package/dist/modules/SurchargeList/index.js +162 -0
  77. package/dist/modules/SurchargeList/types.d.ts +11 -0
  78. package/dist/modules/SurchargeList/types.js +1 -0
  79. package/dist/modules/index.d.ts +2 -0
  80. package/dist/modules/index.js +3 -1
  81. package/dist/plugins/request.d.ts +1 -0
  82. package/dist/server/index.d.ts +204 -1
  83. package/dist/server/index.js +3654 -922
  84. package/dist/server/modules/index.d.ts +2 -0
  85. package/dist/server/modules/index.js +2 -0
  86. package/dist/server/modules/order/index.d.ts +120 -3
  87. package/dist/server/modules/order/index.js +1758 -448
  88. package/dist/server/modules/order/types.d.ts +32 -3
  89. package/dist/server/modules/order/types.js +8 -0
  90. package/dist/server/modules/order/utils/filterBookings.js +26 -3
  91. package/dist/server/modules/order/utils/filterOrders.js +23 -8
  92. package/dist/server/modules/payment/index.d.ts +28 -0
  93. package/dist/server/modules/payment/index.js +305 -0
  94. package/dist/server/modules/payment/types.d.ts +9 -0
  95. package/dist/server/modules/payment/types.js +1 -0
  96. package/dist/server/modules/products/index.d.ts +34 -7
  97. package/dist/server/modules/products/index.js +631 -317
  98. package/dist/server/modules/resource/index.d.ts +2 -0
  99. package/dist/server/modules/resource/index.js +29 -3
  100. package/dist/server/modules/schedule/index.d.ts +4 -4
  101. package/dist/server/modules/schedule/index.js +111 -88
  102. package/dist/server/test.json +713 -0
  103. package/dist/server/utils/small-ticket.d.ts +71 -0
  104. package/dist/server/utils/small-ticket.js +840 -0
  105. package/dist/solution/BaseSales/index.d.ts +133 -10
  106. package/dist/solution/BaseSales/index.js +1950 -447
  107. package/dist/solution/BaseSales/types.d.ts +82 -6
  108. package/dist/solution/BaseSales/types.js +5 -4
  109. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  110. package/dist/solution/BaseSales/utils/cartPromotion.js +1438 -0
  111. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  112. package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
  113. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  114. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +105 -24
  115. package/dist/solution/BaseSales/utils.d.ts +1 -1
  116. package/dist/solution/BaseSales/utils.js +62 -21
  117. package/dist/solution/BookingByStep/index.d.ts +1 -1
  118. package/dist/solution/BookingTicket/index.d.ts +271 -11
  119. package/dist/solution/BookingTicket/index.js +1777 -242
  120. package/dist/solution/BookingTicket/types.d.ts +118 -1
  121. package/dist/solution/BookingTicket/types.js +41 -2
  122. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  123. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  124. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  125. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  126. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  127. package/dist/solution/BookingTicket/utils/bookingStatus.js +70 -0
  128. package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
  129. package/dist/solution/BookingTicket/utils/cartView.js +94 -7
  130. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  131. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  132. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  133. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  134. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  135. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  136. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  137. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  138. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  139. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  140. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  141. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  142. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  143. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  144. package/dist/solution/Checkout/index.d.ts +1 -0
  145. package/dist/solution/Checkout/index.js +10 -9
  146. package/dist/solution/RegisterAndLogin/config.js +2 -10
  147. package/dist/solution/ScanOrder/index.d.ts +9 -3
  148. package/dist/solution/ScanOrder/index.js +241 -134
  149. package/dist/solution/ScanOrder/types.d.ts +9 -5
  150. package/dist/solution/ScanOrder/types.js +2 -3
  151. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  152. package/dist/solution/ScanOrder/utils.js +84 -22
  153. package/dist/solution/VenueBooking/index.d.ts +5 -2
  154. package/dist/solution/VenueBooking/index.js +110 -59
  155. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  156. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  157. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  158. package/dist/types/index.d.ts +10 -0
  159. package/lib/model/strategy/adapter/promotion/evaluator.js +2 -1
  160. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  161. package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
  162. package/lib/modules/BookingContext/index.d.ts +48 -0
  163. package/lib/modules/BookingContext/index.js +368 -0
  164. package/lib/modules/BookingContext/types.d.ts +102 -0
  165. package/lib/modules/BookingContext/types.js +34 -0
  166. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  167. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
  168. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  169. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +151 -0
  170. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  171. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +201 -0
  172. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  173. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  174. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  175. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  176. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  177. package/lib/modules/BookingContext/utils/index.js +43 -0
  178. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  179. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  180. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  181. package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
  182. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  183. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  184. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  185. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  186. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  187. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  188. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  189. package/lib/modules/BookingContext/utils/resources.js +377 -0
  190. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  191. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  192. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  193. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  194. package/lib/modules/Cart/utils/cartProduct.js +20 -3
  195. package/lib/modules/Cart/utils/changePrice.js +12 -20
  196. package/lib/modules/Customer/index.d.ts +20 -0
  197. package/lib/modules/Customer/index.js +64 -11
  198. package/lib/modules/Customer/types.d.ts +2 -0
  199. package/lib/modules/Discount/index.d.ts +1 -1
  200. package/lib/modules/Discount/index.js +9 -1
  201. package/lib/modules/Discount/types.d.ts +1 -0
  202. package/lib/modules/OpenData/index.d.ts +8 -0
  203. package/lib/modules/OpenData/index.js +19 -5
  204. package/lib/modules/Order/index.d.ts +275 -19
  205. package/lib/modules/Order/index.js +2245 -336
  206. package/lib/modules/Order/types.d.ts +286 -31
  207. package/lib/modules/Order/types.js +1 -0
  208. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  209. package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
  210. package/lib/modules/Order/utils.d.ts +147 -5
  211. package/lib/modules/Order/utils.js +615 -46
  212. package/lib/modules/Payment/index.d.ts +10 -13
  213. package/lib/modules/Payment/index.js +18 -150
  214. package/lib/modules/Payment/types.d.ts +2 -0
  215. package/lib/modules/Payment/utils.js +2 -1
  216. package/lib/modules/Payment/walletpass.js +16 -3
  217. package/lib/modules/ProductList/index.d.ts +16 -12
  218. package/lib/modules/ProductList/index.js +41 -4
  219. package/lib/modules/ProductList/types.d.ts +14 -0
  220. package/lib/modules/Quotation/index.d.ts +0 -1
  221. package/lib/modules/Quotation/index.js +19 -16
  222. package/lib/modules/Rules/index.d.ts +4 -0
  223. package/lib/modules/Rules/index.js +137 -120
  224. package/lib/modules/Rules/types.d.ts +1 -0
  225. package/lib/modules/SalesSummary/index.d.ts +8 -25
  226. package/lib/modules/SalesSummary/index.js +30 -4
  227. package/lib/modules/SalesSummary/types.d.ts +4 -1
  228. package/lib/modules/SalesSummary/utils.d.ts +2 -25
  229. package/lib/modules/SalesSummary/utils.js +645 -91
  230. package/lib/modules/Schedule/index.d.ts +7 -0
  231. package/lib/modules/Schedule/index.js +17 -1
  232. package/lib/modules/Summary/index.js +5 -4
  233. package/lib/modules/SurchargeList/index.d.ts +16 -0
  234. package/lib/modules/SurchargeList/index.js +89 -0
  235. package/lib/modules/SurchargeList/types.d.ts +11 -0
  236. package/lib/modules/SurchargeList/types.js +17 -0
  237. package/lib/modules/index.d.ts +2 -0
  238. package/lib/modules/index.js +5 -1
  239. package/lib/plugins/request.d.ts +1 -0
  240. package/lib/server/index.d.ts +204 -1
  241. package/lib/server/index.js +1891 -59
  242. package/lib/server/modules/index.d.ts +2 -0
  243. package/lib/server/modules/index.js +3 -0
  244. package/lib/server/modules/order/index.d.ts +120 -3
  245. package/lib/server/modules/order/index.js +883 -94
  246. package/lib/server/modules/order/types.d.ts +32 -3
  247. package/lib/server/modules/order/utils/filterBookings.js +24 -5
  248. package/lib/server/modules/order/utils/filterOrders.js +15 -6
  249. package/lib/server/modules/payment/index.d.ts +28 -0
  250. package/lib/server/modules/payment/index.js +192 -0
  251. package/lib/server/modules/payment/types.d.ts +9 -0
  252. package/lib/server/modules/payment/types.js +17 -0
  253. package/lib/server/modules/products/index.d.ts +34 -7
  254. package/lib/server/modules/products/index.js +189 -54
  255. package/lib/server/modules/resource/index.d.ts +2 -0
  256. package/lib/server/modules/resource/index.js +27 -3
  257. package/lib/server/modules/schedule/index.d.ts +4 -4
  258. package/lib/server/modules/schedule/index.js +47 -40
  259. package/lib/server/test.json +713 -0
  260. package/lib/server/utils/small-ticket.d.ts +71 -0
  261. package/lib/server/utils/small-ticket.js +800 -0
  262. package/lib/solution/BaseSales/index.d.ts +133 -10
  263. package/lib/solution/BaseSales/index.js +1111 -63
  264. package/lib/solution/BaseSales/types.d.ts +82 -6
  265. package/lib/solution/BaseSales/types.js +3 -1
  266. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  267. package/lib/solution/BaseSales/utils/cartPromotion.js +992 -0
  268. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  269. package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
  270. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  271. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +106 -18
  272. package/lib/solution/BaseSales/utils.d.ts +1 -1
  273. package/lib/solution/BaseSales/utils.js +54 -10
  274. package/lib/solution/BookingByStep/index.d.ts +1 -1
  275. package/lib/solution/BookingTicket/index.d.ts +271 -11
  276. package/lib/solution/BookingTicket/index.js +922 -29
  277. package/lib/solution/BookingTicket/types.d.ts +118 -1
  278. package/lib/solution/BookingTicket/types.js +11 -0
  279. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  280. package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
  281. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  282. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
  283. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  284. package/lib/solution/BookingTicket/utils/bookingStatus.js +44 -2
  285. package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
  286. package/lib/solution/BookingTicket/utils/cartView.js +61 -6
  287. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  288. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  289. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  290. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
  291. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  292. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
  293. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  294. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
  295. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  296. package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
  297. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  298. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
  299. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  300. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
  301. package/lib/solution/Checkout/index.d.ts +1 -0
  302. package/lib/solution/Checkout/index.js +1 -2
  303. package/lib/solution/RegisterAndLogin/config.js +2 -10
  304. package/lib/solution/ScanOrder/index.d.ts +9 -3
  305. package/lib/solution/ScanOrder/index.js +153 -70
  306. package/lib/solution/ScanOrder/types.d.ts +9 -5
  307. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  308. package/lib/solution/ScanOrder/utils.js +83 -17
  309. package/lib/solution/VenueBooking/index.d.ts +5 -2
  310. package/lib/solution/VenueBooking/index.js +54 -17
  311. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  312. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  313. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  314. package/lib/types/index.d.ts +10 -0
  315. package/package.json +1 -1
  316. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  317. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -1,9 +1,9 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { OrderModuleAPI, CommitOrderParams, UpdateProductInOrderParams, CheckoutOrderParams, CancelOrderParams, ChangeBookingStatusParams } from './types';
3
+ import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CheckoutOrderParams, CancelOrderParams, ChangeBookingStatusParams } from './types';
4
4
  import { CartItem } from '../Cart/types';
5
5
  import { type SubmitPayloadEnhancer } from './utils';
6
- import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView } from './types';
6
+ import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
7
7
  import type { ICustomer } from '../AccountList/types';
8
8
  import type { Discount } from '../Discount/types';
9
9
  import { UnavailableReason } from '../Rules/types';
@@ -13,20 +13,45 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
13
13
  private store;
14
14
  private request;
15
15
  private logger;
16
- private dbManager;
17
16
  private window;
18
17
  private cacheId;
19
18
  private salesSummaryModuleName;
20
19
  private rulesHooksOverride?;
20
+ private moduleHooksOverride?;
21
21
  private orderHooks?;
22
22
  private otherParams?;
23
+ /** 评估器引用;由 SalesSdkProvider 注入,未注入时 applyPromotion 静默跳过 */
24
+ private promotionEvaluator;
25
+ /** 赠品选择 resolver;由 SDK host bridge 注入 */
26
+ private giftSelectResolver;
27
+ /** applyPromotion 递归保护 flag(写路径同步调 applyPromotion,禁止重入) */
28
+ private isApplyingPromotion;
29
+ /** 最近一次 applyPromotion 的未满足促销提示 */
30
+ private lastUnfulfilledPromotions;
31
+ /** 最近一次 applyPromotion 的赠品操作 diff(debug / SDK 读取使用) */
32
+ private lastGiftActions;
33
+ /**
34
+ * 是否将 tempOrder 写入 IndexedDB 草稿(orders store)。
35
+ * BigSale 弹窗等短生命周期场景通过 setEnableTempOrderPersist(false) 关闭。
36
+ */
37
+ private draftPersistEnabled;
38
+ private collectHydratedEditDiscounts;
23
39
  /**
24
40
  * Populate `savedAmount` on each discount based on product-level discount details.
25
41
  * Only selected discounts get a non-zero value.
26
42
  */
27
43
  static populateSavedAmounts(productList: Array<Record<string, any>>, discountList: Array<Record<string, any>>): void;
44
+ private applyProductDiscountPrices;
28
45
  constructor(name?: string, version?: string);
29
46
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
47
+ destroy(): Promise<void>;
48
+ /**
49
+ * 更新父级解决方案透传的运行态参数,并同步 Order 内部依赖的派生字段。
50
+ *
51
+ * @example
52
+ * orderModule.updateOtherParams({ cacheId: 'cache-2', channel: 'pos' });
53
+ */
54
+ updateOtherParams(params: Record<string, any>): void;
30
55
  /**
31
56
  * 记录信息日志
32
57
  */
@@ -43,43 +68,126 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
43
68
  private createDefaultRulesHooks;
44
69
  loadDiscountConfig(params: {
45
70
  customerId: number;
46
- action?: 'create';
47
- }): Promise<void>;
71
+ action?: 'create' | 'edit';
72
+ orderId?: number;
73
+ apply?: boolean;
74
+ }): Promise<Discount[]>;
48
75
  getDiscountList(): Discount[];
76
+ private ensureEditDiscountConfigForProductChange;
49
77
  scanCode(code: string, customerId?: number): Promise<{
50
78
  isAvailable: boolean;
51
79
  discountList: Discount[];
52
80
  type: 'server' | 'clientCalc';
53
81
  unavailableReason?: UnavailableReason;
54
82
  unavailableReasonKey?: string | null;
83
+ scannedDiscountList?: Discount[];
55
84
  }>;
56
85
  applyDiscount(): void;
86
+ /**
87
+ * 注入促销评估器。
88
+ *
89
+ * @example
90
+ * order.setPromotionEvaluator(appHelper.utils.promotionEvaluator);
91
+ */
92
+ setPromotionEvaluator(evaluator: OrderPromotionEvaluator | null): void;
93
+ /**
94
+ * 注入赠品选择 resolver。OS 需要补赠品时会 await 调用 resolver;缺省时跳过新增并 console.warn。
95
+ *
96
+ * @example
97
+ * order.setGiftSelectResolver(async (ctx) => {
98
+ * // SDK 内部决定弹窗 or 自动选第一项,返回完整 OrderProduct[]
99
+ * return giftSelectBridge.request(ctx);
100
+ * });
101
+ */
102
+ setGiftSelectResolver(resolver: OrderGiftSelectResolver | null): void;
103
+ /**
104
+ * 为商品目录追加促销标签,供上层 Sales 门面复用。
105
+ *
106
+ * @example
107
+ * const products = order.appendPromotionTags(catalogProducts);
108
+ */
109
+ appendPromotionTags<T extends Record<string, any>>(products: T[]): T[];
110
+ /**
111
+ * 应用购物车促销:计算 → 差异化赠品 → 写回 tempOrder.products → emit onPromotionApplied。
112
+ *
113
+ * 调用时机:写路径(add/update/remove/clear/setCustomer)末尾自动触发;外部一般无需手动调。
114
+ *
115
+ * 关键约束:
116
+ * - 不调用任何公开 CRUD API(如 removeProductFromOrder),全部内部 mutate tempOrder.products,避免事件风暴;
117
+ * - 用 `isApplyingPromotion` 防递归;
118
+ * - 多选项赠品依赖 giftSelectResolver,未注入则跳过且 console.warn;
119
+ * - 不主动调用 applyDiscount / recalculateSummary,调用方负责跟进。
120
+ */
121
+ applyPromotion(): Promise<void>;
122
+ /** 最近一次 applyPromotion 输出的未满足促销列表 */
123
+ getUnfulfilledPromotions(): OrderUnfulfilledPromotion[];
124
+ /** 最近一次 applyPromotion 输出的赠品操作 diff */
125
+ getLastGiftActions(): OrderLastGiftActions | null;
57
126
  initTempOrder(params: {
58
127
  cacheId?: string;
59
128
  salesSummaryModuleName?: string;
60
129
  }): void;
61
- private getTempOrderStorageKey;
62
- private restoreTempOrderFromStorage;
130
+ /**
131
+ * 控制 IndexedDB 草稿(saveDraft)是否写入。
132
+ * localStorage 版 tempOrder 持久化已废弃,此方法仅影响 saveDraft。
133
+ *
134
+ * @example
135
+ * order.setEnableTempOrderPersist(false); // BigSale 弹窗:跳过 ~1s 的 dbUpdate
136
+ */
137
+ setEnableTempOrderPersist(enabled: boolean): void;
138
+ /** 是否允许 saveDraft 写入 IndexedDB 草稿。 */
139
+ isTempOrderPersistEnabled(): boolean;
140
+ /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化;草稿保存请使用 IndexedDB saveDraft。 */
63
141
  persistTempOrder(): void;
64
142
  private createDefaultTempOrderInstance;
65
143
  private createExternalSaleNumber;
66
144
  private ensureExternalSaleNumber;
67
145
  private ensureRequestUniqueIdempotencyToken;
68
- hasLocalDatabase(): boolean;
69
- private buildLocalOrderRecord;
70
- getLocalOrderByOrderId(orderId: number | string): Promise<Record<string, any> | null>;
71
- getLocalOrderByOrderNumber(orderNumber: string): Promise<Record<string, any> | null>;
72
- getLocalOrderByExternalSaleNumber(externalSaleNumber: string): Promise<Record<string, any> | null>;
146
+ private buildPaymentSyncIdempotencyToken;
73
147
  saveDraft(): Promise<void>;
148
+ private saveDraftInBackground;
74
149
  private hydrateTempOrderFromLocalRecord;
75
150
  private extractOrderIdFromSubmitResult;
151
+ private calculatePaymentEffectiveAmount;
76
152
  private calculatePaymentTotal;
153
+ private getDepositAmount;
154
+ private normalizeDepositAmount;
155
+ private applyDepositAmountToSummary;
156
+ private isDepositOrder;
157
+ private getOrderExpectedAmount;
158
+ private isDepositCovered;
159
+ private calculateDepositPaidAmount;
160
+ private resolveNextOrderPaymentType;
161
+ private normalizePaymentSource;
162
+ private updateTempOrderPaymentStatus;
163
+ private shouldKeepPaymentStatusAfterAmountRecalc;
164
+ private resolveWalletPassUseValue;
165
+ private adjustVoucherFundRecord;
166
+ private capVoucherPaymentsByRemainingAmount;
77
167
  private calculatePaidPaymentSummary;
78
168
  private calculatePaymentServiceFee;
169
+ private calculatePaymentGapAmount;
170
+ private calculatePaymentRoundingAmount;
171
+ private formatSummaryMetadataMoney;
172
+ private syncSummaryProductMetadata;
173
+ private calculateSummaryAmountGap;
174
+ private getSummaryRefundAmount;
175
+ private calculatePaymentTargetAmount;
176
+ private normalizeFingerprintMoney;
177
+ private normalizeFingerprintValue;
178
+ private buildProductFingerprintItem;
179
+ private buildOrderProductsFingerprint;
180
+ private buildProductStructuralFingerprintItem;
181
+ private buildOrderProductsStructuralFingerprint;
182
+ private getOriginalSalesSnapshot;
183
+ private isSnapshotPayableAmountUnchanged;
184
+ private restoreOriginalSnapshotIfProductsUnchanged;
185
+ private clearPersistedAmountFieldsForFullRecalc;
79
186
  private getPaymentTargetAmount;
80
187
  ensureTempOrder(): OrderTempOrder;
81
188
  restoreOrder(): OrderTempOrder;
82
189
  getTempOrder(): OrderTempOrder | null;
190
+ replaceTempOrder(tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions): Promise<OrderTempOrder>;
83
191
  getOrderIdentity(): OrderIdentitySnapshot | null;
84
192
  getOrderSyncState(): OrderSyncState;
85
193
  getOrderAmountSnapshot(): OrderAmountSnapshot | null;
@@ -87,23 +195,71 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
87
195
  addNewOrder(): Promise<OrderTempOrder>;
88
196
  getOrderProducts(): OrderProduct[];
89
197
  private getProductUid;
198
+ private sanitizeOrderProductForTempOrder;
199
+ private sanitizeTempOrderProducts;
90
200
  private ensureExtend;
91
201
  private captureProductRuntime;
92
202
  private createLinkedProductAndBooking;
203
+ /**
204
+ * booking.holder 是提交真源;metadata.holder 作为详情/回显冗余字段同步保存。
205
+ *
206
+ * @example
207
+ * this.syncBookingMetadataHolder(booking, metadata);
208
+ */
209
+ private syncBookingMetadataHolder;
210
+ /**
211
+ * 从单条 booking 的 holder / metadata 中收集 holder form_record。
212
+ *
213
+ * @example
214
+ * const ids = this.collectBookingHolderRecords(booking);
215
+ */
216
+ private collectBookingHolderRecords;
217
+ /**
218
+ * 按 form_record 顺序读取 booking holder 的主字段名称。
219
+ *
220
+ * @example
221
+ * const names = this.collectBookingHolderNames(booking);
222
+ */
223
+ private collectBookingHolderNames;
224
+ /**
225
+ * 按老 ticketBooking `formatHolder` 语义汇总订单顶层 holder。
226
+ *
227
+ * @example
228
+ * const holder = this.buildTempOrderHolderFromBookings(tempOrder);
229
+ */
230
+ private buildTempOrderHolderFromBookings;
231
+ /**
232
+ * 将 booking 级 holder 汇总到 tempOrder 顶层 holder。
233
+ *
234
+ * @example
235
+ * this.syncTempOrderHolderFromBookings(tempOrder);
236
+ */
237
+ private syncTempOrderHolderFromBookings;
238
+ private getBookingUniqueIdentificationNumber;
239
+ private findBookingIndexByUniqueIdentificationNumber;
240
+ private removeLinkedBookingsForProduct;
93
241
  private getSalesSummary;
242
+ private applyOrderProductsDepositSummary;
94
243
  recalculateSummary(options?: {
95
244
  createIfMissing?: boolean;
96
245
  }): Promise<OrderSummary | null>;
97
246
  getOrderSummary(): Promise<OrderSummary>;
98
247
  updateTempOrderNote(note: string): string;
248
+ updateTempOrderNote(note: string, sync: true): Promise<string>;
249
+ updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
250
+ syncTempOrderNoteToRemote(orderId: number | string, note: string): Promise<string>;
99
251
  getTempOrderNote(): string;
100
252
  updateTempOrderShopDiscount(amount: string | number): string;
253
+ updateTempOrderDepositAmount(amount: string | number): OrderSummary;
101
254
  updateTempOrderBuzzer(buzzer: string): string;
102
255
  updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
256
+ private buildTempOrderCustomer;
257
+ private isCustomerBoundDiscount;
258
+ private clearCustomerBoundDiscounts;
103
259
  /**
104
260
  * 更新当前 tempOrder 的客户协议字段。
105
261
  *
106
- * PaymentModal 只需要修改订单里的客户字段;如果外部还有客户模块需要同步,
262
+ * PaymentModal 只需要修改订单里的客户事实;如果外部还有客户模块需要同步,
107
263
  * 应由调用方通过回调处理,不能把外部 UI 状态写进 tempOrder。
108
264
  */
109
265
  updateTempOrderCustomer(customer: UpdateTempOrderCustomerInput): OrderSnapshot['customer'];
@@ -146,15 +302,92 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
146
302
  */
147
303
  updateVoucherOrderPayments(payments: OrderPaymentSource[]): OrderPaymentData[];
148
304
  private shouldMergeProductToOrder;
305
+ private hasOrderProductLineNote;
306
+ /**
307
+ * 判断商品行是否显式绑定了 booking。
308
+ *
309
+ * @example
310
+ * this.hasLinkedBookingUid({ metadata: { booking_uid: 'booking-1' } });
311
+ */
312
+ private hasLinkedBookingUid;
313
+ /**
314
+ * 预约商品加车后的统一收尾:促销、折扣、summary 重算与持久化(批量拆行时只调用一次)。
315
+ *
316
+ * @example
317
+ * await this.finalizeProductOrderMutation(tempOrder);
318
+ */
319
+ private finalizeProductOrderMutation;
320
+ /**
321
+ * 向 tempOrder 追加一条商品行(及可选 booking),不触发 summary 重算。
322
+ * 带 booking 且 num>1 时由 `addProductToOrder` 拆成多次本方法调用(每次 num=1)。
323
+ *
324
+ * @example
325
+ * await this.appendProductLineToTempOrder(tempOrder, { product_id: 1, num: 1 }, booking);
326
+ */
327
+ private appendProductLineToTempOrder;
328
+ /**
329
+ * 添加商品行。带 booking 时强制独立行;num>1 时拆成多条 num=1 的 product+booking(对齐 BookingByStep / ticketBooking addService)。
330
+ *
331
+ * @example
332
+ * await order.addProductToOrder({ product_id: 1, num: 3 }, { start_time: '10:00' });
333
+ * // → tempOrder.products 新增 3 行,每行 num=1,bookings 3 条
334
+ */
149
335
  addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput): Promise<OrderProduct[]>;
336
+ /**
337
+ * 批量添加商品行,所有行追加完成后只触发一次促销、折扣、summary 重算与持久化。
338
+ *
339
+ * @example
340
+ * await order.addProductsToOrder([
341
+ * { product: { product_id: 1, product_variant_id: 0, num: 1 } },
342
+ * { product: { product_id: 2, product_variant_id: 0, num: 1 } },
343
+ * ]);
344
+ */
345
+ addProductsToOrder(items: Array<{
346
+ product: Partial<OrderProduct> & OrderProductIdentity;
347
+ booking?: AddProductBookingInput;
348
+ }>, options?: {
349
+ skipEditDiscountConfigRefresh?: boolean;
350
+ }): Promise<OrderProduct[]>;
150
351
  private hasGoodPassDiscount;
151
- updateProductInOrder(params: UpdateProductInOrderParams): Promise<OrderProduct[]>;
352
+ private getBundleRuntimeIdentity;
353
+ private preservePersistedBundlePriceFields;
354
+ updateOrderProduct(params: UpdateOrderProductParams): Promise<OrderProduct[]>;
355
+ updateOrderProductQuantity(params: UpdateOrderProductQuantityParams): Promise<OrderProduct[]>;
356
+ updateOrderBooking(params: UpdateOrderBookingParams): any[];
357
+ /**
358
+ * 商品行写路径收尾:促销 → 折扣 → 清洗 → summary → 持久化。
359
+ * 批量删除等多行变更场景只应调用一次,避免 N 次 applyPromotion。
360
+ *
361
+ * @example
362
+ * await this.finalizeAfterProductsMutation(tempOrder);
363
+ */
364
+ private finalizeAfterProductsMutation;
365
+ /**
366
+ * 批量按 identity 删除购物车行,末尾仅一次促销重算。
367
+ *
368
+ * @example
369
+ * await order.removeProductsFromOrder([identityA, identityB]);
370
+ */
371
+ removeProductsFromOrder(identities: OrderProductIdentity[]): Promise<OrderProduct[]>;
152
372
  removeProductFromOrder(identity: OrderProductIdentity): Promise<OrderProduct[]>;
373
+ /**
374
+ * 仅清空购物车行(products / bookings),不重置整单。
375
+ * 用于「仅清空商品」;客户、备注、支付等协议字段保持不变。
376
+ */
377
+ clearOrderCartLines(): Promise<OrderTempOrder>;
378
+ buildCurrentSubmitPayloadForLocalPrint(params?: {
379
+ cacheId?: string;
380
+ platform?: string;
381
+ businessCode?: string;
382
+ channel?: string;
383
+ type?: string;
384
+ }): import("./types").OrderSubmitPayload;
385
+ applyLocalPrintOrderNumbers(order?: Record<string, any> | null): Promise<OrderTempOrder>;
153
386
  /**
154
387
  * 提交当前 Sales tempOrder。
155
388
  *
156
389
  * smallTicketDataFlag 用于 B 端 checkout 小票数据返回。PaymentModal 在支付提交时
157
- * 应传 1,确保 /order/sales/checkout 返回打印所需数据。
390
+ * 应传 1,确保 /shop/order/sales/checkout 返回打印所需数据。
158
391
  */
159
392
  submitTempOrder<T = any>(params?: {
160
393
  cacheId?: string;
@@ -167,14 +400,29 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
167
400
  smallTicketDataFlag?: number;
168
401
  enhancePayload?: SubmitPayloadEnhancer;
169
402
  }): Promise<T>;
403
+ submitTempOrderAsync<T = any>(params?: {
404
+ cacheId?: string;
405
+ platform?: string;
406
+ businessCode?: string;
407
+ channel?: string;
408
+ type?: string;
409
+ payments?: OrderPaymentSource[];
410
+ paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
411
+ smallTicketDataFlag?: number;
412
+ enhancePayload?: SubmitPayloadEnhancer;
413
+ }): Promise<T>;
414
+ private runSubmitTempOrder;
170
415
  private markLocalOrderSynced;
416
+ private applyRemoteOrderNumbersToTempOrder;
171
417
  private isSubmitResponseRejected;
418
+ private isLocalPendingSubmitResult;
172
419
  private isSubmitErrorResponse;
173
420
  private extractSubmitErrorResponse;
174
421
  private logSubmitBackendRejected;
422
+ generateIdempotencyToken(): string;
175
423
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
176
424
  createOrder(params: CommitOrderParams['query']): {
177
- type: "virtual" | "appointment_booking";
425
+ type: "appointment_booking" | "virtual";
178
426
  platform: string;
179
427
  sales_channel: string;
180
428
  order_sales_channel: string;
@@ -196,7 +444,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
196
444
  * Checkout 专用:创建订单到后端
197
445
  *
198
446
  * 专门为 Checkout 模块设计的订单创建方法,
199
- * 直接调用 /order/checkout 接口创建订单
447
+ * 通过 OS Server 调用 checkout 接口创建订单
200
448
  * 接收已经处理好的订单数据,无需再处理购物车
201
449
  *
202
450
  * @param params Checkout 订单参数(已处理的订单数据)
@@ -211,7 +459,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
211
459
  * OrderModule 只负责校验 order_ids 并调用 /order/batch-email。
212
460
  */
213
461
  sendCustomerPayLink<T = any>(params: SendCustomerPayLinkParams): Promise<T>;
214
- getOrderInfoByRemote(order_id: number): Promise<any>;
462
+ getSalesOrderByLookup(params: {
463
+ lookup: number | string;
464
+ forceRemote?: boolean;
465
+ }): Promise<any>;
215
466
  /**
216
467
  * 把 sqlite / 后端返回的订单记录直接恢复为 tempOrder。
217
468
  *
@@ -221,8 +472,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
221
472
  hydrateTempOrderFromRecord(record: Record<string, any>, options?: {
222
473
  recalcOnHydrate?: boolean;
223
474
  }): Promise<OrderTempOrder>;
475
+ private normalizeTempOrderForRuntime;
476
+ private pickHydratedDisplayText;
477
+ private formatHydratedNamePair;
478
+ private buildHydratedProductOptionString;
479
+ private normalizeHydratedProductOptionItem;
224
480
  private normalizeHydratedOrderProduct;
225
481
  getLastOrderInfo(): Record<string, any> | undefined;
226
482
  getOrderInfo(order_id: number): Promise<any>;
227
483
  }
228
- export type { UpdateProductInOrderParams } from './types';
484
+ export type { UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';