@pisell/pisellos 2.2.244 → 2.2.246

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 (316) 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/BookingContext/index.d.ts +48 -0
  4. package/dist/modules/BookingContext/index.js +566 -0
  5. package/dist/modules/BookingContext/types.d.ts +102 -0
  6. package/dist/modules/BookingContext/types.js +51 -0
  7. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  8. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +284 -0
  9. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  10. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
  11. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  12. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +218 -0
  13. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  14. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  15. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  16. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  17. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  18. package/dist/modules/BookingContext/utils/index.js +11 -0
  19. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  20. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  21. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  22. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  23. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  24. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  25. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  26. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  27. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  28. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  29. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  30. package/dist/modules/BookingContext/utils/resources.js +486 -0
  31. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  32. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  33. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  34. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  35. package/dist/modules/Cart/utils/cartProduct.js +24 -3
  36. package/dist/modules/Cart/utils/changePrice.js +11 -11
  37. package/dist/modules/Customer/index.d.ts +20 -0
  38. package/dist/modules/Customer/index.js +172 -83
  39. package/dist/modules/Customer/types.d.ts +2 -0
  40. package/dist/modules/Discount/index.d.ts +1 -1
  41. package/dist/modules/Discount/index.js +13 -6
  42. package/dist/modules/Discount/types.d.ts +1 -0
  43. package/dist/modules/OpenData/index.d.ts +8 -0
  44. package/dist/modules/OpenData/index.js +37 -17
  45. package/dist/modules/Order/index.d.ts +277 -18
  46. package/dist/modules/Order/index.js +3581 -779
  47. package/dist/modules/Order/types.d.ts +286 -31
  48. package/dist/modules/Order/types.js +38 -0
  49. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  50. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  51. package/dist/modules/Order/utils.d.ts +147 -5
  52. package/dist/modules/Order/utils.js +750 -104
  53. package/dist/modules/Payment/index.d.ts +10 -13
  54. package/dist/modules/Payment/index.js +467 -837
  55. package/dist/modules/Payment/types.d.ts +2 -0
  56. package/dist/modules/Payment/utils.js +2 -1
  57. package/dist/modules/Payment/walletpass.js +41 -25
  58. package/dist/modules/ProductList/index.d.ts +16 -12
  59. package/dist/modules/ProductList/index.js +133 -59
  60. package/dist/modules/ProductList/types.d.ts +14 -0
  61. package/dist/modules/Quotation/index.d.ts +0 -1
  62. package/dist/modules/Quotation/index.js +25 -22
  63. package/dist/modules/Rules/index.d.ts +4 -0
  64. package/dist/modules/Rules/index.js +97 -70
  65. package/dist/modules/Rules/types.d.ts +1 -0
  66. package/dist/modules/SalesSummary/index.d.ts +8 -25
  67. package/dist/modules/SalesSummary/index.js +86 -35
  68. package/dist/modules/SalesSummary/types.d.ts +4 -1
  69. package/dist/modules/SalesSummary/utils.d.ts +2 -25
  70. package/dist/modules/SalesSummary/utils.js +794 -162
  71. package/dist/modules/Schedule/index.d.ts +7 -0
  72. package/dist/modules/Schedule/index.js +24 -2
  73. package/dist/modules/Summary/index.js +4 -3
  74. package/dist/modules/SurchargeList/index.d.ts +16 -0
  75. package/dist/modules/SurchargeList/index.js +162 -0
  76. package/dist/modules/SurchargeList/types.d.ts +11 -0
  77. package/dist/modules/SurchargeList/types.js +1 -0
  78. package/dist/modules/index.d.ts +2 -0
  79. package/dist/modules/index.js +3 -1
  80. package/dist/plugins/request.d.ts +1 -0
  81. package/dist/server/index.d.ts +204 -1
  82. package/dist/server/index.js +3654 -922
  83. package/dist/server/modules/index.d.ts +2 -0
  84. package/dist/server/modules/index.js +2 -0
  85. package/dist/server/modules/order/index.d.ts +120 -3
  86. package/dist/server/modules/order/index.js +1762 -448
  87. package/dist/server/modules/order/types.d.ts +32 -3
  88. package/dist/server/modules/order/types.js +8 -0
  89. package/dist/server/modules/order/utils/filterBookings.js +26 -3
  90. package/dist/server/modules/order/utils/filterOrders.js +23 -8
  91. package/dist/server/modules/payment/index.d.ts +28 -0
  92. package/dist/server/modules/payment/index.js +305 -0
  93. package/dist/server/modules/payment/types.d.ts +9 -0
  94. package/dist/server/modules/payment/types.js +1 -0
  95. package/dist/server/modules/products/index.d.ts +34 -7
  96. package/dist/server/modules/products/index.js +631 -317
  97. package/dist/server/modules/resource/index.d.ts +2 -0
  98. package/dist/server/modules/resource/index.js +29 -3
  99. package/dist/server/modules/schedule/index.d.ts +4 -4
  100. package/dist/server/modules/schedule/index.js +111 -88
  101. package/dist/server/test.json +713 -0
  102. package/dist/server/utils/small-ticket.d.ts +71 -0
  103. package/dist/server/utils/small-ticket.js +840 -0
  104. package/dist/solution/BaseSales/index.d.ts +133 -10
  105. package/dist/solution/BaseSales/index.js +1950 -447
  106. package/dist/solution/BaseSales/types.d.ts +82 -6
  107. package/dist/solution/BaseSales/types.js +5 -4
  108. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  109. package/dist/solution/BaseSales/utils/cartPromotion.js +1438 -0
  110. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  111. package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
  112. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  113. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +105 -24
  114. package/dist/solution/BaseSales/utils.d.ts +1 -1
  115. package/dist/solution/BaseSales/utils.js +62 -21
  116. package/dist/solution/BookingByStep/index.d.ts +1 -1
  117. package/dist/solution/BookingTicket/index.d.ts +271 -11
  118. package/dist/solution/BookingTicket/index.js +1777 -242
  119. package/dist/solution/BookingTicket/types.d.ts +118 -1
  120. package/dist/solution/BookingTicket/types.js +41 -2
  121. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  122. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  123. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  124. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  125. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  126. package/dist/solution/BookingTicket/utils/bookingStatus.js +70 -0
  127. package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
  128. package/dist/solution/BookingTicket/utils/cartView.js +94 -7
  129. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  130. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  131. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  132. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  133. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  134. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  135. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  136. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  137. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  138. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  139. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  140. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  141. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  142. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  143. package/dist/solution/Checkout/index.d.ts +1 -0
  144. package/dist/solution/Checkout/index.js +10 -9
  145. package/dist/solution/RegisterAndLogin/config.js +2 -10
  146. package/dist/solution/ScanOrder/index.d.ts +9 -3
  147. package/dist/solution/ScanOrder/index.js +241 -134
  148. package/dist/solution/ScanOrder/types.d.ts +9 -5
  149. package/dist/solution/ScanOrder/types.js +2 -3
  150. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  151. package/dist/solution/ScanOrder/utils.js +84 -22
  152. package/dist/solution/VenueBooking/index.d.ts +5 -2
  153. package/dist/solution/VenueBooking/index.js +110 -59
  154. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  155. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  156. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  157. package/dist/types/index.d.ts +10 -0
  158. package/lib/model/strategy/adapter/promotion/evaluator.js +2 -1
  159. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  160. package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
  161. package/lib/modules/BookingContext/index.d.ts +48 -0
  162. package/lib/modules/BookingContext/index.js +368 -0
  163. package/lib/modules/BookingContext/types.d.ts +102 -0
  164. package/lib/modules/BookingContext/types.js +34 -0
  165. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  166. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
  167. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  168. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +154 -0
  169. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  170. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +201 -0
  171. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  172. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  173. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  174. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  175. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  176. package/lib/modules/BookingContext/utils/index.js +43 -0
  177. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  178. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  179. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  180. package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
  181. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  182. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  183. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  184. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  185. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  186. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  187. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  188. package/lib/modules/BookingContext/utils/resources.js +377 -0
  189. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  190. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  191. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  192. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  193. package/lib/modules/Cart/utils/cartProduct.js +20 -3
  194. package/lib/modules/Cart/utils/changePrice.js +12 -20
  195. package/lib/modules/Customer/index.d.ts +20 -0
  196. package/lib/modules/Customer/index.js +64 -11
  197. package/lib/modules/Customer/types.d.ts +2 -0
  198. package/lib/modules/Discount/index.d.ts +1 -1
  199. package/lib/modules/Discount/index.js +9 -1
  200. package/lib/modules/Discount/types.d.ts +1 -0
  201. package/lib/modules/OpenData/index.d.ts +8 -0
  202. package/lib/modules/OpenData/index.js +19 -5
  203. package/lib/modules/Order/index.d.ts +277 -18
  204. package/lib/modules/Order/index.js +2317 -337
  205. package/lib/modules/Order/types.d.ts +286 -31
  206. package/lib/modules/Order/types.js +1 -0
  207. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  208. package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
  209. package/lib/modules/Order/utils.d.ts +147 -5
  210. package/lib/modules/Order/utils.js +615 -46
  211. package/lib/modules/Payment/index.d.ts +10 -13
  212. package/lib/modules/Payment/index.js +18 -150
  213. package/lib/modules/Payment/types.d.ts +2 -0
  214. package/lib/modules/Payment/utils.js +2 -1
  215. package/lib/modules/Payment/walletpass.js +16 -3
  216. package/lib/modules/ProductList/index.d.ts +16 -12
  217. package/lib/modules/ProductList/index.js +41 -4
  218. package/lib/modules/ProductList/types.d.ts +14 -0
  219. package/lib/modules/Quotation/index.d.ts +0 -1
  220. package/lib/modules/Quotation/index.js +19 -16
  221. package/lib/modules/Rules/index.d.ts +4 -0
  222. package/lib/modules/Rules/index.js +137 -120
  223. package/lib/modules/Rules/types.d.ts +1 -0
  224. package/lib/modules/SalesSummary/index.d.ts +8 -25
  225. package/lib/modules/SalesSummary/index.js +30 -4
  226. package/lib/modules/SalesSummary/types.d.ts +4 -1
  227. package/lib/modules/SalesSummary/utils.d.ts +2 -25
  228. package/lib/modules/SalesSummary/utils.js +645 -91
  229. package/lib/modules/Schedule/index.d.ts +7 -0
  230. package/lib/modules/Schedule/index.js +17 -1
  231. package/lib/modules/Summary/index.js +5 -4
  232. package/lib/modules/SurchargeList/index.d.ts +16 -0
  233. package/lib/modules/SurchargeList/index.js +89 -0
  234. package/lib/modules/SurchargeList/types.d.ts +11 -0
  235. package/lib/modules/SurchargeList/types.js +17 -0
  236. package/lib/modules/index.d.ts +2 -0
  237. package/lib/modules/index.js +5 -1
  238. package/lib/plugins/request.d.ts +1 -0
  239. package/lib/server/index.d.ts +204 -1
  240. package/lib/server/index.js +1891 -59
  241. package/lib/server/modules/index.d.ts +2 -0
  242. package/lib/server/modules/index.js +3 -0
  243. package/lib/server/modules/order/index.d.ts +120 -3
  244. package/lib/server/modules/order/index.js +887 -94
  245. package/lib/server/modules/order/types.d.ts +32 -3
  246. package/lib/server/modules/order/utils/filterBookings.js +24 -5
  247. package/lib/server/modules/order/utils/filterOrders.js +15 -6
  248. package/lib/server/modules/payment/index.d.ts +28 -0
  249. package/lib/server/modules/payment/index.js +192 -0
  250. package/lib/server/modules/payment/types.d.ts +9 -0
  251. package/lib/server/modules/payment/types.js +17 -0
  252. package/lib/server/modules/products/index.d.ts +34 -7
  253. package/lib/server/modules/products/index.js +189 -54
  254. package/lib/server/modules/resource/index.d.ts +2 -0
  255. package/lib/server/modules/resource/index.js +27 -3
  256. package/lib/server/modules/schedule/index.d.ts +4 -4
  257. package/lib/server/modules/schedule/index.js +47 -40
  258. package/lib/server/test.json +713 -0
  259. package/lib/server/utils/small-ticket.d.ts +71 -0
  260. package/lib/server/utils/small-ticket.js +800 -0
  261. package/lib/solution/BaseSales/index.d.ts +133 -10
  262. package/lib/solution/BaseSales/index.js +1111 -63
  263. package/lib/solution/BaseSales/types.d.ts +82 -6
  264. package/lib/solution/BaseSales/types.js +3 -1
  265. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  266. package/lib/solution/BaseSales/utils/cartPromotion.js +992 -0
  267. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  268. package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
  269. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  270. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +106 -18
  271. package/lib/solution/BaseSales/utils.d.ts +1 -1
  272. package/lib/solution/BaseSales/utils.js +54 -10
  273. package/lib/solution/BookingByStep/index.d.ts +1 -1
  274. package/lib/solution/BookingTicket/index.d.ts +271 -11
  275. package/lib/solution/BookingTicket/index.js +922 -29
  276. package/lib/solution/BookingTicket/types.d.ts +118 -1
  277. package/lib/solution/BookingTicket/types.js +11 -0
  278. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  279. package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
  280. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  281. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
  282. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  283. package/lib/solution/BookingTicket/utils/bookingStatus.js +44 -2
  284. package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
  285. package/lib/solution/BookingTicket/utils/cartView.js +61 -6
  286. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  287. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  288. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  289. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
  290. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  291. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
  292. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  293. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
  294. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  295. package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
  296. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  297. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
  298. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  299. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
  300. package/lib/solution/Checkout/index.d.ts +1 -0
  301. package/lib/solution/Checkout/index.js +1 -2
  302. package/lib/solution/RegisterAndLogin/config.js +2 -10
  303. package/lib/solution/ScanOrder/index.d.ts +9 -3
  304. package/lib/solution/ScanOrder/index.js +153 -70
  305. package/lib/solution/ScanOrder/types.d.ts +9 -5
  306. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  307. package/lib/solution/ScanOrder/utils.js +83 -17
  308. package/lib/solution/VenueBooking/index.d.ts +5 -2
  309. package/lib/solution/VenueBooking/index.js +54 -17
  310. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  311. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  312. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  313. package/lib/types/index.d.ts +10 -0
  314. package/package.json +1 -1
  315. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  316. 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,129 @@ 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 getManualDepositOverride;
183
+ private setManualDepositOverride;
184
+ private clearManualDepositOverride;
185
+ private getOriginalSalesSnapshot;
186
+ private isSnapshotPayableAmountUnchanged;
187
+ private restoreOriginalSnapshotIfProductsUnchanged;
188
+ private clearPersistedAmountFieldsForFullRecalc;
79
189
  private getPaymentTargetAmount;
80
190
  ensureTempOrder(): OrderTempOrder;
81
191
  restoreOrder(): OrderTempOrder;
82
192
  getTempOrder(): OrderTempOrder | null;
193
+ replaceTempOrder(tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions): Promise<OrderTempOrder>;
83
194
  getOrderIdentity(): OrderIdentitySnapshot | null;
84
195
  getOrderSyncState(): OrderSyncState;
85
196
  getOrderAmountSnapshot(): OrderAmountSnapshot | null;
@@ -87,23 +198,71 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
87
198
  addNewOrder(): Promise<OrderTempOrder>;
88
199
  getOrderProducts(): OrderProduct[];
89
200
  private getProductUid;
201
+ private sanitizeOrderProductForTempOrder;
202
+ private sanitizeTempOrderProducts;
90
203
  private ensureExtend;
91
204
  private captureProductRuntime;
92
205
  private createLinkedProductAndBooking;
206
+ /**
207
+ * booking.holder 是提交真源;metadata.holder 作为详情/回显冗余字段同步保存。
208
+ *
209
+ * @example
210
+ * this.syncBookingMetadataHolder(booking, metadata);
211
+ */
212
+ private syncBookingMetadataHolder;
213
+ /**
214
+ * 从单条 booking 的 holder / metadata 中收集 holder form_record。
215
+ *
216
+ * @example
217
+ * const ids = this.collectBookingHolderRecords(booking);
218
+ */
219
+ private collectBookingHolderRecords;
220
+ /**
221
+ * 按 form_record 顺序读取 booking holder 的主字段名称。
222
+ *
223
+ * @example
224
+ * const names = this.collectBookingHolderNames(booking);
225
+ */
226
+ private collectBookingHolderNames;
227
+ /**
228
+ * 按老 ticketBooking `formatHolder` 语义汇总订单顶层 holder。
229
+ *
230
+ * @example
231
+ * const holder = this.buildTempOrderHolderFromBookings(tempOrder);
232
+ */
233
+ private buildTempOrderHolderFromBookings;
234
+ /**
235
+ * 将 booking 级 holder 汇总到 tempOrder 顶层 holder。
236
+ *
237
+ * @example
238
+ * this.syncTempOrderHolderFromBookings(tempOrder);
239
+ */
240
+ private syncTempOrderHolderFromBookings;
241
+ private getBookingUniqueIdentificationNumber;
242
+ private findBookingIndexByUniqueIdentificationNumber;
243
+ private removeLinkedBookingsForProduct;
93
244
  private getSalesSummary;
245
+ private applyOrderProductsDepositSummary;
94
246
  recalculateSummary(options?: {
95
247
  createIfMissing?: boolean;
96
248
  }): Promise<OrderSummary | null>;
97
249
  getOrderSummary(): Promise<OrderSummary>;
98
250
  updateTempOrderNote(note: string): string;
251
+ updateTempOrderNote(note: string, sync: true): Promise<string>;
252
+ updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
253
+ syncTempOrderNoteToRemote(orderId: number | string, note: string): Promise<string>;
99
254
  getTempOrderNote(): string;
100
255
  updateTempOrderShopDiscount(amount: string | number): string;
256
+ updateTempOrderDepositAmount(amount: string | number): OrderSummary;
101
257
  updateTempOrderBuzzer(buzzer: string): string;
102
258
  updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
259
+ private buildTempOrderCustomer;
260
+ private isCustomerBoundDiscount;
261
+ private clearCustomerBoundDiscounts;
103
262
  /**
104
263
  * 更新当前 tempOrder 的客户协议字段。
105
264
  *
106
- * PaymentModal 只需要修改订单里的客户字段;如果外部还有客户模块需要同步,
265
+ * PaymentModal 只需要修改订单里的客户事实;如果外部还有客户模块需要同步,
107
266
  * 应由调用方通过回调处理,不能把外部 UI 状态写进 tempOrder。
108
267
  */
109
268
  updateTempOrderCustomer(customer: UpdateTempOrderCustomerInput): OrderSnapshot['customer'];
@@ -146,15 +305,92 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
146
305
  */
147
306
  updateVoucherOrderPayments(payments: OrderPaymentSource[]): OrderPaymentData[];
148
307
  private shouldMergeProductToOrder;
308
+ private hasOrderProductLineNote;
309
+ /**
310
+ * 判断商品行是否显式绑定了 booking。
311
+ *
312
+ * @example
313
+ * this.hasLinkedBookingUid({ metadata: { booking_uid: 'booking-1' } });
314
+ */
315
+ private hasLinkedBookingUid;
316
+ /**
317
+ * 预约商品加车后的统一收尾:促销、折扣、summary 重算与持久化(批量拆行时只调用一次)。
318
+ *
319
+ * @example
320
+ * await this.finalizeProductOrderMutation(tempOrder);
321
+ */
322
+ private finalizeProductOrderMutation;
323
+ /**
324
+ * 向 tempOrder 追加一条商品行(及可选 booking),不触发 summary 重算。
325
+ * 带 booking 且 num>1 时由 `addProductToOrder` 拆成多次本方法调用(每次 num=1)。
326
+ *
327
+ * @example
328
+ * await this.appendProductLineToTempOrder(tempOrder, { product_id: 1, num: 1 }, booking);
329
+ */
330
+ private appendProductLineToTempOrder;
331
+ /**
332
+ * 添加商品行。带 booking 时强制独立行;num>1 时拆成多条 num=1 的 product+booking(对齐 BookingByStep / ticketBooking addService)。
333
+ *
334
+ * @example
335
+ * await order.addProductToOrder({ product_id: 1, num: 3 }, { start_time: '10:00' });
336
+ * // → tempOrder.products 新增 3 行,每行 num=1,bookings 3 条
337
+ */
149
338
  addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput): Promise<OrderProduct[]>;
339
+ /**
340
+ * 批量添加商品行,所有行追加完成后只触发一次促销、折扣、summary 重算与持久化。
341
+ *
342
+ * @example
343
+ * await order.addProductsToOrder([
344
+ * { product: { product_id: 1, product_variant_id: 0, num: 1 } },
345
+ * { product: { product_id: 2, product_variant_id: 0, num: 1 } },
346
+ * ]);
347
+ */
348
+ addProductsToOrder(items: Array<{
349
+ product: Partial<OrderProduct> & OrderProductIdentity;
350
+ booking?: AddProductBookingInput;
351
+ }>, options?: {
352
+ skipEditDiscountConfigRefresh?: boolean;
353
+ }): Promise<OrderProduct[]>;
150
354
  private hasGoodPassDiscount;
151
- updateProductInOrder(params: UpdateProductInOrderParams): Promise<OrderProduct[]>;
355
+ private getBundleRuntimeIdentity;
356
+ private preservePersistedBundlePriceFields;
357
+ updateOrderProduct(params: UpdateOrderProductParams): Promise<OrderProduct[]>;
358
+ updateOrderProductQuantity(params: UpdateOrderProductQuantityParams): Promise<OrderProduct[]>;
359
+ updateOrderBooking(params: UpdateOrderBookingParams): any[];
360
+ /**
361
+ * 商品行写路径收尾:促销 → 折扣 → 清洗 → summary → 持久化。
362
+ * 批量删除等多行变更场景只应调用一次,避免 N 次 applyPromotion。
363
+ *
364
+ * @example
365
+ * await this.finalizeAfterProductsMutation(tempOrder);
366
+ */
367
+ private finalizeAfterProductsMutation;
368
+ /**
369
+ * 批量按 identity 删除购物车行,末尾仅一次促销重算。
370
+ *
371
+ * @example
372
+ * await order.removeProductsFromOrder([identityA, identityB]);
373
+ */
374
+ removeProductsFromOrder(identities: OrderProductIdentity[]): Promise<OrderProduct[]>;
152
375
  removeProductFromOrder(identity: OrderProductIdentity): Promise<OrderProduct[]>;
376
+ /**
377
+ * 仅清空购物车行(products / bookings),不重置整单。
378
+ * 用于「仅清空商品」;客户、备注、支付等协议字段保持不变。
379
+ */
380
+ clearOrderCartLines(): Promise<OrderTempOrder>;
381
+ buildCurrentSubmitPayloadForLocalPrint(params?: {
382
+ cacheId?: string;
383
+ platform?: string;
384
+ businessCode?: string;
385
+ channel?: string;
386
+ type?: string;
387
+ }): import("./types").OrderSubmitPayload;
388
+ applyLocalPrintOrderNumbers(order?: Record<string, any> | null): Promise<OrderTempOrder>;
153
389
  /**
154
390
  * 提交当前 Sales tempOrder。
155
391
  *
156
392
  * smallTicketDataFlag 用于 B 端 checkout 小票数据返回。PaymentModal 在支付提交时
157
- * 应传 1,确保 /order/sales/checkout 返回打印所需数据。
393
+ * 应传 1,确保 /shop/order/sales/checkout 返回打印所需数据。
158
394
  */
159
395
  submitTempOrder<T = any>(params?: {
160
396
  cacheId?: string;
@@ -167,11 +403,26 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
167
403
  smallTicketDataFlag?: number;
168
404
  enhancePayload?: SubmitPayloadEnhancer;
169
405
  }): Promise<T>;
406
+ submitTempOrderAsync<T = any>(params?: {
407
+ cacheId?: string;
408
+ platform?: string;
409
+ businessCode?: string;
410
+ channel?: string;
411
+ type?: string;
412
+ payments?: OrderPaymentSource[];
413
+ paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
414
+ smallTicketDataFlag?: number;
415
+ enhancePayload?: SubmitPayloadEnhancer;
416
+ }): Promise<T>;
417
+ private runSubmitTempOrder;
170
418
  private markLocalOrderSynced;
419
+ private applyRemoteOrderNumbersToTempOrder;
171
420
  private isSubmitResponseRejected;
421
+ private isLocalPendingSubmitResult;
172
422
  private isSubmitErrorResponse;
173
423
  private extractSubmitErrorResponse;
174
424
  private logSubmitBackendRejected;
425
+ generateIdempotencyToken(): string;
175
426
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
176
427
  createOrder(params: CommitOrderParams['query']): {
177
428
  type: "virtual" | "appointment_booking";
@@ -196,7 +447,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
196
447
  * Checkout 专用:创建订单到后端
197
448
  *
198
449
  * 专门为 Checkout 模块设计的订单创建方法,
199
- * 直接调用 /order/checkout 接口创建订单
450
+ * 通过 OS Server 调用 checkout 接口创建订单
200
451
  * 接收已经处理好的订单数据,无需再处理购物车
201
452
  *
202
453
  * @param params Checkout 订单参数(已处理的订单数据)
@@ -211,7 +462,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
211
462
  * OrderModule 只负责校验 order_ids 并调用 /order/batch-email。
212
463
  */
213
464
  sendCustomerPayLink<T = any>(params: SendCustomerPayLinkParams): Promise<T>;
214
- getOrderInfoByRemote(order_id: number): Promise<any>;
465
+ getSalesOrderByLookup(params: {
466
+ lookup: number | string;
467
+ forceRemote?: boolean;
468
+ }): Promise<any>;
215
469
  /**
216
470
  * 把 sqlite / 后端返回的订单记录直接恢复为 tempOrder。
217
471
  *
@@ -221,8 +475,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
221
475
  hydrateTempOrderFromRecord(record: Record<string, any>, options?: {
222
476
  recalcOnHydrate?: boolean;
223
477
  }): Promise<OrderTempOrder>;
478
+ private normalizeTempOrderForRuntime;
479
+ private pickHydratedDisplayText;
480
+ private formatHydratedNamePair;
481
+ private buildHydratedProductOptionString;
482
+ private normalizeHydratedProductOptionItem;
224
483
  private normalizeHydratedOrderProduct;
225
484
  getLastOrderInfo(): Record<string, any> | undefined;
226
485
  getOrderInfo(order_id: number): Promise<any>;
227
486
  }
228
- export type { UpdateProductInOrderParams } from './types';
487
+ export type { UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';