@pisell/pisellos 0.10.15 → 0.10.17

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 (331) hide show
  1. package/dist/core/index.js +6 -9
  2. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  3. package/dist/model/strategy/adapter/walletPass/example.js +3 -26
  4. package/dist/model/strategy/strategy-example.js +5 -19
  5. package/dist/modules/Cart/index.js +0 -3
  6. package/dist/modules/Cart/utils/cartProduct.js +0 -1
  7. package/dist/modules/Date/index.js +1 -5
  8. package/dist/modules/Discount/index.js +2 -4
  9. package/dist/modules/OpenData/index.d.ts +5 -2
  10. package/dist/modules/OpenData/index.js +27 -14
  11. package/dist/modules/OpenData/types.d.ts +42 -0
  12. package/dist/modules/OpenData/types.js +7 -1
  13. package/dist/modules/OpenData/utils.d.ts +15 -1
  14. package/dist/modules/OpenData/utils.js +85 -0
  15. package/dist/modules/Order/index.d.ts +4 -2
  16. package/dist/modules/Order/index.js +131 -123
  17. package/dist/modules/Order/types.d.ts +8 -1
  18. package/dist/modules/Order/types.js +1 -0
  19. package/dist/modules/Order/utils.js +7 -1
  20. package/dist/modules/Payment/index.js +97 -162
  21. package/dist/modules/Product/types.d.ts +2 -0
  22. package/dist/modules/ProductList/index.js +96 -74
  23. package/dist/modules/Rules/index.js +12 -12
  24. package/dist/modules/SalesSummary/index.js +6 -4
  25. package/dist/modules/Schedule/index.js +0 -1
  26. package/dist/modules/Schedule/utils.js +0 -1
  27. package/dist/modules/Step/index.js +0 -1
  28. package/dist/plugins/request.js +1 -4
  29. package/dist/plugins/window.js +2 -6
  30. package/dist/server/index.d.ts +11 -0
  31. package/dist/server/index.js +977 -641
  32. package/dist/server/modules/menu/index.js +32 -41
  33. package/dist/server/modules/order/index.d.ts +8 -0
  34. package/dist/server/modules/order/index.js +253 -219
  35. package/dist/server/modules/products/index.js +24 -42
  36. package/dist/server/modules/quotation/index.js +29 -38
  37. package/dist/server/modules/resource/index.js +3 -4
  38. package/dist/server/modules/schedule/index.js +27 -35
  39. package/dist/server/utils/product.js +0 -1
  40. package/dist/server/utils/small-ticket.d.ts +9 -1
  41. package/dist/server/utils/small-ticket.js +117 -43
  42. package/dist/solution/BaseSales/index.d.ts +7 -0
  43. package/dist/solution/BaseSales/index.js +350 -215
  44. package/dist/solution/BaseSales/types.d.ts +2 -0
  45. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  46. package/dist/solution/BaseSales/utils/cartPromotion.js +15 -6
  47. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  48. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +7 -1
  49. package/dist/solution/BaseSales/utils.js +6 -3
  50. package/dist/solution/BookingByStep/index.d.ts +2 -2
  51. package/dist/solution/BookingByStep/index.js +7 -59
  52. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  53. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  54. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  55. package/dist/solution/BookingTicket/index.d.ts +14 -19
  56. package/dist/solution/BookingTicket/index.js +553 -433
  57. package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -1
  58. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
  59. package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
  60. package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
  61. package/dist/solution/BuyTickets/index.js +9 -12
  62. package/dist/solution/Checkout/index.js +177 -252
  63. package/dist/solution/Checkout/utils/index.js +4 -16
  64. package/dist/solution/RegisterAndLogin/index.js +30 -76
  65. package/dist/solution/Sales/index.d.ts +20 -4
  66. package/dist/solution/Sales/index.js +348 -75
  67. package/dist/solution/Sales/types.d.ts +10 -0
  68. package/dist/solution/ScanOrder/index.js +50 -60
  69. package/dist/solution/ScanOrder/types.d.ts +2 -0
  70. package/dist/solution/ScanOrder/utils.js +6 -3
  71. package/dist/solution/ShopDiscount/index.js +2 -7
  72. package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
  73. package/dist/solution/UnifiedBookingSales/index.js +495 -422
  74. package/dist/solution/UnifiedBookingSales/types.d.ts +7 -1
  75. package/dist/solution/VenueBooking/index.js +45 -55
  76. package/dist/utils/task.js +15 -18
  77. package/dist/utils/watch.js +0 -1
  78. package/lib/apis/picoding.js +2 -0
  79. package/lib/core/index.js +131 -131
  80. package/lib/effects/index.js +46 -57
  81. package/lib/index.js +82 -49
  82. package/lib/model/index.js +14 -21
  83. package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
  84. package/lib/model/strategy/adapter/dataVariant/evaluator.js +209 -315
  85. package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
  86. package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
  87. package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
  88. package/lib/model/strategy/adapter/index.js +100 -64
  89. package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
  90. package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
  91. package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
  92. package/lib/model/strategy/adapter/itemRule/index.js +83 -57
  93. package/lib/model/strategy/adapter/itemRule/type.js +97 -36
  94. package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
  95. package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
  96. package/lib/model/strategy/adapter/promotion/examples.js +222 -234
  97. package/lib/model/strategy/adapter/promotion/index.js +1 -51
  98. package/lib/model/strategy/adapter/promotion/type.js +243 -36
  99. package/lib/model/strategy/adapter/type.js +4 -16
  100. package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
  101. package/lib/model/strategy/adapter/walletPass/example.js +217 -190
  102. package/lib/model/strategy/adapter/walletPass/index.js +75 -51
  103. package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
  104. package/lib/model/strategy/adapter/walletPass/type.js +4 -16
  105. package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
  106. package/lib/model/strategy/engine.js +270 -168
  107. package/lib/model/strategy/index.js +49 -34
  108. package/lib/model/strategy/strategy-example.js +243 -239
  109. package/lib/model/strategy/type.js +100 -40
  110. package/lib/modules/Account/index.js +39 -53
  111. package/lib/modules/Account/types.js +20 -33
  112. package/lib/modules/AccountList/index.js +116 -154
  113. package/lib/modules/AccountList/types.js +30 -31
  114. package/lib/modules/AccountList/utils.js +18 -30
  115. package/lib/modules/BaseModule.js +23 -42
  116. package/lib/modules/BookingContext/index.js +158 -136
  117. package/lib/modules/BookingContext/types.js +46 -32
  118. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
  119. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
  120. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
  121. package/lib/modules/BookingContext/utils/flexible.js +38 -55
  122. package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
  123. package/lib/modules/BookingContext/utils/index.js +124 -41
  124. package/lib/modules/BookingContext/utils/noResource.js +58 -70
  125. package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
  126. package/lib/modules/BookingContext/utils/productExtend.js +202 -155
  127. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  128. package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
  129. package/lib/modules/BookingContext/utils/resources.js +209 -167
  130. package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
  131. package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
  132. package/lib/modules/Cart/index.js +170 -124
  133. package/lib/modules/Cart/types.js +46 -51
  134. package/lib/modules/Cart/utils/cartAccount.js +40 -39
  135. package/lib/modules/Cart/utils/cartDate.js +56 -61
  136. package/lib/modules/Cart/utils/cartDiscount.js +28 -33
  137. package/lib/modules/Cart/utils/cartNote.js +27 -32
  138. package/lib/modules/Cart/utils/cartProduct.js +321 -251
  139. package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
  140. package/lib/modules/Cart/utils/cartResource.js +70 -78
  141. package/lib/modules/Cart/utils/changePrice.js +22 -50
  142. package/lib/modules/Cart/utils/index.js +106 -48
  143. package/lib/modules/Customer/constants.js +13 -34
  144. package/lib/modules/Customer/index.js +235 -172
  145. package/lib/modules/Customer/types.js +38 -35
  146. package/lib/modules/Date/index.js +116 -115
  147. package/lib/modules/Date/types.js +16 -28
  148. package/lib/modules/Date/utils.js +174 -123
  149. package/lib/modules/Discount/index.js +133 -143
  150. package/lib/modules/Discount/types.js +9 -31
  151. package/lib/modules/Guests/index.js +30 -56
  152. package/lib/modules/Guests/types.js +23 -33
  153. package/lib/modules/Holder/index.js +209 -189
  154. package/lib/modules/Holder/types.js +4 -16
  155. package/lib/modules/Holder/utils.js +20 -49
  156. package/lib/modules/OpenData/index.d.ts +5 -2
  157. package/lib/modules/OpenData/index.js +119 -78
  158. package/lib/modules/OpenData/types.d.ts +42 -0
  159. package/lib/modules/OpenData/types.js +12 -16
  160. package/lib/modules/OpenData/utils.d.ts +15 -1
  161. package/lib/modules/OpenData/utils.js +129 -78
  162. package/lib/modules/Order/index.d.ts +4 -2
  163. package/lib/modules/Order/index.js +1843 -2251
  164. package/lib/modules/Order/payment-utils.js +77 -120
  165. package/lib/modules/Order/types.d.ts +8 -1
  166. package/lib/modules/Order/types.js +88 -35
  167. package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
  168. package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
  169. package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
  170. package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
  171. package/lib/modules/Order/utils/virtualSettlement.js +120 -171
  172. package/lib/modules/Order/utils.js +834 -668
  173. package/lib/modules/Payment/cash.js +20 -33
  174. package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
  175. package/lib/modules/Payment/eftpos.js +16 -30
  176. package/lib/modules/Payment/index.js +532 -399
  177. package/lib/modules/Payment/mx51.js +1 -0
  178. package/lib/modules/Payment/types.js +230 -108
  179. package/lib/modules/Payment/utils.js +52 -51
  180. package/lib/modules/Payment/walletpass.js +485 -660
  181. package/lib/modules/Product/index.js +51 -46
  182. package/lib/modules/Product/types.d.ts +2 -0
  183. package/lib/modules/Product/types.js +4 -16
  184. package/lib/modules/Product/utils.js +32 -33
  185. package/lib/modules/ProductList/index.js +141 -161
  186. package/lib/modules/ProductList/types.js +9 -31
  187. package/lib/modules/Quotation/index.js +66 -100
  188. package/lib/modules/Quotation/types.js +4 -16
  189. package/lib/modules/Resource/index.js +27 -59
  190. package/lib/modules/Resource/types.js +22 -32
  191. package/lib/modules/Resource/utils.js +30 -38
  192. package/lib/modules/ResourcePlanner/index.js +25 -23
  193. package/lib/modules/ResourcePlanner/localClock.js +54 -119
  194. package/lib/modules/ResourcePlanner/planner.js +591 -772
  195. package/lib/modules/ResourcePlanner/types.js +10 -29
  196. package/lib/modules/Rules/index.js +1224 -963
  197. package/lib/modules/Rules/types.js +17 -40
  198. package/lib/modules/SalesSummary/index.js +80 -89
  199. package/lib/modules/SalesSummary/types.js +4 -16
  200. package/lib/modules/SalesSummary/utils.js +359 -442
  201. package/lib/modules/ScanOrderLogger/index.js +59 -79
  202. package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
  203. package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
  204. package/lib/modules/ScanOrderLogger/types.js +4 -16
  205. package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
  206. package/lib/modules/Schedule/index.js +100 -114
  207. package/lib/modules/Schedule/type.js +4 -16
  208. package/lib/modules/Schedule/types.js +4 -16
  209. package/lib/modules/Schedule/utils.js +433 -291
  210. package/lib/modules/Step/index.js +40 -52
  211. package/lib/modules/Step/tyeps.js +4 -16
  212. package/lib/modules/Summary/index.js +66 -71
  213. package/lib/modules/Summary/types.js +4 -16
  214. package/lib/modules/Summary/utils.js +773 -418
  215. package/lib/modules/SurchargeList/index.js +46 -60
  216. package/lib/modules/SurchargeList/types.js +4 -16
  217. package/lib/modules/index.js +245 -63
  218. package/lib/plugins/app.js +4 -16
  219. package/lib/plugins/index.js +36 -25
  220. package/lib/plugins/request.js +137 -126
  221. package/lib/plugins/shopStore.js +4 -16
  222. package/lib/plugins/user.js +4 -16
  223. package/lib/plugins/window.js +171 -179
  224. package/lib/server/index.d.ts +11 -0
  225. package/lib/server/index.js +3432 -2757
  226. package/lib/server/modules/floor-plan/index.js +102 -123
  227. package/lib/server/modules/floor-plan/types.js +15 -30
  228. package/lib/server/modules/index.js +106 -68
  229. package/lib/server/modules/menu/index.js +146 -122
  230. package/lib/server/modules/menu/types.js +18 -31
  231. package/lib/server/modules/order/index.d.ts +8 -0
  232. package/lib/server/modules/order/index.js +781 -956
  233. package/lib/server/modules/order/types.js +122 -33
  234. package/lib/server/modules/order/utils/filterBookings.js +219 -194
  235. package/lib/server/modules/order/utils/filterOrders.js +118 -92
  236. package/lib/server/modules/payment/index.js +59 -83
  237. package/lib/server/modules/payment/types.js +4 -16
  238. package/lib/server/modules/products/index.js +575 -459
  239. package/lib/server/modules/products/types.js +44 -34
  240. package/lib/server/modules/quotation/index.js +137 -172
  241. package/lib/server/modules/quotation/types.js +21 -31
  242. package/lib/server/modules/resource/index.js +213 -184
  243. package/lib/server/modules/resource/types.js +42 -33
  244. package/lib/server/modules/schedule/index.js +135 -123
  245. package/lib/server/modules/schedule/types.js +14 -21
  246. package/lib/server/modules/schedule/utils.js +334 -163
  247. package/lib/server/types.js +4 -16
  248. package/lib/server/utils/index.js +25 -23
  249. package/lib/server/utils/product.js +196 -139
  250. package/lib/server/utils/schedule.js +34 -41
  251. package/lib/server/utils/small-ticket.d.ts +9 -1
  252. package/lib/server/utils/small-ticket.js +565 -470
  253. package/lib/server/utils/time.js +40 -49
  254. package/lib/solution/BaseSales/index.d.ts +7 -0
  255. package/lib/solution/BaseSales/index.js +1385 -1503
  256. package/lib/solution/BaseSales/types.d.ts +2 -0
  257. package/lib/solution/BaseSales/types.js +42 -38
  258. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  259. package/lib/solution/BaseSales/utils/cartPromotion.js +652 -498
  260. package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
  261. package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
  262. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  263. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +138 -180
  264. package/lib/solution/BaseSales/utils.js +161 -143
  265. package/lib/solution/BookingByStep/index.d.ts +2 -2
  266. package/lib/solution/BookingByStep/index.js +1527 -1340
  267. package/lib/solution/BookingByStep/types.js +40 -99
  268. package/lib/solution/BookingByStep/utils/capacity.js +192 -160
  269. package/lib/solution/BookingByStep/utils/products.js +42 -52
  270. package/lib/solution/BookingByStep/utils/resources.js +527 -330
  271. package/lib/solution/BookingByStep/utils/stock.js +65 -44
  272. package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
  273. package/lib/solution/BookingTicket/index.d.ts +14 -19
  274. package/lib/solution/BookingTicket/index.js +663 -526
  275. package/lib/solution/BookingTicket/types.js +99 -77
  276. package/lib/solution/BookingTicket/utils/addProductDecision.js +229 -190
  277. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
  278. package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
  279. package/lib/solution/BookingTicket/utils/cartView.js +114 -99
  280. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  281. package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
  282. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
  283. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
  284. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
  285. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
  286. package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
  287. package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
  288. package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
  289. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
  290. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
  291. package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
  292. package/lib/solution/BuyTickets/index.js +67 -70
  293. package/lib/solution/BuyTickets/types.js +22 -38
  294. package/lib/solution/Checkout/index.js +1451 -1158
  295. package/lib/solution/Checkout/types.js +91 -61
  296. package/lib/solution/Checkout/utils/index.js +228 -156
  297. package/lib/solution/PlaceOrder/index.js +55 -0
  298. package/lib/solution/RegisterAndLogin/config.js +493 -460
  299. package/lib/solution/RegisterAndLogin/index.js +633 -630
  300. package/lib/solution/RegisterAndLogin/types.js +189 -76
  301. package/lib/solution/RegisterAndLogin/utils.js +183 -125
  302. package/lib/solution/Sales/index.d.ts +20 -4
  303. package/lib/solution/Sales/index.js +502 -330
  304. package/lib/solution/Sales/types.d.ts +10 -0
  305. package/lib/solution/Sales/types.js +27 -33
  306. package/lib/solution/ScanOrder/index.js +822 -852
  307. package/lib/solution/ScanOrder/types.d.ts +2 -0
  308. package/lib/solution/ScanOrder/types.js +33 -34
  309. package/lib/solution/ScanOrder/utils.js +412 -374
  310. package/lib/solution/ShopDiscount/index.js +226 -232
  311. package/lib/solution/ShopDiscount/types.js +15 -37
  312. package/lib/solution/ShopDiscount/utils.js +300 -172
  313. package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
  314. package/lib/solution/UnifiedBookingSales/index.js +1087 -1222
  315. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
  316. package/lib/solution/UnifiedBookingSales/types.d.ts +7 -1
  317. package/lib/solution/UnifiedBookingSales/types.js +10 -32
  318. package/lib/solution/VenueBooking/index.js +811 -879
  319. package/lib/solution/VenueBooking/types.js +19 -39
  320. package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
  321. package/lib/solution/VenueBooking/utils/resource.js +31 -54
  322. package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
  323. package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
  324. package/lib/solution/VenueBooking/utils.js +130 -67
  325. package/lib/solution/index.js +124 -41
  326. package/lib/store/createStore.js +32 -29
  327. package/lib/types/index.js +4 -16
  328. package/lib/utils/payment-number.js +26 -46
  329. package/lib/utils/task.js +36 -36
  330. package/lib/utils/watch.js +81 -47
  331. package/package.json +2 -1
@@ -106,21 +106,20 @@ var PisellOSCore = /*#__PURE__*/function () {
106
106
  _context.next = 16;
107
107
  return this.server.initialize(this.serverOptions.modules, this.serverOptions.autoInitData !== false, options);
108
108
  case 16:
109
- console.log('[PisellOS] ✅ Server 初始化完成,所有数据已预加载');
110
109
  this.log('[PisellOS] Server 初始化完成');
111
- _context.next = 25;
110
+ _context.next = 24;
112
111
  break;
113
- case 20:
114
- _context.prev = 20;
112
+ case 19:
113
+ _context.prev = 19;
115
114
  _context.t0 = _context["catch"](6);
116
115
  console.error('[PisellOS] ❌ Server 初始化失败:', _context.t0);
117
116
  this.log("Server \u521D\u59CB\u5316\u5931\u8D25: ".concat(_context.t0), 'error');
118
117
  throw _context.t0;
119
- case 25:
118
+ case 24:
120
119
  case "end":
121
120
  return _context.stop();
122
121
  }
123
- }, _callee, this, [[6, 20]]);
122
+ }, _callee, this, [[6, 19]]);
124
123
  }));
125
124
  function initializeServer(_x) {
126
125
  return _initializeServer.apply(this, arguments);
@@ -138,11 +137,10 @@ var PisellOSCore = /*#__PURE__*/function () {
138
137
  var prefix = '[PisellOS]';
139
138
  switch (level) {
140
139
  case 'info':
141
- console.log("".concat(prefix, " ").concat(message));
142
140
  break;
143
141
  case 'warn':
144
142
  // 使用 console.log 避免显示堆栈跟踪,提升性能
145
- console.log("%c".concat(prefix, "%c ").concat(message), 'color: #f59e0b; font-weight: bold;', 'color: #f59e0b;');
143
+
146
144
  break;
147
145
  case 'error':
148
146
  console.error("".concat(prefix, " ").concat(message));
@@ -249,7 +247,6 @@ var PisellOSCore = /*#__PURE__*/function () {
249
247
  }
250
248
  // 预先给模块初始化值系统
251
249
  var _createStore = createStore((options === null || options === void 0 ? void 0 : options.initialState) || {}, module.name, function (path, value) {
252
- console.log('core 检测到模块值更新', module.name, path, value);
253
250
  _this3.effects.emit("".concat(module.name, ":changed"), {
254
251
  path: path,
255
252
  value: value
@@ -1,9 +0,0 @@
1
- // 导出评估器
2
- export { PromotionEvaluator } from "./evaluator";
3
-
4
- // 导出适配器
5
- export { PromotionAdapter } from "./adapter";
6
- export { default } from "./adapter";
7
-
8
- // 导出策略配置示例常量
9
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
@@ -164,8 +164,6 @@ var strategyConfigs = [
164
164
  // ============================================
165
165
 
166
166
  function runExample() {
167
- console.log('========== WalletPass 评估器示例 ==========\n');
168
-
169
167
  // 创建评估器实例
170
168
  var evaluator = new WalletPassEvaluator();
171
169
 
@@ -178,38 +176,17 @@ function runExample() {
178
176
  });
179
177
 
180
178
  // 输出结果
181
- console.log('订单信息:');
182
- console.log("- \u603B\u91D1\u989D: ".concat(180, " \u5143"));
183
- console.log("- \u5546\u54C1: ".concat(products.map(function (p) {
184
- return "".concat(p.name, "(").concat(p.quantity, "\u4EF6)");
185
- }).join(', '), "\n"));
186
- console.log('评估结果:\n');
179
+
187
180
  results.forEach(function (result, index) {
188
- console.log("Voucher ".concat(index + 1, ": ").concat(result.voucher.id));
189
- console.log(" \u9762\u989D: ".concat(result.voucher.amount, " \u5143"));
190
- console.log(" \u53EF\u7528: ".concat(result.isApplicable ? '✅ 是' : '❌ 否'));
191
- if (result.isApplicable) {
192
- console.log(" \u6700\u5927\u62B5\u6263: ".concat(result.maxDeduction, " \u5143"));
193
- console.log(" \u6BCF\u5355\u53EF\u7528: ".concat(result.canUseCount, " \u5F20"));
194
- console.log(" \u62B5\u6263\u7A0E\u8D39: ".concat(result.deductTaxAndFee ? '是' : '否'));
195
- console.log(" \u9002\u7528\u5546\u54C1: ".concat(result.applicableProductIds.join(', ')));
196
- } else {
197
- console.log(" \u539F\u56E0: ".concat(result.reason));
198
- console.log(" \u539F\u56E0\u7801: ".concat(result.reasonCode));
199
- }
200
- console.log('');
181
+ if (result.isApplicable) {} else {}
201
182
  });
202
183
 
203
184
  // 筛选可用的 vouchers
204
185
  var availableVouchers = results.filter(function (r) {
205
186
  return r.isApplicable;
206
187
  });
207
- console.log("\n\u5171 ".concat(availableVouchers.length, " \u5F20\u53EF\u7528"));
208
188
  if (availableVouchers.length > 0) {
209
- console.log('可用 voucher ID:');
210
- availableVouchers.forEach(function (v) {
211
- console.log(" - ".concat(v.voucher.id, ": \u6700\u591A\u62B5\u6263 ").concat(v.maxDeduction, " \u5143"));
212
- });
189
+ availableVouchers.forEach(function (v) {});
213
190
  }
214
191
  }
215
192
 
@@ -246,8 +246,6 @@ var codeContext = {
246
246
  // ============================================
247
247
 
248
248
  function runExamples() {
249
- console.log('====== 策略模型使用示例 ======\n');
250
-
251
249
  // 创建引擎实例(开启调试和追踪)
252
250
  var engine = createStrategyEngine({
253
251
  debug: true,
@@ -255,32 +253,23 @@ function runExamples() {
255
253
  });
256
254
 
257
255
  // 示例1: 代金券
258
- console.log('示例1: 10元代金券');
256
+
259
257
  var result1 = engine.evaluate(voucherConfig, voucherContext);
260
- console.log('结果:', JSON.stringify(result1, null, 2));
261
- console.log('\n');
262
258
 
263
259
  // 示例2: 阶梯满减
264
- console.log('示例2: 阶梯满减(订单金额250)');
260
+
265
261
  var result2 = engine.evaluate(tieredDiscountConfig, tieredContext);
266
- console.log('结果:', JSON.stringify(result2, null, 2));
267
- console.log('\n');
268
262
 
269
263
  // 示例3: Code 模式
270
- console.log('示例3: Code 模式条件');
264
+
271
265
  var result3 = engine.evaluate(codeConditionConfig, codeContext);
272
- console.log('结果:', JSON.stringify(result3, null, 2));
273
- console.log('\n');
274
266
 
275
267
  // 快速评估(不需要创建引擎实例)
276
- console.log('示例4: 快速评估');
268
+
277
269
  var result4 = evaluate(voucherConfig, voucherContext);
278
- console.log('适用:', result4.applicable);
279
- console.log('匹配动作数:', result4.matchedActions.length);
280
- console.log('\n');
281
270
 
282
271
  // 注册自定义运算符
283
- console.log('示例5: 自定义运算符');
272
+
284
273
  engine.registerOperator('divisible_by', function (fieldValue, compareValue) {
285
274
  return Number(fieldValue) % Number(compareValue) === 0;
286
275
  });
@@ -317,11 +306,8 @@ function runExamples() {
317
306
  }
318
307
  };
319
308
  var result5 = engine.evaluate(customOperatorConfig, customContext);
320
- console.log('结果:', result5.applicable ? '适用' : '不适用');
321
- console.log('匹配动作:', result5.matchedActions);
322
309
 
323
310
  // 调试信息
324
- console.log('\n引擎调试信息:', engine.getDebugInfo());
325
311
  }
326
312
 
327
313
  // 运行示例(如果直接执行此文件)
@@ -95,9 +95,6 @@ export var CartModule = /*#__PURE__*/function (_BaseModule) {
95
95
  }
96
96
  throw new Error('购物车模块需要 window 插件支持');
97
97
  case 11:
98
- // this.store.temp = {};
99
- console.log('[CartModule] 初始化完成');
100
- case 12:
101
98
  case "end":
102
99
  return _context.stop();
103
100
  }
@@ -63,7 +63,6 @@ export var handleVariantProduct = function handleVariantProduct(product) {
63
63
  */
64
64
  export var formatProductToCartItem = function formatProductToCartItem(params) {
65
65
  var _product$custom_depos;
66
- console.log('formatProductToCartItem>>>>>>', params);
67
66
  var cartItem = params.cartItem,
68
67
  product = params.product,
69
68
  bundle = params.bundle,
@@ -294,8 +294,6 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
294
294
  // 将 start_time 向上取整到下一个10分钟整数
295
295
  var roundedStartTime = _this3.roundUpToNext10Minutes(resourceStartTime);
296
296
  var roundedStartTimeDayjs = dayjs(roundedStartTime);
297
- console.log("[DateModule] \u4FEE\u6B63\u65F6\u95F4\u6BB5\u5F00\u59CB\u65F6\u95F4: ".concat(timeSlot.start_at, " -> ").concat(roundedStartTime, " (\u8D44\u6E90ID: ").concat(resource.id, ", \u539F\u59CBstart_time: ").concat(resource.start_time, ")"));
298
-
299
297
  // 将 start_at 修正为向上取整后的时间
300
298
  var correctedTimeSlot = _objectSpread(_objectSpread({}, timeSlot), {}, {
301
299
  start_at: roundedStartTime
@@ -303,7 +301,6 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
303
301
 
304
302
  // 检查修正后的 end_at 是否也早于修正后的 start_time
305
303
  if (endAt.isBefore(roundedStartTimeDayjs)) {
306
- console.log("[DateModule] \u65F6\u95F4\u6BB5\u65E0\u6548\uFF0C\u5C06\u88AB\u5220\u9664: ".concat(timeSlot.start_at, " - ").concat(timeSlot.end_at, " (\u8D44\u6E90ID: ").concat(resource.id, ", \u4FEE\u6B63\u540Estart_time: ").concat(roundedStartTime, ")"));
307
304
  return null; // 标记为删除
308
305
  }
309
306
  return correctedTimeSlot;
@@ -366,9 +363,8 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
366
363
  case 18:
367
364
  _context4.prev = 18;
368
365
  _context4.t0 = _context4["catch"](7);
369
- console.log('getAvailableTimeList_error', _context4.t0);
370
366
  return _context4.abrupt("return", disableAllDates(dates));
371
- case 22:
367
+ case 21:
372
368
  case "end":
373
369
  return _context4.stop();
374
370
  }
@@ -501,9 +501,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
501
501
  _context7.next = 4;
502
502
  return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
503
503
  case 4:
504
- console.log('[Discount] 已销毁');
505
504
  _get(_getPrototypeOf(DiscountModule.prototype), "destroy", this).call(this);
506
- case 6:
505
+ case 5:
507
506
  case "end":
508
507
  return _context7.stop();
509
508
  }
@@ -523,8 +522,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
523
522
  case 0:
524
523
  this.store.discountList = [];
525
524
  this.store.originalDiscountList = [];
526
- console.log('[Discount] clear');
527
- case 3:
525
+ case 2:
528
526
  case "end":
529
527
  return _context8.stop();
530
528
  }
@@ -1,9 +1,9 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
3
  import type { ScheduleModule } from '../Schedule';
4
- import type { OpenDataConfig, OpenDataFetchParams, OpenDataAvailabilityResult } from './types';
4
+ import type { OpenDataConfig, OpenDataFetchParams, OpenDataAvailabilityResult, InvoiceLayoutConfig, InvoiceTemplateSettings } from './types';
5
5
  export * from './types';
6
- export { computeAvailability } from './utils';
6
+ export { computeAvailability, getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeInvoiceLayoutConfig, normalizeInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings, } from './utils';
7
7
  export declare class OpenDataModule extends BaseModule implements Module {
8
8
  protected defaultName: string;
9
9
  protected defaultVersion: string;
@@ -15,6 +15,7 @@ export declare class OpenDataModule extends BaseModule implements Module {
15
15
  private openCache;
16
16
  private fatherModule;
17
17
  private otherParams;
18
+ private fetchRevision;
18
19
  constructor(name?: string, version?: string);
19
20
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
20
21
  /**
@@ -26,6 +27,8 @@ export declare class OpenDataModule extends BaseModule implements Module {
26
27
  updateOtherParams(params: Record<string, any>): void;
27
28
  fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
28
29
  getOpenData(): OpenDataConfig | null;
30
+ getInvoiceLayoutConfig(): InvoiceLayoutConfig;
31
+ getInvoiceTemplateSettings(): InvoiceTemplateSettings;
29
32
  getLastFetchedAt(): number | null;
30
33
  /** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
31
34
  clearCache(): void;
@@ -16,9 +16,9 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
16
16
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
17
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
18
  import { BaseModule } from "../BaseModule";
19
- import { computeAvailability } from "./utils";
19
+ import { computeAvailability, normalizeInvoiceLayoutConfig, normalizeInvoiceTemplateSettings } from "./utils";
20
20
  export * from "./types";
21
- export { computeAvailability } from "./utils";
21
+ export { computeAvailability, getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeInvoiceLayoutConfig, normalizeInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings } from "./utils";
22
22
  export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
23
23
  _inherits(OpenDataModule, _BaseModule);
24
24
  var _super = _createSuper(OpenDataModule);
@@ -36,6 +36,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
36
36
  _defineProperty(_assertThisInitialized(_this), "openCache", false);
37
37
  _defineProperty(_assertThisInitialized(_this), "fatherModule", void 0);
38
38
  _defineProperty(_assertThisInitialized(_this), "otherParams", {});
39
+ _defineProperty(_assertThisInitialized(_this), "fetchRevision", 0);
39
40
  return _this;
40
41
  }
41
42
  _createClass(OpenDataModule, [{
@@ -74,8 +75,6 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
74
75
  }
75
76
  throw new Error('OpenDataModule 需要 window 插件支持');
76
77
  case 14:
77
- console.log('[OpenDataModule] 初始化完成');
78
- case 15:
79
78
  case "end":
80
79
  return _context.stop();
81
80
  }
@@ -106,22 +105,23 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
106
105
  value: function () {
107
106
  var _fetchOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
108
107
  var _this$appPlugin, _this$appPlugin$getDa;
109
- var getData, shopId, tenantId, headers, response, data;
108
+ var fetchRevision, getData, shopId, tenantId, headers, response, data;
110
109
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
111
110
  while (1) switch (_context2.prev = _context2.next) {
112
111
  case 0:
112
+ fetchRevision = ++this.fetchRevision;
113
113
  getData = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getDa = _this$appPlugin.getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
114
114
  shopId = getData === null || getData === void 0 ? void 0 : getData('shop_id');
115
115
  if (shopId) {
116
- _context2.next = 4;
116
+ _context2.next = 5;
117
117
  break;
118
118
  }
119
119
  throw new Error('[OpenDataModule] 无法获取 shop_id');
120
- case 4:
120
+ case 5:
121
121
  tenantId = getData === null || getData === void 0 ? void 0 : getData('tenant_id');
122
122
  headers = {};
123
123
  if (tenantId) headers['Tenant-Id'] = String(tenantId);
124
- _context2.next = 9;
124
+ _context2.next = 10;
125
125
  return this.request.post("/open/my-pisell/".concat(shopId, "/setting"), {
126
126
  scope: params.scope,
127
127
  target: params.target,
@@ -132,17 +132,19 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
132
132
  prefix: false,
133
133
  headers: headers
134
134
  });
135
- case 9:
135
+ case 10:
136
136
  response = _context2.sent;
137
137
  if (!((response === null || response === void 0 ? void 0 : response.status) === false)) {
138
- _context2.next = 12;
138
+ _context2.next = 13;
139
139
  break;
140
140
  }
141
141
  throw new Error((response === null || response === void 0 ? void 0 : response.message) || '获取 OpenData 配置失败');
142
- case 12:
143
- data = (response === null || response === void 0 ? void 0 : response.data) || {};
144
- this.store.data = data;
145
- this.store.lastFetchedAt = Date.now();
142
+ case 13:
143
+ data = (response === null || response === void 0 ? void 0 : response.data) || {}; // clearCache() 或后续请求发生后,旧响应不得复活已失效的 target 配置。
144
+ if (fetchRevision === this.fetchRevision) {
145
+ this.store.data = data;
146
+ this.store.lastFetchedAt = Date.now();
147
+ }
146
148
  return _context2.abrupt("return", data);
147
149
  case 16:
148
150
  case "end":
@@ -160,6 +162,16 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
160
162
  value: function getOpenData() {
161
163
  return this.store.data;
162
164
  }
165
+ }, {
166
+ key: "getInvoiceLayoutConfig",
167
+ value: function getInvoiceLayoutConfig() {
168
+ return normalizeInvoiceLayoutConfig(this.store.data);
169
+ }
170
+ }, {
171
+ key: "getInvoiceTemplateSettings",
172
+ value: function getInvoiceTemplateSettings() {
173
+ return normalizeInvoiceTemplateSettings(this.store.data);
174
+ }
163
175
  }, {
164
176
  key: "getLastFetchedAt",
165
177
  value: function getLastFetchedAt() {
@@ -171,6 +183,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
171
183
  }, {
172
184
  key: "clearCache",
173
185
  value: function clearCache() {
186
+ this.fetchRevision += 1;
174
187
  this.store.data = null;
175
188
  this.store.lastFetchedAt = null;
176
189
  }
@@ -8,6 +8,40 @@ export interface MultiLangObject {
8
8
  original?: string;
9
9
  [key: string]: string | undefined;
10
10
  }
11
+ export declare const INVOICE_MODULE_KEYS: readonly ["reference", "brand", "custom_1", "order", "handover", "customer", "line_groups", "settlement", "custom_2", "payment", "card", "total_savings", "custom_3", "barcode"];
12
+ export type InvoiceModuleKey = (typeof INVOICE_MODULE_KEYS)[number];
13
+ /**
14
+ * Documents Registry 中的 Invoice 模块配置。
15
+ *
16
+ * 模块 key、显隐值及模块私有字段均由 Registry/Native 约定,OS 不做枚举收窄或改写。
17
+ */
18
+ export interface InvoiceTemplateModuleConfig {
19
+ key: string;
20
+ is_show?: unknown;
21
+ [key: string]: unknown;
22
+ }
23
+ export interface InvoiceModuleConfig extends InvoiceTemplateModuleConfig {
24
+ }
25
+ export interface InvoiceLayoutConfig {
26
+ locale?: string;
27
+ module: InvoiceModuleConfig[];
28
+ }
29
+ export interface InvoiceTemplateSettings {
30
+ template: string;
31
+ language: Record<string, number>;
32
+ modules: InvoiceTemplateModuleConfig[];
33
+ [key: string]: unknown;
34
+ }
35
+ export type RawInvoiceEditConfig = string | {
36
+ language?: unknown;
37
+ modules?: unknown;
38
+ [key: string]: unknown;
39
+ };
40
+ export type RawInvoiceLayoutConfig = string | {
41
+ locale?: unknown;
42
+ module?: unknown[];
43
+ [key: string]: unknown;
44
+ };
11
45
  export interface OpenDataConfig {
12
46
  'basic.enable'?: boolean;
13
47
  'basic.code'?: string | null;
@@ -45,6 +79,14 @@ export interface OpenDataConfig {
45
79
  label: string;
46
80
  value: number;
47
81
  }>;
82
+ 'documents.invoice_template'?: string;
83
+ 'documents.invoice_edit'?: RawInvoiceEditConfig;
84
+ /** @deprecated 仅保留旧调用方的类型兼容,Invoice 读取逻辑不再消费该字段。 */
85
+ 'documents.invoice'?: RawInvoiceLayoutConfig;
86
+ /** @deprecated Invoice 读取逻辑只消费扁平的 documents.invoice_* 字段。 */
87
+ documents?: {
88
+ invoice?: RawInvoiceLayoutConfig;
89
+ };
48
90
  [key: string]: any;
49
91
  }
50
92
  export interface OpenDataState {
@@ -1 +1,7 @@
1
- export {};
1
+ export var INVOICE_MODULE_KEYS = ['reference', 'brand', 'custom_1', 'order', 'handover', 'customer', 'line_groups', 'settlement', 'custom_2', 'payment', 'card', 'total_savings', 'custom_3', 'barcode'];
2
+
3
+ /**
4
+ * Documents Registry 中的 Invoice 模块配置。
5
+ *
6
+ * 模块 key、显隐值及模块私有字段均由 Registry/Native 约定,OS 不做枚举收窄或改写。
7
+ */
@@ -1,2 +1,16 @@
1
- import type { OpenDataAvailabilityResult, ComputeAvailabilityParams } from './types';
1
+ import type { OpenDataConfig, OpenDataAvailabilityResult, ComputeAvailabilityParams, InvoiceLayoutConfig, InvoiceTemplateSettings } from './types';
2
+ export declare function getDefaultInvoiceLayoutConfig(): InvoiceLayoutConfig;
3
+ export declare function getDefaultInvoiceTemplateSettings(): InvoiceTemplateSettings;
4
+ /**
5
+ * 规范化已经提取出的公开 template_settings 值,供打印入口复用。
6
+ */
7
+ export declare function normalizeRawInvoiceTemplateSettings(value: unknown): InvoiceTemplateSettings;
8
+ /**
9
+ * 从 OpenData Documents section 的两个扁平字段中构造 Native Invoice 配置。
10
+ */
11
+ export declare function normalizeInvoiceTemplateSettings(config: OpenDataConfig | null | undefined): InvoiceTemplateSettings;
12
+ /**
13
+ * 将 invoice_edit.modules 原样投影为 Web Invoice 使用的 module 字段。
14
+ */
15
+ export declare function normalizeInvoiceLayoutConfig(config: OpenDataConfig | null | undefined): InvoiceLayoutConfig;
2
16
  export declare function computeAvailability(params: ComputeAvailabilityParams): OpenDataAvailabilityResult;
@@ -1,6 +1,91 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
5
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
6
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
7
  import dayjs from 'dayjs';
3
8
  import { getDateIsInSchedule } from "../Schedule/getDateIsInSchedule";
9
+ function isRecord(value) {
10
+ return !!value && _typeof(value) === 'object' && !Array.isArray(value);
11
+ }
12
+ function parseInvoiceRecord(value) {
13
+ var parsed = value;
14
+ if (typeof parsed === 'string') {
15
+ try {
16
+ parsed = JSON.parse(parsed);
17
+ } catch (_unused) {
18
+ return null;
19
+ }
20
+ }
21
+ return isRecord(parsed) ? parsed : null;
22
+ }
23
+ export function getDefaultInvoiceLayoutConfig() {
24
+ return {
25
+ module: []
26
+ };
27
+ }
28
+ export function getDefaultInvoiceTemplateSettings() {
29
+ return {
30
+ template: 'DEFAULT',
31
+ language: {},
32
+ modules: []
33
+ };
34
+ }
35
+ function normalizeInvoiceTemplate(value) {
36
+ if (typeof value !== 'string' || value.trim().length === 0) return 'DEFAULT';
37
+ return value.trim().toUpperCase() === 'DEFAULT' ? 'DEFAULT' : value;
38
+ }
39
+ function normalizeInvoiceLanguage(value) {
40
+ if (!isRecord(value)) return {};
41
+ if (Object.values(value).some(function (item) {
42
+ return typeof item !== 'number';
43
+ })) return {};
44
+ return _objectSpread({}, value);
45
+ }
46
+ function normalizeInvoiceModules(value) {
47
+ if (!Array.isArray(value)) return [];
48
+ if (value.some(function (item) {
49
+ return !isRecord(item) || typeof item.key !== 'string';
50
+ })) {
51
+ return [];
52
+ }
53
+ return value.map(function (item) {
54
+ return _objectSpread({}, item);
55
+ });
56
+ }
57
+
58
+ /**
59
+ * 规范化已经提取出的公开 template_settings 值,供打印入口复用。
60
+ */
61
+ export function normalizeRawInvoiceTemplateSettings(value) {
62
+ var parsed = parseInvoiceRecord(value);
63
+ if (!parsed) return getDefaultInvoiceTemplateSettings();
64
+ return _objectSpread(_objectSpread({}, parsed), {}, {
65
+ template: normalizeInvoiceTemplate(parsed.template),
66
+ language: normalizeInvoiceLanguage(parsed.language),
67
+ modules: normalizeInvoiceModules(parsed.modules)
68
+ });
69
+ }
70
+
71
+ /**
72
+ * 从 OpenData Documents section 的两个扁平字段中构造 Native Invoice 配置。
73
+ */
74
+ export function normalizeInvoiceTemplateSettings(config) {
75
+ var parsedEdit = parseInvoiceRecord(config === null || config === void 0 ? void 0 : config['documents.invoice_edit']);
76
+ return normalizeRawInvoiceTemplateSettings(_objectSpread(_objectSpread({}, parsedEdit !== null && parsedEdit !== void 0 ? parsedEdit : {}), {}, {
77
+ template: normalizeInvoiceTemplate(config === null || config === void 0 ? void 0 : config['documents.invoice_template'])
78
+ }));
79
+ }
80
+
81
+ /**
82
+ * 将 invoice_edit.modules 原样投影为 Web Invoice 使用的 module 字段。
83
+ */
84
+ export function normalizeInvoiceLayoutConfig(config) {
85
+ return {
86
+ module: normalizeInvoiceTemplateSettings(config).modules
87
+ };
88
+ }
4
89
  function toBoolean(value) {
5
90
  if (typeof value === 'boolean') return value;
6
91
  if (typeof value === 'string') return value === 'true' || value === '1';
@@ -182,6 +182,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
182
182
  private calculateOrderPaidPaymentTotal;
183
183
  private getDepositAmount;
184
184
  private normalizeDepositAmount;
185
+ private normalizeDepositFlag;
186
+ private getHistoricalDepositSnapshot;
185
187
  private getLastOrderDepositSnapshot;
186
188
  private getLastOrderSubmitSnapshot;
187
189
  private applyDepositAmountToSummary;
@@ -526,7 +528,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
526
528
  generateIdempotencyToken(): string;
527
529
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
528
530
  createOrder(params: CommitOrderParams['query']): {
529
- type: "appointment_booking" | "virtual";
531
+ type: "virtual" | "appointment_booking";
530
532
  platform: string;
531
533
  sales_channel: string;
532
534
  order_sales_channel: string;
@@ -576,7 +578,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
576
578
  */
577
579
  hydrateTempOrderFromRecord(record: Record<string, any>, options?: {
578
580
  recalcOnHydrate?: boolean;
579
- source?: 'salesDetail' | 'sessionStorage';
581
+ source?: 'salesDetail' | 'mergedSalesDetail' | 'sessionStorage';
580
582
  }): Promise<OrderTempOrder>;
581
583
  /**
582
584
  * 兼容后端详情将 holder 放在 metadata.holder 的历史形态,统一补到运行时展示路径。