@pisell/pisellos 2.2.243 → 2.2.244

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (315) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +2 -3
  2. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  3. package/dist/model/strategy/adapter/walletPass/utils.js +4 -7
  4. package/dist/modules/Cart/utils/cartProduct.js +3 -24
  5. package/dist/modules/Cart/utils/changePrice.js +11 -11
  6. package/dist/modules/Customer/index.d.ts +0 -20
  7. package/dist/modules/Customer/index.js +83 -172
  8. package/dist/modules/Customer/types.d.ts +0 -2
  9. package/dist/modules/Discount/index.js +3 -4
  10. package/dist/modules/Discount/types.d.ts +0 -1
  11. package/dist/modules/OpenData/index.d.ts +0 -8
  12. package/dist/modules/OpenData/index.js +17 -37
  13. package/dist/modules/Order/index.d.ts +18 -268
  14. package/dist/modules/Order/index.js +757 -3306
  15. package/dist/modules/Order/types.d.ts +31 -279
  16. package/dist/modules/Order/types.js +0 -38
  17. package/dist/modules/Order/utils.d.ts +5 -147
  18. package/dist/modules/Order/utils.js +103 -746
  19. package/dist/modules/Payment/index.d.ts +13 -10
  20. package/dist/modules/Payment/index.js +837 -467
  21. package/dist/modules/Payment/types.d.ts +0 -2
  22. package/dist/modules/Payment/utils.js +1 -2
  23. package/dist/modules/Payment/walletpass.js +7 -14
  24. package/dist/modules/ProductList/index.d.ts +12 -16
  25. package/dist/modules/ProductList/index.js +59 -133
  26. package/dist/modules/ProductList/types.d.ts +0 -14
  27. package/dist/modules/Quotation/index.d.ts +1 -0
  28. package/dist/modules/Quotation/index.js +22 -25
  29. package/dist/modules/Rules/index.d.ts +0 -4
  30. package/dist/modules/Rules/index.js +69 -93
  31. package/dist/modules/Rules/types.d.ts +0 -1
  32. package/dist/modules/SalesSummary/index.d.ts +25 -8
  33. package/dist/modules/SalesSummary/index.js +35 -86
  34. package/dist/modules/SalesSummary/types.d.ts +1 -4
  35. package/dist/modules/SalesSummary/utils.d.ts +25 -2
  36. package/dist/modules/SalesSummary/utils.js +162 -794
  37. package/dist/modules/Schedule/index.d.ts +0 -7
  38. package/dist/modules/Schedule/index.js +2 -24
  39. package/dist/modules/Summary/index.js +3 -4
  40. package/dist/modules/index.d.ts +0 -2
  41. package/dist/modules/index.js +1 -3
  42. package/dist/plugins/request.d.ts +0 -1
  43. package/dist/server/index.d.ts +1 -204
  44. package/dist/server/index.js +928 -3658
  45. package/dist/server/modules/index.d.ts +0 -2
  46. package/dist/server/modules/index.js +0 -2
  47. package/dist/server/modules/order/index.d.ts +4 -120
  48. package/dist/server/modules/order/index.js +483 -1779
  49. package/dist/server/modules/order/types.d.ts +3 -32
  50. package/dist/server/modules/order/types.js +0 -8
  51. package/dist/server/modules/order/utils/filterBookings.js +3 -26
  52. package/dist/server/modules/order/utils/filterOrders.js +8 -23
  53. package/dist/server/modules/products/index.d.ts +7 -34
  54. package/dist/server/modules/products/index.js +317 -631
  55. package/dist/server/modules/resource/index.d.ts +0 -2
  56. package/dist/server/modules/resource/index.js +3 -29
  57. package/dist/server/modules/schedule/index.d.ts +4 -4
  58. package/dist/server/modules/schedule/index.js +88 -111
  59. package/dist/solution/BaseSales/index.d.ts +9 -131
  60. package/dist/solution/BaseSales/index.js +447 -1944
  61. package/dist/solution/BaseSales/types.d.ts +6 -76
  62. package/dist/solution/BaseSales/types.js +4 -5
  63. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
  64. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +24 -105
  65. package/dist/solution/BaseSales/utils.d.ts +1 -1
  66. package/dist/solution/BaseSales/utils.js +21 -62
  67. package/dist/solution/BookingByStep/index.d.ts +1 -1
  68. package/dist/solution/BookingTicket/index.d.ts +10 -270
  69. package/dist/solution/BookingTicket/index.js +237 -1772
  70. package/dist/solution/BookingTicket/types.d.ts +1 -118
  71. package/dist/solution/BookingTicket/types.js +2 -41
  72. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
  73. package/dist/solution/BookingTicket/utils/bookingStatus.js +0 -70
  74. package/dist/solution/BookingTicket/utils/cartView.d.ts +1 -9
  75. package/dist/solution/BookingTicket/utils/cartView.js +7 -94
  76. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -5
  77. package/dist/solution/BookingTicket/utils/scan/index.js +8 -20
  78. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  79. package/dist/solution/Checkout/index.d.ts +0 -1
  80. package/dist/solution/Checkout/index.js +9 -10
  81. package/dist/solution/RegisterAndLogin/config.js +10 -2
  82. package/dist/solution/ScanOrder/index.d.ts +3 -9
  83. package/dist/solution/ScanOrder/index.js +134 -241
  84. package/dist/solution/ScanOrder/types.d.ts +5 -9
  85. package/dist/solution/ScanOrder/types.js +3 -2
  86. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  87. package/dist/solution/ScanOrder/utils.js +22 -84
  88. package/dist/solution/VenueBooking/index.d.ts +2 -5
  89. package/dist/solution/VenueBooking/index.js +59 -110
  90. package/dist/solution/VenueBooking/sales-section-4-annotated.json +2 -0
  91. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  92. package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
  93. package/dist/types/index.d.ts +0 -10
  94. package/lib/model/strategy/adapter/promotion/evaluator.js +1 -2
  95. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  96. package/lib/model/strategy/adapter/walletPass/utils.js +2 -3
  97. package/lib/modules/Cart/utils/cartProduct.js +3 -20
  98. package/lib/modules/Cart/utils/changePrice.js +20 -12
  99. package/lib/modules/Customer/index.d.ts +0 -20
  100. package/lib/modules/Customer/index.js +11 -64
  101. package/lib/modules/Customer/types.d.ts +0 -2
  102. package/lib/modules/Discount/index.js +1 -5
  103. package/lib/modules/Discount/types.d.ts +0 -1
  104. package/lib/modules/OpenData/index.d.ts +0 -8
  105. package/lib/modules/OpenData/index.js +5 -19
  106. package/lib/modules/Order/index.d.ts +18 -268
  107. package/lib/modules/Order/index.js +344 -2149
  108. package/lib/modules/Order/types.d.ts +31 -279
  109. package/lib/modules/Order/types.js +0 -1
  110. package/lib/modules/Order/utils.d.ts +5 -147
  111. package/lib/modules/Order/utils.js +46 -614
  112. package/lib/modules/Payment/index.d.ts +13 -10
  113. package/lib/modules/Payment/index.js +150 -18
  114. package/lib/modules/Payment/types.d.ts +0 -2
  115. package/lib/modules/Payment/utils.js +1 -2
  116. package/lib/modules/Payment/walletpass.js +3 -7
  117. package/lib/modules/ProductList/index.d.ts +12 -16
  118. package/lib/modules/ProductList/index.js +4 -41
  119. package/lib/modules/ProductList/types.d.ts +0 -14
  120. package/lib/modules/Quotation/index.d.ts +1 -0
  121. package/lib/modules/Quotation/index.js +16 -19
  122. package/lib/modules/Rules/index.d.ts +0 -4
  123. package/lib/modules/Rules/index.js +120 -136
  124. package/lib/modules/Rules/types.d.ts +0 -1
  125. package/lib/modules/SalesSummary/index.d.ts +25 -8
  126. package/lib/modules/SalesSummary/index.js +4 -30
  127. package/lib/modules/SalesSummary/types.d.ts +1 -4
  128. package/lib/modules/SalesSummary/utils.d.ts +25 -2
  129. package/lib/modules/SalesSummary/utils.js +91 -645
  130. package/lib/modules/Schedule/index.d.ts +0 -7
  131. package/lib/modules/Schedule/index.js +1 -17
  132. package/lib/modules/Summary/index.js +4 -5
  133. package/lib/modules/index.d.ts +0 -2
  134. package/lib/modules/index.js +1 -5
  135. package/lib/plugins/request.d.ts +0 -1
  136. package/lib/server/index.d.ts +1 -204
  137. package/lib/server/index.js +57 -1888
  138. package/lib/server/modules/index.d.ts +0 -2
  139. package/lib/server/modules/index.js +0 -3
  140. package/lib/server/modules/order/index.d.ts +4 -120
  141. package/lib/server/modules/order/index.js +142 -919
  142. package/lib/server/modules/order/types.d.ts +3 -32
  143. package/lib/server/modules/order/utils/filterBookings.js +5 -24
  144. package/lib/server/modules/order/utils/filterOrders.js +6 -15
  145. package/lib/server/modules/products/index.d.ts +7 -34
  146. package/lib/server/modules/products/index.js +54 -189
  147. package/lib/server/modules/resource/index.d.ts +0 -2
  148. package/lib/server/modules/resource/index.js +3 -27
  149. package/lib/server/modules/schedule/index.d.ts +4 -4
  150. package/lib/server/modules/schedule/index.js +40 -47
  151. package/lib/solution/BaseSales/index.d.ts +9 -131
  152. package/lib/solution/BaseSales/index.js +63 -1106
  153. package/lib/solution/BaseSales/types.d.ts +6 -76
  154. package/lib/solution/BaseSales/types.js +1 -3
  155. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
  156. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +18 -106
  157. package/lib/solution/BaseSales/utils.d.ts +1 -1
  158. package/lib/solution/BaseSales/utils.js +10 -54
  159. package/lib/solution/BookingByStep/index.d.ts +1 -1
  160. package/lib/solution/BookingTicket/index.d.ts +10 -270
  161. package/lib/solution/BookingTicket/index.js +29 -922
  162. package/lib/solution/BookingTicket/types.d.ts +1 -118
  163. package/lib/solution/BookingTicket/types.js +0 -11
  164. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
  165. package/lib/solution/BookingTicket/utils/bookingStatus.js +2 -44
  166. package/lib/solution/BookingTicket/utils/cartView.d.ts +1 -9
  167. package/lib/solution/BookingTicket/utils/cartView.js +6 -61
  168. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -5
  169. package/lib/solution/BookingTicket/utils/scan/index.js +3 -17
  170. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  171. package/lib/solution/Checkout/index.d.ts +0 -1
  172. package/lib/solution/Checkout/index.js +2 -1
  173. package/lib/solution/RegisterAndLogin/config.js +10 -2
  174. package/lib/solution/ScanOrder/index.d.ts +3 -9
  175. package/lib/solution/ScanOrder/index.js +70 -153
  176. package/lib/solution/ScanOrder/types.d.ts +5 -9
  177. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  178. package/lib/solution/ScanOrder/utils.js +17 -83
  179. package/lib/solution/VenueBooking/index.d.ts +2 -5
  180. package/lib/solution/VenueBooking/index.js +17 -54
  181. package/lib/solution/VenueBooking/sales-section-4-annotated.json +2 -0
  182. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  183. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
  184. package/lib/types/index.d.ts +0 -10
  185. package/package.json +1 -1
  186. package/dist/modules/BookingContext/index.d.ts +0 -48
  187. package/dist/modules/BookingContext/index.js +0 -566
  188. package/dist/modules/BookingContext/types.d.ts +0 -102
  189. package/dist/modules/BookingContext/types.js +0 -51
  190. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  191. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -284
  192. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  193. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -145
  194. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  195. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -218
  196. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
  197. package/dist/modules/BookingContext/utils/flexible.js +0 -56
  198. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  199. package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
  200. package/dist/modules/BookingContext/utils/index.d.ts +0 -11
  201. package/dist/modules/BookingContext/utils/index.js +0 -11
  202. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
  203. package/dist/modules/BookingContext/utils/noResource.js +0 -77
  204. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  205. package/dist/modules/BookingContext/utils/orderLineDisplay.js +0 -36
  206. package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
  207. package/dist/modules/BookingContext/utils/productExtend.js +0 -339
  208. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  209. package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
  210. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  211. package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
  212. package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
  213. package/dist/modules/BookingContext/utils/resources.js +0 -486
  214. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  215. package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
  216. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  217. package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
  218. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  219. package/dist/modules/Order/utils/manualProductDiscount.js +0 -210
  220. package/dist/modules/SurchargeList/index.d.ts +0 -16
  221. package/dist/modules/SurchargeList/index.js +0 -162
  222. package/dist/modules/SurchargeList/types.d.ts +0 -11
  223. package/dist/modules/SurchargeList/types.js +0 -1
  224. package/dist/server/modules/payment/index.d.ts +0 -28
  225. package/dist/server/modules/payment/index.js +0 -305
  226. package/dist/server/modules/payment/types.d.ts +0 -9
  227. package/dist/server/modules/payment/types.js +0 -1
  228. package/dist/server/test.json +0 -713
  229. package/dist/server/utils/small-ticket.d.ts +0 -71
  230. package/dist/server/utils/small-ticket.js +0 -830
  231. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
  232. package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1438
  233. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  234. package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
  235. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
  236. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
  237. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
  238. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +0 -95
  239. package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  240. package/dist/solution/BookingTicket/utils/exampleData.js +0 -183
  241. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  242. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -438
  243. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
  244. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -399
  245. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
  246. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -56
  247. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  248. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +0 -150
  249. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
  250. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +0 -78
  251. package/lib/modules/BookingContext/index.d.ts +0 -48
  252. package/lib/modules/BookingContext/index.js +0 -368
  253. package/lib/modules/BookingContext/types.d.ts +0 -102
  254. package/lib/modules/BookingContext/types.js +0 -34
  255. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  256. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -276
  257. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  258. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -151
  259. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  260. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -201
  261. package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
  262. package/lib/modules/BookingContext/utils/flexible.js +0 -80
  263. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  264. package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
  265. package/lib/modules/BookingContext/utils/index.d.ts +0 -11
  266. package/lib/modules/BookingContext/utils/index.js +0 -43
  267. package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
  268. package/lib/modules/BookingContext/utils/noResource.js +0 -90
  269. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  270. package/lib/modules/BookingContext/utils/orderLineDisplay.js +0 -56
  271. package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
  272. package/lib/modules/BookingContext/utils/productExtend.js +0 -283
  273. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  274. package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
  275. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  276. package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
  277. package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
  278. package/lib/modules/BookingContext/utils/resources.js +0 -377
  279. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  280. package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
  281. package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  282. package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
  283. package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  284. package/lib/modules/Order/utils/manualProductDiscount.js +0 -206
  285. package/lib/modules/SurchargeList/index.d.ts +0 -16
  286. package/lib/modules/SurchargeList/index.js +0 -89
  287. package/lib/modules/SurchargeList/types.d.ts +0 -11
  288. package/lib/modules/SurchargeList/types.js +0 -17
  289. package/lib/server/modules/payment/index.d.ts +0 -28
  290. package/lib/server/modules/payment/index.js +0 -192
  291. package/lib/server/modules/payment/types.d.ts +0 -9
  292. package/lib/server/modules/payment/types.js +0 -17
  293. package/lib/server/test.json +0 -713
  294. package/lib/server/utils/small-ticket.d.ts +0 -71
  295. package/lib/server/utils/small-ticket.js +0 -781
  296. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
  297. package/lib/solution/BaseSales/utils/cartPromotion.js +0 -992
  298. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  299. package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
  300. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
  301. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
  302. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
  303. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +0 -125
  304. package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  305. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  306. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  307. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -254
  308. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
  309. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -168
  310. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
  311. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -51
  312. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  313. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +0 -127
  314. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
  315. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +0 -85
@@ -89,45 +89,13 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
89
89
  moduleName: "scanOrder"
90
90
  };
91
91
  }
92
- safeStringify(value) {
93
- try {
94
- return JSON.stringify(value);
95
- } catch {
96
- return void 0;
97
- }
98
- }
99
- pickErrorMessage(error) {
100
- var _a, _b, _c, _d;
101
- const candidates = [
102
- error.message,
103
- (_a = error.data) == null ? void 0 : _a.message,
104
- (_c = (_b = error.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message,
105
- (_d = error.error) == null ? void 0 : _d.message
106
- ];
107
- for (const candidate of candidates) {
108
- if (typeof candidate === "string" && candidate.trim())
109
- return candidate;
110
- }
111
- return void 0;
112
- }
113
92
  serializeError(error) {
114
93
  if (error instanceof Error) {
115
- return {
94
+ return JSON.stringify({
116
95
  name: error.name,
117
96
  message: error.message,
118
97
  stack: error.stack
119
- };
120
- }
121
- if (error && typeof error === "object") {
122
- const raw = error;
123
- const message = this.pickErrorMessage(raw) || this.safeStringify(raw) || String(error);
124
- return {
125
- ...typeof raw.name === "string" ? { name: raw.name } : {},
126
- message,
127
- ..."code" in raw ? { code: raw.code } : {},
128
- ..."status" in raw ? { status: raw.status } : {},
129
- ...this.safeStringify(raw) ? { raw: this.safeStringify(raw) } : {}
130
- };
98
+ });
131
99
  }
132
100
  return {
133
101
  message: String(error)
@@ -187,14 +155,6 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
187
155
  }
188
156
  });
189
157
  }
190
- assertProductListLoaded(method, result, payload = {}) {
191
- if (Array.isArray(result))
192
- return result;
193
- const error = result instanceof Error ? result : new Error("商品列表接口返回异常");
194
- this.logMethodError(method, error, payload);
195
- error.__scanOrderLogged = true;
196
- throw error;
197
- }
198
158
  async addLog(params) {
199
159
  await this.addScanOrderLog({
200
160
  ...params,
@@ -359,13 +319,13 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
359
319
  if (targetModule) {
360
320
  this.store[step] = targetModule;
361
321
  const initialState = step === "salesSummary" ? {
322
+ // TODO(Order types): ScanOrder runtime should read OrderState.summary instead of tempOrder.summary.
362
323
  summary: ((_b2 = (_a2 = this.store.order) == null ? void 0 : _a2.getTempOrder()) == null ? void 0 : _b2.summary) || (0, import_utils.createEmptySummary)()
363
324
  } : {};
364
325
  const loggerProvider = ((_c2 = this.otherParams) == null ? void 0 : _c2.scanOrderLoggerProvider) || "feishu";
365
326
  const loggerConfig = ((_d2 = this.otherParams) == null ? void 0 : _d2.scanOrderLoggerConfig) || {
366
327
  feishu: {
367
- webhook: "https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed",
368
- errorHook: "https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f"
328
+ webhook: "https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed"
369
329
  }
370
330
  };
371
331
  this.core.registerModule(targetModule, {
@@ -751,7 +711,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
751
711
  (sum, pd) => sum + (pd.amount || 0),
752
712
  0
753
713
  );
754
- const optionSum = (0, import_utils2.sumOptionUnitPrice)((0, import_utils2.getProductSkuOptions)(product));
714
+ const optionSum = (0, import_utils2.sumOptionUnitPrice)(product.product_option_item);
755
715
  const sourcePrice = ((_d = product.metadata) == null ? void 0 : _d.source_product_price) ?? (((_e = product.metadata) == null ? void 0 : _e.main_product_original_price) != null ? new import_decimal.default(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : product.original_price ?? "0");
756
716
  const newSourceSellingPrice = new import_decimal.default(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
757
717
  const newMainSellingPrice = new import_decimal.default(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
@@ -787,34 +747,6 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
787
747
  throw error;
788
748
  }
789
749
  }
790
- findReservationRuleResource(formId) {
791
- var _a;
792
- if (formId == null)
793
- return void 0;
794
- const numericFormId = Number(formId);
795
- if (!Number.isFinite(numericFormId) || numericFormId <= 0)
796
- return void 0;
797
- for (const product of this.enabledReservationRuleProducts) {
798
- const resources = (_a = product == null ? void 0 : product.product_resource) == null ? void 0 : _a.resources;
799
- if (!Array.isArray(resources))
800
- continue;
801
- const matched = resources.find((resource) => Number(resource == null ? void 0 : resource.id) === numericFormId);
802
- if (matched)
803
- return matched;
804
- }
805
- return void 0;
806
- }
807
- buildScanOrderResourceMetadata(params) {
808
- const { resourceState, resourceName } = params;
809
- const ruleResource = this.findReservationRuleResource(resourceState.tableFormId);
810
- const combined = ruleResource == null ? void 0 : ruleResource.combined_resource;
811
- const isCombined = !!(combined && combined.status === 1 && Array.isArray(combined.resource_ids));
812
- return {
813
- form_name: (ruleResource == null ? void 0 : ruleResource.title) ?? "",
814
- resource_name: resourceName,
815
- combined_resource: isCombined ? combined : null
816
- };
817
- }
818
750
  // ScanOrder 提交 payload enhancer:
819
751
  // - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
820
752
  // - 给所有 booking 的 metadata 注入 resource_select_type(来自预约规则商品的 resource.type)
@@ -838,9 +770,6 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
838
770
  return (payload, { bookingUuid, tempOrder }) => {
839
771
  var _a, _b;
840
772
  const resourceId = tempOrder.resource_id ?? (resourceState == null ? void 0 : resourceState.relationId);
841
- const rawCollectPax = (_a = tempOrder.metadata) == null ? void 0 : _a.collect_pax;
842
- const hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== void 0 && rawCollectPax !== "";
843
- const resourceCapacityValue = hasCollectPaxForCapacity ? (0, import_utils2.normalizeSubmitCollectPaxValue)(rawCollectPax) : resolveResourceCapacity();
844
773
  const pickOriginal = (value) => {
845
774
  if (value && typeof value === "object" && !Array.isArray(value)) {
846
775
  const original = value.original;
@@ -848,7 +777,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
848
777
  }
849
778
  return void 0;
850
779
  };
851
- const mainField = pickOriginal(tempOrder.table_number) ?? pickOriginal((_b = resourceState == null ? void 0 : resourceState.table_form_record) == null ? void 0 : _b.name) ?? "";
780
+ const mainField = pickOriginal(tempOrder.table_number) ?? pickOriginal((_a = resourceState == null ? void 0 : resourceState.table_form_record) == null ? void 0 : _a.name) ?? "";
852
781
  const resourceEntry = resourceState && resourceId ? {
853
782
  relation_type: "form",
854
783
  like_status: "common",
@@ -856,35 +785,37 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
856
785
  main_field: mainField,
857
786
  form_id: resourceState.tableFormId,
858
787
  relation_id: resourceState.relationId ?? resourceId,
859
- capacity: resourceCapacityValue,
860
- metadata: this.buildScanOrderResourceMetadata({
861
- resourceState,
862
- resourceName: mainField
863
- })
788
+ capacity: resolveResourceCapacity(),
789
+ metadata: {}
864
790
  } : void 0;
865
791
  const ruleProductUid = ruleProduct ? (0, import_utils2.createUuidV4)() : void 0;
866
- const bookingCapacityValue = resourceCapacityValue;
792
+ const rawCollectPax = (_b = tempOrder.metadata) == null ? void 0 : _b.collect_pax;
793
+ const hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== void 0 && rawCollectPax !== "";
794
+ const bookingCapacityValue = hasCollectPaxForCapacity ? (0, import_utils2.normalizeSubmitCollectPaxValue)(rawCollectPax) : resolveResourceCapacity();
867
795
  const bookingCapacityDimensionId = (0, import_utils.pickFirstCustomCapacityDimensionId)(this.enabledReservationRuleProducts) ?? 0;
868
- const nextBookings = (payload.bookings || []).map((booking, idx) => ({
869
- ...booking,
870
- number: bookingCapacityValue,
871
- appointment_status: "started",
872
- metadata: {
873
- ...booking.metadata || {},
874
- ...resourceSelectType ? { resource_select_type: resourceSelectType } : {},
875
- ...resourceSelectType ? {
876
- capacity: [
877
- {
878
- id: bookingCapacityDimensionId,
879
- value: bookingCapacityValue,
880
- name: ""
881
- }
882
- ]
883
- } : {}
884
- },
885
- ...idx === 0 && resourceEntry ? { resources: [resourceEntry] } : {},
886
- ...idx === 0 && ruleProductUid ? { product_uid: ruleProductUid } : {}
887
- }));
796
+ const nextBookings = (payload.bookings || []).map((booking, idx) => {
797
+ var _a2;
798
+ return {
799
+ ...booking,
800
+ appointment_status: "started",
801
+ metadata: {
802
+ ...booking.metadata || {},
803
+ holder_id: ((_a2 = booking.metadata) == null ? void 0 : _a2.holder_id) ?? null,
804
+ ...resourceSelectType ? { resource_select_type: resourceSelectType } : {},
805
+ ...resourceSelectType ? {
806
+ capacity: [
807
+ {
808
+ id: bookingCapacityDimensionId,
809
+ value: bookingCapacityValue,
810
+ name: ""
811
+ }
812
+ ]
813
+ } : {}
814
+ },
815
+ ...idx === 0 && resourceEntry ? { resources: [resourceEntry] } : {},
816
+ ...idx === 0 && ruleProductUid ? { product_uid: ruleProductUid } : {}
817
+ };
818
+ });
888
819
  const nextProducts = [...payload.products || []];
889
820
  if (ruleProduct && ruleProductUid && !tempOrder.order_id) {
890
821
  const sellingPrice = String(ruleProduct.price ?? "0.00");
@@ -899,7 +830,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
899
830
  original_price: originalPrice,
900
831
  payment_price: sellingPrice,
901
832
  is_charge_tax: ruleProduct.is_gst ?? 0,
902
- product_sku: { option: [] },
833
+ product_option_item: [],
903
834
  discount_list: [],
904
835
  product_bundle: [],
905
836
  booking_uid: bookingUuid,
@@ -972,23 +903,23 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
972
903
  throw error;
973
904
  }
974
905
  }
975
- async updateOrderProduct(params) {
976
- this.logMethodStart("updateOrderProduct", {
906
+ async updateProductInOrder(params) {
907
+ this.logMethodStart("updateProductInOrder", {
977
908
  product_id: params.product_id,
978
909
  product_variant_id: params.product_variant_id
979
910
  });
980
911
  try {
981
912
  if (!this.store.order)
982
913
  throw new Error("order 模块未初始化");
983
- const products = await this.store.order.updateOrderProduct(params);
914
+ const products = await this.store.order.updateProductInOrder(params);
984
915
  await this.refreshItemRuleQuantityLimits();
985
916
  await this.refreshCartValidationPassed();
986
- this.logMethodSuccess("updateOrderProduct", {
917
+ this.logMethodSuccess("updateProductInOrder", {
987
918
  productCount: products.length
988
919
  });
989
920
  return products;
990
921
  } catch (error) {
991
- this.logMethodError("updateOrderProduct", error);
922
+ this.logMethodError("updateProductInOrder", error);
992
923
  throw error;
993
924
  }
994
925
  }
@@ -1007,14 +938,15 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1007
938
  product_variant_id: identity.product_variant_id,
1008
939
  updates: { note: String(note || "") }
1009
940
  };
1010
- if (identity.identity_key !== void 0)
941
+ if (identity.identity_key !== void 0) {
1011
942
  params.identity_key = identity.identity_key;
1012
- if (identity.product_sku !== void 0) {
1013
- params.product_sku = identity.product_sku;
943
+ }
944
+ if (identity.product_option_item !== void 0) {
945
+ params.product_option_item = identity.product_option_item;
1014
946
  }
1015
947
  if (identity.product_bundle !== void 0)
1016
948
  params.product_bundle = identity.product_bundle;
1017
- const products = await this.updateOrderProduct(params);
949
+ const products = await this.updateProductInOrder(params);
1018
950
  this.logMethodSuccess("setOrderProductLineNote", { productCount: products.length });
1019
951
  return products;
1020
952
  } catch (error) {
@@ -1276,6 +1208,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1276
1208
  item_rule_prefill: true,
1277
1209
  item_rule_id: prefillItem.ruleId
1278
1210
  },
1211
+ // TODO(Order types): migrate ScanOrder prefill origin runtime into tempOrder._extend.
1279
1212
  _origin: sourceItem ? {
1280
1213
  ...targetProduct._origin || {},
1281
1214
  ...sourceItem
@@ -1500,17 +1433,14 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1500
1433
  // 通过 resource_id + 店铺配置
1501
1434
  // hasOrderId 表示 url 上是否有 orderid,如果是的话,后续的流程会走加单
1502
1435
  async checkResourceAvailable(resourceId, hasOrderId) {
1503
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
1436
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
1504
1437
  this.logMethodStart("checkResourceAvailable", {
1505
1438
  resourceId
1506
1439
  });
1507
1440
  try {
1508
- const businessCode = String(((_a = this.otherParams) == null ? void 0 : _a.businessCode) ?? "").trim();
1509
- const channel = String(((_b = this.otherParams) == null ? void 0 : _b.channel) ?? "").trim();
1510
- const openDataTarget = businessCode && channel ? `${businessCode}+${channel}` : "dine_in+scan_to_order";
1511
- const openData = await ((_d = (_c = this.otherParams) == null ? void 0 : _c.getOpenData) == null ? void 0 : _d.call(_c, {
1441
+ const openData = await ((_b = (_a = this.otherParams) == null ? void 0 : _a.getOpenData) == null ? void 0 : _b.call(_a, {
1512
1442
  scope: "board",
1513
- target: openDataTarget,
1443
+ target: "dine_in+scan_to_order",
1514
1444
  section_code: ["basic", "fulfillment", "reservation", "sale", "menu", "availability", "workflow"]
1515
1445
  }));
1516
1446
  if ((openData == null ? void 0 : openData.status) === false) {
@@ -1601,13 +1531,13 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1601
1531
  }
1602
1532
  } else {
1603
1533
  this.enabledReservationRuleProducts = [];
1604
- const error = loaded instanceof Error ? loaded : new Error("预约规则商品列表接口返回异常");
1605
- this.logMethodError("loadReservationRuleProducts", error, {
1606
- resourceId,
1607
- reservationLinkIds,
1608
- scheduleDate,
1609
- scheduleDatetime,
1610
- cacheId: this.cacheId
1534
+ void this.addScanOrderLog({
1535
+ level: "error",
1536
+ title: "[ScanOrder] enabled_reservation_rules product query failed",
1537
+ payload: {
1538
+ linkIds: reservationLinkIds,
1539
+ error: this.serializeError(loaded)
1540
+ }
1611
1541
  });
1612
1542
  }
1613
1543
  }
@@ -1637,16 +1567,16 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1637
1567
  table_form_id: resourceState.tableFormId,
1638
1568
  deskmate_valid: resourceState.deskmate_valid,
1639
1569
  table_form_record: resourceState.table_form_record,
1640
- policy: (_e = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _e.policy,
1641
- partyroom_booking: (_f = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _f.partyroom_booking,
1570
+ policy: (_c = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _c.policy,
1571
+ partyroom_booking: (_d = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _d.partyroom_booking,
1642
1572
  ...this.store.resource.requestEntryPax !== void 0 ? { requestEntryPax: this.store.resource.requestEntryPax } : {},
1643
1573
  ...this.store.resource.requestPaxMin !== void 0 ? { requestPaxMin: this.store.resource.requestPaxMin } : {},
1644
1574
  ...this.store.resource.requestPaxMax !== void 0 ? { requestPaxMax: this.store.resource.requestPaxMax } : {}
1645
1575
  };
1646
- tempOrder.relation_id = resourceId || ((_g = this.otherParams) == null ? void 0 : _g.relation_id);
1576
+ tempOrder.relation_id = resourceId || ((_e = this.otherParams) == null ? void 0 : _e.relation_id);
1647
1577
  tempOrder.table_form_id = resourceState.tableFormId;
1648
1578
  tempOrder.resource_id = resourceId;
1649
- (_h = this.store.order) == null ? void 0 : _h.persistTempOrder();
1579
+ (_f = this.store.order) == null ? void 0 : _f.persistTempOrder();
1650
1580
  if (availabilityInfo.mode === "idle") {
1651
1581
  await this.addNewOrder();
1652
1582
  }
@@ -1654,18 +1584,16 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1654
1584
  tempOrder.order_id = resourceState.lastOrderId;
1655
1585
  }
1656
1586
  if (tempOrder.order_id) {
1657
- const res = await ((_i = this.store.order) == null ? void 0 : _i.getSalesOrderByLookup({
1658
- lookup: tempOrder.order_id
1659
- }));
1660
- const entryPaxNumber = (_m = (_l = (_k = (_j = res == null ? void 0 : res.data) == null ? void 0 : _j.bookings) == null ? void 0 : _k.find((p) => {
1587
+ const res = await ((_g = this.store.order) == null ? void 0 : _g.getOrderInfoByRemote(tempOrder.order_id));
1588
+ const entryPaxNumber = (_k = (_j = (_i = (_h = res == null ? void 0 : res.data) == null ? void 0 : _h.bookings) == null ? void 0 : _i.find((p) => {
1661
1589
  var _a2;
1662
1590
  return (_a2 = p.metadata) == null ? void 0 : _a2.collect_pax;
1663
- })) == null ? void 0 : _l.metadata) == null ? void 0 : _m.collect_pax;
1591
+ })) == null ? void 0 : _j.metadata) == null ? void 0 : _k.collect_pax;
1664
1592
  if (entryPaxNumber) {
1665
1593
  await this.setEntryPaxNumber(entryPaxNumber);
1666
1594
  }
1667
1595
  }
1668
- const lastOrderInfo = (_o = (_n = this.store.order) == null ? void 0 : _n.getLastOrderInfo) == null ? void 0 : _o.call(_n);
1596
+ const lastOrderInfo = (_m = (_l = this.store.order) == null ? void 0 : _l.getLastOrderInfo) == null ? void 0 : _m.call(_l);
1669
1597
  const historicalItems = hasOrderId && Array.isArray(lastOrderInfo == null ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce((acc, p) => {
1670
1598
  if (typeof (p == null ? void 0 : p.product_id) !== "number")
1671
1599
  return acc;
@@ -1677,7 +1605,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1677
1605
  return acc;
1678
1606
  }, []) : [];
1679
1607
  await this.setItemRuleRuntimeConfig({
1680
- serviceType: (_p = this.otherParams) == null ? void 0 : _p.businessCode,
1608
+ serviceType: (_n = this.otherParams) == null ? void 0 : _n.businessCode,
1681
1609
  submissionIndex: hasOrderId ? 1 : 0,
1682
1610
  historicalItems
1683
1611
  });
@@ -1725,24 +1653,18 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1725
1653
  }
1726
1654
  // 获取商品列表
1727
1655
  async getProductList() {
1728
- var _a, _b;
1656
+ var _a, _b, _c;
1729
1657
  this.logMethodStart("getProductList");
1730
1658
  const menu_list_ids = ((_b = (_a = this.otherParams) == null ? void 0 : _a.dineInConfig) == null ? void 0 : _b["menu.associated_menus"].map((n) => Number(n.value))) || [];
1731
1659
  try {
1732
- if (!this.store.products)
1733
- throw new Error("products 模块未初始化");
1734
- const res = await this.store.products.loadProducts({
1660
+ const res = await ((_c = this.store.products) == null ? void 0 : _c.loadProducts({
1735
1661
  menu_list_ids,
1736
1662
  cacheId: this.cacheId,
1737
1663
  schedule_date: (0, import_dayjs.default)().format("YYYY-MM-DD"),
1738
1664
  schedule_datetime: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")
1739
- });
1740
- const productList = this.assertProductListLoaded("getProductList", res, {
1741
- menu_list_ids,
1742
- cacheId: this.cacheId
1743
- });
1665
+ }));
1744
1666
  const formattedRes = (0, import_utils.attachItemRuleLimitsToTopLevelProducts)(
1745
- productList,
1667
+ res,
1746
1668
  this.store.itemRuleQuantityLimits || []
1747
1669
  );
1748
1670
  this.logMethodSuccess("getProductList", {
@@ -1750,12 +1672,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1750
1672
  });
1751
1673
  return formattedRes;
1752
1674
  } catch (error) {
1753
- if (!(error == null ? void 0 : error.__scanOrderLogged)) {
1754
- this.logMethodError("getProductList", error, {
1755
- menu_list_ids,
1756
- cacheId: this.cacheId
1757
- });
1758
- }
1675
+ this.logMethodError("getProductList", error.message);
1759
1676
  throw error;
1760
1677
  }
1761
1678
  }
@@ -33,17 +33,13 @@ export interface ScanOrderOrderProductIdentity {
33
33
  identity_key?: string;
34
34
  unique_identification_number?: string;
35
35
  /** 参与合并/匹配;与 remove 通配语义见 isSkuOnlyDeleteIdentity */
36
- product_sku?: ScanOrderProductSku;
36
+ product_option_item?: any[];
37
37
  product_bundle?: any[];
38
38
  }
39
- export interface ScanOrderProductSku {
40
- option: any[];
41
- [key: string]: any;
42
- }
43
39
  export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
44
40
  order_detail_id: number | null;
45
41
  num: number;
46
- product_sku: ScanOrderProductSku;
42
+ product_option_item: any[];
47
43
  /**
48
44
  * 券后 **行 composite 单价** = `metadata.main_product_selling_price`
49
45
  * + Σ((bundle.bundle_selling_price ?? bundle.price) × (bundle.num ?? 1))
@@ -89,8 +85,9 @@ export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
89
85
  * 出站 payload 版本的商品行。
90
86
  *
91
87
  * 与 tempOrder 内部 `ScanOrderOrderProduct` 的字段差异:
92
- * - `product_sku.option[*]`:内部直接维护统一 Sales 协议字段;
93
- * 提交时仅规范 `add_price`,保留传入/恢复得到的展示字段。
88
+ * - `product_option_item[*]`:内部为 `{ option_group_item_id, option_group_id, num, price, ... }`,
89
+ * 出站保留 `{ option_group_item_id, option_group_id, num }`
90
+ * (后端 checkout 协议;丢弃 `price` 等运行时辅助字段)。
94
91
  * - `product_bundle[*].option[*]`:同上重命名规则。
95
92
  *
96
93
  * 运行时(UI 显示、加购合并、指纹、持久化)与提交边界统一消费字段名
@@ -115,7 +112,6 @@ export interface ScanOrderSummary {
115
112
  shipping_tax_fee: string;
116
113
  tax_fee: string;
117
114
  surcharge_fee: string;
118
- surcharges: any[];
119
115
  discount_amount: string;
120
116
  deposit_amount: string;
121
117
  deposit?: {
@@ -88,7 +88,7 @@ export declare function attachItemRuleLimitsToTopLevelProducts<T>(productList: T
88
88
  export declare function buildProductLineFingerprint(productOptionItem?: unknown, productBundle?: unknown): string;
89
89
  /**
90
90
  * removeProductFromOrder 仅传 SKU 时的通配 identity(对象上未声明选项键)。
91
- * 与显式 `product_sku: { option: [] }` 区分:后者只匹配「无选项」行。
91
+ * 与显式 `product_option_item: []` 区分:后者只匹配「无选项」行。
92
92
  */
93
93
  export declare function isSkuOnlyDeleteIdentity(x: ScanOrderOrderProductIdentity): boolean;
94
94
  /**
@@ -63,7 +63,6 @@ module.exports = __toCommonJS(utils_exports);
63
63
  var import_dayjs = __toESM(require("dayjs"));
64
64
  var import_decimal = __toESM(require("decimal.js"));
65
65
  var import_utils = require("../../modules/Order/utils");
66
- var import_manualProductDiscount = require("../../modules/Order/utils/manualProductDiscount");
67
66
  function createEmptySummary() {
68
67
  return {
69
68
  product_quantity: 0,
@@ -75,7 +74,6 @@ function createEmptySummary() {
75
74
  shipping_tax_fee: "0.00",
76
75
  tax_fee: "0.00",
77
76
  surcharge_fee: "0.00",
78
- surcharges: [],
79
77
  discount_amount: "0.00",
80
78
  deposit_amount: "0.00",
81
79
  expect_amount: "0.00",
@@ -354,7 +352,7 @@ function buildProductLineFingerprint(productOptionItem, productBundle) {
354
352
  option_group_item_id: Number(item == null ? void 0 : item.option_group_item_id) || 0,
355
353
  option_group_id: Number(item == null ? void 0 : item.option_group_id) || 0,
356
354
  num: typeof (item == null ? void 0 : item.num) === "number" && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
357
- price: String((item == null ? void 0 : item.add_price) ?? (item == null ? void 0 : item.price) ?? "")
355
+ price: String((item == null ? void 0 : item.price) ?? "")
358
356
  })).sort((p, q) => {
359
357
  if (p.option_group_item_id !== q.option_group_item_id) {
360
358
  return p.option_group_item_id - q.option_group_item_id;
@@ -382,11 +380,11 @@ function buildProductLineFingerprint(productOptionItem, productBundle) {
382
380
  function isSkuOnlyDeleteIdentity(x) {
383
381
  if (x.unique_identification_number || x.identity_key)
384
382
  return false;
385
- return !("product_sku" in x) && !("product_bundle" in x);
383
+ return !("product_option_item" in x) && !("product_bundle" in x);
386
384
  }
387
385
  function fingerprintForIdentityWithOptionKeys(x) {
388
386
  const row = x;
389
- const opts = "product_sku" in row ? (0, import_utils.getProductSkuOptions)(row) : [];
387
+ const opts = "product_option_item" in row ? Array.isArray(row.product_option_item) ? row.product_option_item : [] : [];
390
388
  const buds = "product_bundle" in row ? Array.isArray(row.product_bundle) ? row.product_bundle : [] : [];
391
389
  return buildProductLineFingerprint(opts, buds);
392
390
  }
@@ -408,72 +406,23 @@ function getProductIdentityIndex(products, identity) {
408
406
  return products.findIndex((item) => isIdentityMatch(item, identity));
409
407
  }
410
408
  function normalizeOrderProduct(product) {
411
- var _a, _b, _c, _d, _e, _f, _g;
409
+ var _a, _b, _c;
412
410
  const metadata = { ...product.metadata || {} };
413
411
  const resolvedIdentityKey = ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ? String(product.metadata.unique_identification_number) : product.unique_identification_number && String(product.unique_identification_number).length > 0 ? String(product.unique_identification_number) : product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : (0, import_utils.createUuidV4)();
414
412
  metadata.unique_identification_number = resolvedIdentityKey;
415
- const priceOverride = metadata.price_override;
416
- const originOtherBundle = (_d = (_c = (_b = metadata.origin) == null ? void 0 : _b._extend) == null ? void 0 : _c.other) == null ? void 0 : _d.bundle;
417
- let bundleInput = product.product_bundle || [];
418
- if (priceOverride !== void 0 && priceOverride !== null && priceOverride !== "" && Array.isArray(originOtherBundle) && originOtherBundle.length > 0) {
419
- const priceById = /* @__PURE__ */ new Map();
420
- originOtherBundle.forEach((item) => {
421
- if ((item == null ? void 0 : item.id) == null)
422
- return;
423
- const unit = item.price ?? item.bundle_selling_price;
424
- if (unit === void 0 || unit === null)
425
- return;
426
- priceById.set(String(item.id), String(unit));
427
- });
428
- const base = Array.isArray(bundleInput) && bundleInput.length > 0 ? bundleInput : originOtherBundle;
429
- bundleInput = base.map((item) => {
430
- const unit = priceById.get(String(item == null ? void 0 : item.id));
431
- if (unit === void 0)
432
- return item;
433
- return {
434
- ...item,
435
- price: unit,
436
- bundle_selling_price: unit
437
- };
438
- });
439
- }
440
- const normalizedBundle = bundleInput.map((item) => {
441
- const magnitudeSource = {
442
- ...item,
443
- // 计算 markdown 净额时,只把真实毛价交给 helper;若只有 bundle_selling_price,
444
- // helper 会按历史净额兜底,避免 option 二次扣减。
445
- price: item.price ?? item.custom_price
446
- };
447
- const normalizedItem = {
448
- ...item,
449
- bundle_id: item.bundle_id ?? item.id,
450
- bundle_product_id: item.bundle_product_id ?? item._bundle_product_id,
451
- bundle_group_id: item.bundle_group_id ?? item.group_id,
452
- // price 保留毛价(markdown 仍为 5),由 price_type 决定符号。
453
- price: item.price ?? item.custom_price ?? item.bundle_selling_price ?? "0.00",
454
- price_type: item.price_type ?? item.custom_price_type ?? "",
455
- price_type_ext: item.price_type_ext ?? item.custom_price_type_ext ?? ""
456
- };
457
- normalizedItem.bundle_selling_price = (0, import_utils.getBundleSellingMagnitude)(magnitudeSource).toFixed(2);
458
- if (normalizedItem.price_type === "markdown" && (normalizedItem.price_type_ext === "" || normalizedItem.price_type_ext === void 0 || normalizedItem.price_type_ext === null)) {
459
- normalizedItem.custom_price = normalizedItem.custom_price ?? normalizedItem.price;
460
- normalizedItem.price = normalizedItem.bundle_selling_price;
461
- }
462
- if ((normalizedItem.price_type === "markdown" || normalizedItem.price_type === "markup") && (normalizedItem.price_type_ext === "" || normalizedItem.price_type_ext === void 0 || normalizedItem.price_type_ext === null)) {
463
- delete normalizedItem.original_total;
464
- }
465
- return normalizedItem;
466
- });
467
- const normalizedOptions = (0, import_utils.normalizeProductSkuOptions)((_e = product.product_sku) == null ? void 0 : _e.option);
413
+ const normalizedBundle = (product.product_bundle || []).map((item) => ({
414
+ ...item,
415
+ bundle_selling_price: item.bundle_selling_price ?? item.price ?? "0.00",
416
+ price: item.price ?? item.custom_price ?? item.bundle_selling_price ?? "0.00",
417
+ price_type: item.price_type ?? item.custom_price_type ?? "",
418
+ price_type_ext: item.price_type_ext ?? item.custom_price_type_ext ?? ""
419
+ }));
420
+ const normalizedOptions = product.product_option_item || [];
468
421
  const optionSum = (0, import_utils.sumOptionUnitPrice)(normalizedOptions);
469
- const productSku = {
470
- ...(0, import_utils.ensureProductSku)(product),
471
- option: normalizedOptions
472
- };
473
422
  const isV2 = metadata.price_schema_version === 2 || metadata.price_schema_version === "2";
474
423
  const variantId = Number(product.product_variant_id || 0);
475
- const variantList = variantId ? (_f = metadata == null ? void 0 : metadata.origin) == null ? void 0 : _f.variant : null;
476
- const variantPrice = Array.isArray(variantList) ? (_g = variantList.find((v) => Number(v == null ? void 0 : v.id) === variantId)) == null ? void 0 : _g.price : void 0;
424
+ const variantList = variantId ? (_b = metadata == null ? void 0 : metadata.origin) == null ? void 0 : _b.variant : null;
425
+ const variantPrice = Array.isArray(variantList) ? (_c = variantList.find((v) => Number(v == null ? void 0 : v.id) === variantId)) == null ? void 0 : _c.price : void 0;
477
426
  const resolvedSource = (() => {
478
427
  var _a2, _b2;
479
428
  if (metadata.source_product_price !== void 0) {
@@ -529,32 +478,17 @@ function normalizeOrderProduct(product) {
529
478
  bundle: normalizedBundle,
530
479
  useOriginalBundle: true
531
480
  });
532
- const finalOriginalPrice = (0, import_utils.resolveManualOverrideLineOriginalPrice)(
533
- { num: product.num, metadata, lineOriginalPrice: product.original_price },
534
- composedOriginalPrice
535
- );
536
- const hasManualProductDiscount = (product.discount_list || []).some(
537
- (item) => (item == null ? void 0 : item.type) === "product"
538
- );
539
- const manualOriginalPrice = hasManualProductDiscount && product.original_price != null ? String(product.original_price) : finalOriginalPrice;
540
- const discountList = (0, import_manualProductDiscount.ensureManualProductDiscountList)({
541
- discountList: product.discount_list,
542
- metadata,
543
- originalPrice: manualOriginalPrice,
544
- sellingPrice: composedSellingPrice,
545
- quantity: getSafeProductNum(product.num)
546
- });
547
481
  return {
548
482
  order_detail_id: product.order_detail_id || null,
549
483
  product_id: product.product_id,
550
484
  num: getSafeProductNum(product.num),
551
485
  product_variant_id: product.product_variant_id,
552
- product_sku: productSku,
486
+ product_option_item: normalizedOptions,
553
487
  selling_price: composedSellingPrice,
554
- original_price: manualOriginalPrice,
488
+ original_price: composedOriginalPrice,
555
489
  tax_fee: product.tax_fee || "0.00",
556
490
  is_charge_tax: product.is_charge_tax ?? 0,
557
- discount_list: discountList,
491
+ discount_list: product.discount_list || [],
558
492
  product_bundle: normalizedBundle,
559
493
  metadata,
560
494
  note: product.note != null ? String(product.note) : ""
@@ -2,7 +2,7 @@ import { Module, ModuleOptions, PisellCore } from '../../types';
2
2
  import { BaseModule } from '../../modules/BaseModule';
3
3
  import { VenueBookingAddLogParams, VenueBookingSlotConfig, VenueDateSummaryItem, VenueSlotSelection, VenueTimeSlotGrid } from './types';
4
4
  import type { ScanOrderOrderProduct, ScanOrderOrderProductIdentity } from '../ScanOrder/types';
5
- import type { UpdateOrderProductParams } from '../../modules/Order/types';
5
+ import type { UpdateProductInOrderParams } from '../../modules/Order/types';
6
6
  import type { OpenDataAvailabilityResult } from '../../modules/OpenData';
7
7
  import type { ProductData } from '../../modules/Product/types';
8
8
  import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
@@ -41,8 +41,6 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
41
41
  private loadOpenDataConfigInFlight;
42
42
  private static readonly OPEN_DATA_CACHE_TTL;
43
43
  private getLoggerContext;
44
- private safeStringify;
45
- private pickErrorMessage;
46
44
  private serializeError;
47
45
  private addVenueBookingLog;
48
46
  private logMethodStart;
@@ -156,7 +154,6 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
156
154
  type: "server" | "clientCalc";
157
155
  unavailableReason?: import("../../modules/Rules/types").UnavailableReason | undefined;
158
156
  unavailableReasonKey?: string | null | undefined;
159
- scannedDiscountList?: import("../../modules/Discount").Discount[] | undefined;
160
157
  }>;
161
158
  /** 获取当前折扣列表(包装 order.getDiscountList) */
162
159
  getDiscountList(): import("../../modules/Discount").Discount[];
@@ -170,7 +167,7 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
170
167
  getSummary(): Promise<import("../../modules/Order/types").OrderSummary>;
171
168
  submitOrder<T = any>(): Promise<T>;
172
169
  addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
173
- updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
170
+ updateProductInOrder(params: UpdateProductInOrderParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
174
171
  removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
175
172
  getProductList(): Promise<ProductData[]>;
176
173
  private loadOpenDataConfig;