@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
@@ -80,6 +80,16 @@ export interface OrderProductMetadata {
80
80
  unique_identification_number?: string;
81
81
  [key: string]: unknown;
82
82
  }
83
+ export interface OrderProductTitleSnapshot {
84
+ en: string | null;
85
+ ja: string | null;
86
+ pt: string | null;
87
+ auto: string | null;
88
+ 'zh-CN': string | null;
89
+ 'zh-HK': string | null;
90
+ kitchen: string | null;
91
+ original: string | null;
92
+ }
83
93
  /**
84
94
  * 订单级商品行(3.3 products)。
85
95
  * 订单级别的非预约关联商品;预约关联商品在 bookings 内。
@@ -92,10 +102,10 @@ export interface OrderProductLineItem {
92
102
  product_id?: number | null;
93
103
  /** 数量。创建/更新时必填。来源:Detail.product_quantity */
94
104
  num: number;
105
+ /** 商品标题快照;本地待同步订单会补齐为多语言对象。 */
106
+ product_title?: OrderProductTitleSnapshot | string | null;
95
107
  /** 多规格 ID。来源:Detail.product_variant_id */
96
108
  product_variant_id?: number;
97
- /** 选项配置 */
98
- product_option_item?: unknown[];
99
109
  /**
100
110
  * 销售单价(交易快照,仅输出)。
101
111
  * 来源:Detail.selling_price
@@ -229,8 +239,10 @@ export interface OrderPaymentItem {
229
239
  rounding_amount?: OrderMoneyString;
230
240
  /** 支付状态:paid / voided / payment_pending 等 */
231
241
  status?: OrderPaymentRecordStatus;
232
- /** 支付时间(仅输出)。来源:OrderPayment.payment_time */
242
+ /** 支付时间(输入/输出均保留)。来源:OrderPayment.payment_time */
233
243
  payment_time?: string | null;
244
+ /** 支付创建时间(输入/输出均保留)。来源:OrderPayment.created_at */
245
+ created_at?: string | null;
234
246
  /** 手续费配置。来源:OrderPayment.service_charge */
235
247
  service_charge?: Record<string, unknown> | null;
236
248
  /** Wallet Pass 使用单位 */
@@ -395,6 +407,8 @@ export interface OrderData {
395
407
  /** 本地辅助字段 */
396
408
  shop_id?: number;
397
409
  create_date?: string;
410
+ /** 本地待同步标记:1 表示需要后续同步到云端 */
411
+ need_sync?: 0 | 1 | number;
398
412
  /** 兼容:部分场景仍使用顶层 total_amount */
399
413
  total_amount?: OrderMoneyString | number;
400
414
  /** 扩展字段(物流、标签等);使用 any 以便筛选与数据源扩展 */
@@ -524,6 +538,21 @@ export interface OrderAblyEventPayload {
524
538
  order_id?: OrderId;
525
539
  timestamp: number;
526
540
  }
541
+ /**
542
+ * 订单变更广播载荷。
543
+ * 用于保留原有全量列表通知能力,同时让订阅方可按 changedOrders 做增量处理。
544
+ *
545
+ * @example
546
+ * const changedOrders = payload.changedOrders
547
+ */
548
+ export interface OrderChangedPayload {
549
+ /** 当前订单 store 全量列表,兼容既有重算列表订阅 */
550
+ list: OrderData[];
551
+ /** 本次明确发生变更的订单;全量刷新等无法确定 delta 的场景可为空 */
552
+ changedOrders: OrderData[];
553
+ /** 触发来源,便于订阅者区分 pubsub / 远端覆盖 / 清空等场景 */
554
+ source?: string;
555
+ }
527
556
  /**
528
557
  * OrderSyncMessage - pubsub 同步消息结构
529
558
  */
@@ -71,6 +71,21 @@ function bookingDateTimeString(datePart, timePart) {
71
71
  }
72
72
  return `${d} ${t}`.trim();
73
73
  }
74
+ function resolveBookingTimeRange(booking) {
75
+ const start = toTimestamp(bookingDateTimeString(booking.start_date, booking.start_time));
76
+ if (!start)
77
+ return null;
78
+ const end = toTimestamp(
79
+ bookingDateTimeString(
80
+ booking.end_date || booking.start_date,
81
+ booking.end_time || booking.start_time
82
+ )
83
+ ) || start;
84
+ return end >= start ? [start, end] : [end, start];
85
+ }
86
+ function isRangeOverlapping(left, right) {
87
+ return left[0] <= right[1] && left[1] >= right[0];
88
+ }
74
89
  function parseDateRange(range) {
75
90
  if (!Array.isArray(range) || range.length < 2)
76
91
  return null;
@@ -168,9 +183,13 @@ function matchOrder(order, ctx) {
168
183
  return true;
169
184
  }
170
185
  function matchBooking(booking, orderInfo, ctx) {
171
- if (ctx.enableChildBookingFilter) {
172
- const parentId = Number(booking.parent_id ?? 0);
173
- const itemType = String(booking.item_type ?? "");
186
+ if (ctx.enableChildBookingFilter && booking.booking_id) {
187
+ const parentId = Number(
188
+ booking.parent_id ?? 0
189
+ );
190
+ const itemType = String(
191
+ booking.item_type ?? ""
192
+ );
174
193
  const isMatched = parentId !== 0 && itemType !== "recurring_booking" || parentId === 0 && itemType === "recurring_booking";
175
194
  if (!isMatched)
176
195
  return false;
@@ -178,8 +197,8 @@ function matchBooking(booking, orderInfo, ctx) {
178
197
  if (ctx.appointmentStatusSet && !ctx.appointmentStatusSet.has(getBookingAppointmentStatus(booking)))
179
198
  return false;
180
199
  if (ctx.bookingTimeRange) {
181
- const ts = toTimestamp(bookingDateTimeString(booking.start_date, booking.start_time));
182
- if (ts < ctx.bookingTimeRange[0] || ts > ctx.bookingTimeRange[1])
200
+ const bookingRange = resolveBookingTimeRange(booking);
201
+ if (!bookingRange || !isRangeOverlapping(bookingRange, ctx.bookingTimeRange))
183
202
  return false;
184
203
  }
185
204
  if (ctx.afterExecutionTimeMs != null) {
@@ -33,6 +33,13 @@ __export(filterOrders_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(filterOrders_exports);
35
35
  var import_dayjs = __toESM(require("dayjs"));
36
+ function getOrderPaymentCodes(order) {
37
+ const payments = order.payments;
38
+ if (!Array.isArray(payments) || payments.length === 0) {
39
+ return [];
40
+ }
41
+ return payments.map((item) => item == null ? void 0 : item.code).filter((code) => typeof code === "string" && code.length > 0);
42
+ }
36
43
  function filterOrders(orders, filters) {
37
44
  const safeFilters = filters || {};
38
45
  if (!orders || !Array.isArray(orders)) {
@@ -133,26 +140,27 @@ function filterOrders(orders, filters) {
133
140
  }
134
141
  }
135
142
  if (safeFilters.payment_methods && safeFilters.payment_methods.length > 0) {
136
- if (!order.payment_methods || !Array.isArray(order.payment_methods) || order.payment_methods.length === 0) {
143
+ const orderPaymentCodes = getOrderPaymentCodes(order);
144
+ if (orderPaymentCodes.length === 0) {
137
145
  rejected.push({
138
146
  order_id: order.order_id,
139
147
  order_number: order.order_number,
140
148
  reason: {
141
149
  field: "payment_methods",
142
- actual: order.payment_methods,
150
+ actual: order.payments,
143
151
  expected: safeFilters.payment_methods
144
152
  }
145
153
  });
146
154
  return false;
147
155
  }
148
- const hasMatch = order.payment_methods.some((pm) => safeFilters.payment_methods.includes(pm));
156
+ const hasMatch = orderPaymentCodes.some((code) => safeFilters.payment_methods.includes(code));
149
157
  if (!hasMatch) {
150
158
  rejected.push({
151
159
  order_id: order.order_id,
152
160
  order_number: order.order_number,
153
161
  reason: {
154
162
  field: "payment_methods",
155
- actual: order.payment_methods,
163
+ actual: orderPaymentCodes,
156
164
  expected: safeFilters.payment_methods
157
165
  }
158
166
  });
@@ -327,8 +335,9 @@ function filterOrders(orders, filters) {
327
335
  }
328
336
  }
329
337
  if (safeFilters.start_time || safeFilters.end_time) {
338
+ const isCreatedIsUndefined = order.created_at === void 0;
330
339
  const orderTime = order.created_at ? typeof order.created_at === "number" ? order.created_at : (0, import_dayjs.default)(String(order.created_at)).valueOf() : 0;
331
- if (safeFilters.start_time) {
340
+ if (safeFilters.start_time && !isCreatedIsUndefined) {
332
341
  const startTs = (0, import_dayjs.default)(safeFilters.start_time).startOf("day").valueOf();
333
342
  if (orderTime < startTs) {
334
343
  rejected.push({
@@ -343,7 +352,7 @@ function filterOrders(orders, filters) {
343
352
  return false;
344
353
  }
345
354
  }
346
- if (safeFilters.end_time) {
355
+ if (safeFilters.end_time && !isCreatedIsUndefined) {
347
356
  const endTs = (0, import_dayjs.default)(safeFilters.end_time).endOf("day").valueOf();
348
357
  if (orderTime > endTs) {
349
358
  rejected.push({
@@ -0,0 +1,28 @@
1
+ import { Module, ModuleOptions, PisellCore } from '../../../types';
2
+ import { BaseModule } from '../../../modules/BaseModule';
3
+ import type { PaymentMethod } from './types';
4
+ export declare class PaymentServerModule extends BaseModule implements Module {
5
+ protected defaultName: string;
6
+ protected defaultVersion: string;
7
+ private request;
8
+ private app;
9
+ private logger;
10
+ private store;
11
+ private payMethodMemoryCache;
12
+ private payMethodListInFlight;
13
+ constructor(name?: string, version?: string);
14
+ initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
15
+ getPayMethodListAsync(options?: {
16
+ shouldFilter?: boolean;
17
+ }): Promise<PaymentMethod[]>;
18
+ clearPayMethodCache(): void;
19
+ private loadPayMethodListAsync;
20
+ private fetchRemotePayMethods;
21
+ private shouldFilterPayMethods;
22
+ private resolvePayMethods;
23
+ private filterPayMethods;
24
+ private setPayMethodCache;
25
+ private logInfo;
26
+ private logWarning;
27
+ private logError;
28
+ }
@@ -0,0 +1,192 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/server/modules/payment/index.ts
20
+ var payment_exports = {};
21
+ __export(payment_exports, {
22
+ PaymentServerModule: () => PaymentServerModule
23
+ });
24
+ module.exports = __toCommonJS(payment_exports);
25
+ var import_BaseModule = require("../../../modules/BaseModule");
26
+ var WALLET_PASS_CODE = "WALLET_PASS";
27
+ var WALLET_DEPENDENT_CODES = /* @__PURE__ */ new Set(["PRODUCTVOUCHER", "GIFTCARD", "POINTCARD"]);
28
+ var PAYMENT_METHODS_LOADED_EVENT = "payment:onPaymentMethodsLoaded";
29
+ var PaymentServerModule = class extends import_BaseModule.BaseModule {
30
+ constructor(name, version) {
31
+ super(name || "payment", version);
32
+ this.defaultName = "payment";
33
+ this.defaultVersion = "1.0.0";
34
+ this.payMethodMemoryCache = null;
35
+ this.payMethodListInFlight = null;
36
+ }
37
+ async initialize(core, options) {
38
+ var _a, _b, _c;
39
+ this.core = core;
40
+ this.store = options == null ? void 0 : options.store;
41
+ if (!this.store)
42
+ this.store = { payMethods: [] };
43
+ if (!Array.isArray(this.store.payMethods))
44
+ this.store.payMethods = [];
45
+ this.request = core.getPlugin("request");
46
+ const appPlugin = core.getPlugin("app");
47
+ this.app = appPlugin == null ? void 0 : appPlugin.getApp();
48
+ this.logger = (_a = this.app) == null ? void 0 : _a.logger;
49
+ if (!this.request && !((_b = this.app) == null ? void 0 : _b.request)) {
50
+ throw new Error("PaymentServerModule 需要 request 插件或 app.request 支持");
51
+ }
52
+ this.logInfo("PaymentServerModule initialized successfully", {
53
+ hasAppRequest: !!((_c = this.app) == null ? void 0 : _c.request)
54
+ });
55
+ }
56
+ // getRoutes(): RouteDefinition[] {
57
+ // return [
58
+ // {
59
+ // method: 'get',
60
+ // path: '/pay/custom-payment/all',
61
+ // handler: async ({ data, config }) => {
62
+ // const payMethods = await this.getPayMethodListAsync({
63
+ // shouldFilter: this.shouldFilterPayMethods(data, config),
64
+ // });
65
+ // return {
66
+ // code: 200,
67
+ // status: true,
68
+ // data: payMethods,
69
+ // };
70
+ // },
71
+ // },
72
+ // ];
73
+ // }
74
+ async getPayMethodListAsync(options = {}) {
75
+ var _a;
76
+ this.logInfo("Starting getPayMethodListAsync");
77
+ if ((_a = this.payMethodMemoryCache) == null ? void 0 : _a.length) {
78
+ return this.resolvePayMethods(this.payMethodMemoryCache, options);
79
+ }
80
+ if (this.payMethodListInFlight) {
81
+ const payMethods2 = await this.payMethodListInFlight;
82
+ return this.resolvePayMethods(payMethods2, options);
83
+ }
84
+ this.payMethodListInFlight = this.loadPayMethodListAsync().finally(() => {
85
+ this.payMethodListInFlight = null;
86
+ });
87
+ const payMethods = await this.payMethodListInFlight;
88
+ return this.resolvePayMethods(payMethods, options);
89
+ }
90
+ clearPayMethodCache() {
91
+ this.payMethodMemoryCache = null;
92
+ this.store.payMethods = [];
93
+ }
94
+ async loadPayMethodListAsync() {
95
+ try {
96
+ const payMethods = await this.fetchRemotePayMethods();
97
+ this.setPayMethodCache(payMethods);
98
+ await this.core.effects.emit(PAYMENT_METHODS_LOADED_EVENT, payMethods);
99
+ this.logInfo("getPayMethodListAsync completed successfully", {
100
+ payMethods
101
+ });
102
+ return payMethods;
103
+ } catch (error) {
104
+ console.error("[PaymentServerModule] 获取支付方式列表失败", error);
105
+ this.logError("getPayMethodListAsync failed", error);
106
+ return [];
107
+ }
108
+ }
109
+ async fetchRemotePayMethods() {
110
+ var _a;
111
+ const requester = ((_a = this.app) == null ? void 0 : _a.request) || this.request;
112
+ const response = await requester.get("/shop/pay/custom-payment/all", void 0);
113
+ const payMethods = (response == null ? void 0 : response.data) || response || [];
114
+ return Array.isArray(payMethods) ? payMethods : [];
115
+ }
116
+ shouldFilterPayMethods(data, config) {
117
+ return (data == null ? void 0 : data.filterPaymentMethods) === true || (config == null ? void 0 : config.filterPaymentMethods) === true;
118
+ }
119
+ resolvePayMethods(payMethods, options) {
120
+ if (!options.shouldFilter)
121
+ return payMethods;
122
+ return this.filterPayMethods(payMethods);
123
+ }
124
+ filterPayMethods(payMethods) {
125
+ if (!Array.isArray(payMethods))
126
+ return [];
127
+ let availableMethods = payMethods.filter(
128
+ (method) => method.status === 1 && method.disable === 0
129
+ );
130
+ const walletPassMethod = availableMethods.find(
131
+ (method) => method.code === WALLET_PASS_CODE
132
+ );
133
+ if (!walletPassMethod) {
134
+ return availableMethods.filter(
135
+ (method) => !WALLET_DEPENDENT_CODES.has(method.code)
136
+ );
137
+ }
138
+ availableMethods = availableMethods.map((method) => {
139
+ if (!WALLET_DEPENDENT_CODES.has(method.code))
140
+ return method;
141
+ return {
142
+ ...method,
143
+ channel_application: walletPassMethod.channel_application
144
+ };
145
+ });
146
+ return availableMethods;
147
+ }
148
+ setPayMethodCache(payMethods) {
149
+ this.payMethodMemoryCache = payMethods;
150
+ this.store.payMethods = payMethods;
151
+ }
152
+ logInfo(title, metadata) {
153
+ try {
154
+ if (this.logger) {
155
+ this.logger.addLog({
156
+ type: "info",
157
+ title: `[PaymentServerModule] ${title}`,
158
+ metadata: metadata || {}
159
+ });
160
+ }
161
+ } catch {
162
+ }
163
+ }
164
+ logWarning(title, metadata) {
165
+ try {
166
+ if (this.logger) {
167
+ this.logger.addLog({
168
+ type: "warning",
169
+ title: `[PaymentServerModule] ${title}`,
170
+ metadata: metadata || {}
171
+ });
172
+ }
173
+ } catch {
174
+ }
175
+ }
176
+ logError(title, metadata) {
177
+ try {
178
+ if (this.logger) {
179
+ this.logger.addLog({
180
+ type: "error",
181
+ title: `[PaymentServerModule] ${title}`,
182
+ metadata: metadata || {}
183
+ });
184
+ }
185
+ } catch {
186
+ }
187
+ }
188
+ };
189
+ // Annotate the CommonJS export names for ESM import in node:
190
+ 0 && (module.exports = {
191
+ PaymentServerModule
192
+ });
@@ -0,0 +1,9 @@
1
+ import type { PaymentMethod } from '../../../modules/Payment/types';
2
+ export interface PaymentServerState {
3
+ payMethods: PaymentMethod[];
4
+ }
5
+ export interface PaymentMethodsChangedEventData {
6
+ oldMethods: PaymentMethod[];
7
+ newMethods: PaymentMethod[];
8
+ }
9
+ export type { PaymentMethod };
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/server/modules/payment/types.ts
16
+ var types_exports = {};
17
+ module.exports = __toCommonJS(types_exports);
@@ -21,12 +21,18 @@ export declare class ProductsModule extends BaseModule implements Module {
21
21
  private isPriceFormatterRegistered;
22
22
  private quotationPriceBridge?;
23
23
  private quotationBridgeChannel?;
24
- private quotationBridgeCustomerId?;
24
+ private quotationBridgeLoadedKey?;
25
25
  private quotationBridgeRefreshPromise?;
26
26
  private quotationBridgeRefreshKey?;
27
27
  private productDataSource;
28
28
  private pendingSyncMessages;
29
29
  private syncTimer?;
30
+ /** 最近一次 SSE 全量拉取完成时间 */
31
+ private lastServerFullFetchAtMs;
32
+ /** 最近一次 preload 完成时间(含 IndexDB 命中) */
33
+ private lastPreloadCompletedAtMs;
34
+ /** IndexDB 写入串行队列,避免快照与 patch 并发交错 */
35
+ private productIndexDBSaveQueue;
30
36
  constructor(name?: string, version?: string);
31
37
  initialize(core: PisellCore, options: any): Promise<void>;
32
38
  /**
@@ -209,10 +215,28 @@ export declare class ProductsModule extends BaseModule implements Module {
209
215
  */
210
216
  private loadProductsFromIndexDB;
211
217
  /**
212
- * 保存商品数据到 IndexDB(平铺存储)
213
- * @private
218
+ * 串行执行商品 IndexDB 写入,避免快照替换与增量 patch 并发交错。
219
+ *
220
+ * @example
221
+ * await this.runInProductIndexDBSaveQueue(async () => {
222
+ * await this.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products)
223
+ * })
224
+ */
225
+ private runInProductIndexDBSaveQueue;
226
+ /**
227
+ * 全量快照写入 IndexDB:clear + bulkUpdate,仅用于 SSE/HTTP 全量拉取。
228
+ *
229
+ * @example
230
+ * await this.replaceProductsSnapshotInIndexDB(list, 'loadProductsByServer')
214
231
  */
215
- private saveProductsToIndexDB;
232
+ private replaceProductsSnapshotInIndexDB;
233
+ /**
234
+ * 增量 upsert 商品到 IndexDB,不清空表;用于 pubsub 批次合并后的变更商品。
235
+ *
236
+ * @example
237
+ * await this.patchProductsInIndexDB(changedProducts, 'pubsub.processProductSyncMessages', mergeActions)
238
+ */
239
+ private patchProductsInIndexDB;
216
240
  /**
217
241
  * 同步更新商品 Map 缓存
218
242
  * 将 list 中的商品同步到 map,以 id 为 key
@@ -262,14 +286,17 @@ export declare class ProductsModule extends BaseModule implements Module {
262
286
  /**
263
287
  * 将 body 完整数据直接覆盖到本地 store(不调用报价单接口)
264
288
  * 已存在的 → 直接替换;不存在的 → 追加
265
- * 同时更新 Map 缓存、IndexDB,触发 onProductsChanged
266
- * 价格缓存由 processProductSyncMessages 末尾统一清除
289
+ *
290
+ * @example
291
+ * await this.applyBodyUpdatesToStore(bodyUpdates, { skipIndexDB: true })
267
292
  */
268
293
  private applyBodyUpdatesToStore;
269
294
  /**
270
295
  * 将增量拉取的商品合并到 store
271
296
  * 已存在的 → 替换;新的 → 追加
272
- * 同时更新 store.map、IndexDB,触发 onProductsChanged
297
+ *
298
+ * @example
299
+ * await this.mergeProductsToStore(freshProducts, { skipIndexDB: true })
273
300
  */
274
301
  private mergeProductsToStore;
275
302
  /**