@pisell/pisellos 2.2.314 → 2.2.316

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 (268) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +3 -1
  3. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
  4. package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
  5. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
  6. package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
  7. package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
  8. package/dist/model/strategy/adapter/itemRule/type.js +10 -0
  9. package/dist/model/strategy/adapter/promotion/evaluator.js +89 -104
  10. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
  11. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +28 -4
  12. package/dist/modules/BookingContext/utils/productExtend.d.ts +7 -0
  13. package/dist/modules/BookingContext/utils/productExtend.js +62 -18
  14. package/dist/modules/BookingContext/utils/resources.js +1 -1
  15. package/dist/modules/BusinessAvailability/index.d.ts +30 -0
  16. package/dist/modules/BusinessAvailability/index.js +204 -0
  17. package/dist/modules/Cart/index.js +4 -3
  18. package/dist/modules/Cart/types.d.ts +2 -0
  19. package/dist/modules/Cart/utils/cartProduct.d.ts +3 -1
  20. package/dist/modules/Cart/utils/cartProduct.js +59 -32
  21. package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
  22. package/dist/modules/FulfillmentTiming/index.js +407 -0
  23. package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
  24. package/dist/modules/FulfillmentTiming/types.js +1 -0
  25. package/dist/modules/Holder/utils.d.ts +2 -0
  26. package/dist/modules/Holder/utils.js +32 -2
  27. package/dist/modules/OpenData/contactInfo.d.ts +20 -0
  28. package/dist/modules/OpenData/contactInfo.js +70 -0
  29. package/dist/modules/OpenData/index.d.ts +1 -0
  30. package/dist/modules/OpenData/index.js +1 -0
  31. package/dist/modules/OpenData/types.d.ts +23 -0
  32. package/dist/modules/Order/holderRelations.d.ts +14 -0
  33. package/dist/modules/Order/holderRelations.js +154 -0
  34. package/dist/modules/Order/index.d.ts +16 -4
  35. package/dist/modules/Order/index.js +926 -511
  36. package/dist/modules/Order/localEftposState.d.ts +13 -0
  37. package/dist/modules/Order/localEftposState.js +39 -0
  38. package/dist/modules/Order/pickupTiming.d.ts +46 -0
  39. package/dist/modules/Order/pickupTiming.js +53 -0
  40. package/dist/modules/Order/types.d.ts +49 -3
  41. package/dist/modules/Order/types.js +2 -0
  42. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
  43. package/dist/modules/Order/utils/discountProductLineIdentity.js +142 -7
  44. package/dist/modules/Order/utils/orderCollectionIdentity.js +24 -10
  45. package/dist/modules/Order/utils.d.ts +2 -1
  46. package/dist/modules/Order/utils.js +61 -17
  47. package/dist/modules/Payment/index.js +9 -10
  48. package/dist/modules/Product/types.d.ts +11 -0
  49. package/dist/modules/ProductList/index.js +1 -1
  50. package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
  51. package/dist/modules/ResourcePlanner/planner.js +332 -23
  52. package/dist/modules/ResourcePlanner/types.d.ts +29 -0
  53. package/dist/modules/Rules/index.js +62 -61
  54. package/dist/modules/Schedule/index.d.ts +8 -0
  55. package/dist/modules/Schedule/index.js +141 -39
  56. package/dist/modules/index.d.ts +1 -0
  57. package/dist/modules/index.js +1 -0
  58. package/dist/plugins/request.d.ts +7 -0
  59. package/dist/server/index.d.ts +1 -0
  60. package/dist/server/index.js +1557 -1322
  61. package/dist/server/modules/form/index.d.ts +19 -0
  62. package/dist/server/modules/form/index.js +205 -0
  63. package/dist/server/modules/form/types.d.ts +13 -0
  64. package/dist/server/modules/form/types.js +3 -0
  65. package/dist/server/modules/index.d.ts +3 -0
  66. package/dist/server/modules/index.js +4 -0
  67. package/dist/server/modules/order/index.d.ts +19 -0
  68. package/dist/server/modules/order/index.js +1071 -774
  69. package/dist/server/modules/order/types.d.ts +4 -0
  70. package/dist/server/modules/products/index.d.ts +28 -7
  71. package/dist/server/modules/products/index.js +1297 -770
  72. package/dist/server/modules/products/replication.d.ts +8 -0
  73. package/dist/server/modules/products/replication.js +69 -0
  74. package/dist/server/modules/products/types.d.ts +12 -1
  75. package/dist/server/modules/products/types.js +4 -0
  76. package/dist/server/test.json +1 -1
  77. package/dist/server/utils/small-ticket.d.ts +1 -85
  78. package/dist/server/utils/small-ticket.js +2 -2542
  79. package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
  80. package/dist/shared/payment/loadPaymentMethods.js +66 -0
  81. package/dist/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
  82. package/dist/shared/receipt/customerInvoiceLanguages.js +60 -0
  83. package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
  84. package/dist/shared/receipt/loadCustomerInvoiceLayout.js +184 -0
  85. package/dist/shared/receipt/small-ticket.d.ts +96 -0
  86. package/dist/shared/receipt/small-ticket.js +2763 -0
  87. package/dist/shared/receipt/templateVisibility.d.ts +26 -0
  88. package/dist/shared/receipt/templateVisibility.js +68 -0
  89. package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
  90. package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
  91. package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
  92. package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
  93. package/dist/solution/BaseSales/index.d.ts +43 -16
  94. package/dist/solution/BaseSales/index.js +2028 -1247
  95. package/dist/solution/BaseSales/pickupTiming.d.ts +47 -0
  96. package/dist/solution/BaseSales/pickupTiming.js +616 -0
  97. package/dist/solution/BaseSales/types.d.ts +12 -0
  98. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
  99. package/dist/solution/BaseSales/utils/parseSalesResponse.js +10 -3
  100. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -4
  101. package/dist/solution/BookingByStep/index.d.ts +4 -2
  102. package/dist/solution/BookingByStep/index.js +8 -3
  103. package/dist/solution/BookingTicket/index.d.ts +23 -3
  104. package/dist/solution/BookingTicket/index.js +867 -507
  105. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
  106. package/dist/solution/BookingTicket/utils/addProductDecision.js +1 -1
  107. package/dist/solution/BookingTicket/utils/cartView.js +3 -1
  108. package/dist/solution/OrderInvoicePreview/index.d.ts +66 -0
  109. package/dist/solution/OrderInvoicePreview/index.js +340 -0
  110. package/dist/solution/RegisterAndLogin/config.js +54 -11
  111. package/dist/solution/RegisterAndLogin/index.d.ts +2 -0
  112. package/dist/solution/RegisterAndLogin/index.js +1 -1
  113. package/dist/solution/RegisterAndLogin/utils.d.ts +12 -4
  114. package/dist/solution/RegisterAndLogin/utils.js +36 -16
  115. package/dist/solution/ScanOrder/index.js +65 -31
  116. package/dist/solution/ScanOrder/types.d.ts +3 -0
  117. package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
  118. package/dist/solution/UnifiedBookingSales/businessAvailability.js +292 -0
  119. package/dist/solution/UnifiedBookingSales/index.d.ts +36 -4
  120. package/dist/solution/UnifiedBookingSales/index.js +1715 -906
  121. package/dist/solution/UnifiedBookingSales/types.d.ts +16 -2
  122. package/dist/solution/VenueBooking/index.d.ts +15 -2
  123. package/dist/solution/VenueBooking/index.js +1062 -785
  124. package/dist/solution/VenueBooking/types.d.ts +2 -1
  125. package/dist/solution/VenueBooking/types.js +1 -0
  126. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  127. package/dist/solution/VenueBooking/utils/dateSummary.js +7 -4
  128. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
  129. package/dist/solution/VenueBooking/utils/smartPricing.js +273 -0
  130. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
  131. package/dist/solution/VenueBooking/utils/timeSlot.js +6 -3
  132. package/dist/solution/index.d.ts +1 -0
  133. package/dist/solution/index.js +2 -1
  134. package/lib/index.d.ts +2 -0
  135. package/lib/index.js +21 -1
  136. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
  137. package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
  138. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
  139. package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
  140. package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
  141. package/lib/model/strategy/adapter/itemRule/type.js +10 -0
  142. package/lib/model/strategy/adapter/promotion/evaluator.js +9 -14
  143. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  144. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
  145. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +17 -1
  146. package/lib/modules/BookingContext/utils/productExtend.d.ts +7 -0
  147. package/lib/modules/BookingContext/utils/productExtend.js +45 -2
  148. package/lib/modules/BookingContext/utils/resources.js +1 -1
  149. package/lib/modules/BusinessAvailability/index.d.ts +30 -0
  150. package/lib/modules/BusinessAvailability/index.js +146 -0
  151. package/lib/modules/Cart/index.js +4 -2
  152. package/lib/modules/Cart/types.d.ts +2 -0
  153. package/lib/modules/Cart/utils/cartProduct.d.ts +3 -1
  154. package/lib/modules/Cart/utils/cartProduct.js +39 -20
  155. package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
  156. package/lib/modules/FulfillmentTiming/index.js +359 -0
  157. package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
  158. package/lib/modules/FulfillmentTiming/types.js +5 -0
  159. package/lib/modules/Holder/utils.d.ts +2 -0
  160. package/lib/modules/Holder/utils.js +27 -1
  161. package/lib/modules/OpenData/contactInfo.d.ts +20 -0
  162. package/lib/modules/OpenData/contactInfo.js +56 -0
  163. package/lib/modules/OpenData/index.d.ts +1 -0
  164. package/lib/modules/OpenData/index.js +12 -0
  165. package/lib/modules/OpenData/types.d.ts +23 -0
  166. package/lib/modules/Order/holderRelations.d.ts +14 -0
  167. package/lib/modules/Order/holderRelations.js +98 -0
  168. package/lib/modules/Order/index.d.ts +16 -4
  169. package/lib/modules/Order/index.js +284 -50
  170. package/lib/modules/Order/localEftposState.d.ts +13 -0
  171. package/lib/modules/Order/localEftposState.js +44 -0
  172. package/lib/modules/Order/pickupTiming.d.ts +46 -0
  173. package/lib/modules/Order/pickupTiming.js +61 -0
  174. package/lib/modules/Order/types.d.ts +49 -3
  175. package/lib/modules/Order/types.js +1 -0
  176. package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
  177. package/lib/modules/Order/utils/discountProductLineIdentity.js +51 -2
  178. package/lib/modules/Order/utils/orderCollectionIdentity.js +5 -0
  179. package/lib/modules/Order/utils.d.ts +2 -1
  180. package/lib/modules/Order/utils.js +49 -11
  181. package/lib/modules/Payment/index.js +3 -4
  182. package/lib/modules/Product/types.d.ts +11 -0
  183. package/lib/modules/ProductList/index.js +1 -1
  184. package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
  185. package/lib/modules/ResourcePlanner/planner.js +252 -8
  186. package/lib/modules/ResourcePlanner/types.d.ts +29 -0
  187. package/lib/modules/Rules/index.js +2 -1
  188. package/lib/modules/Schedule/index.d.ts +8 -0
  189. package/lib/modules/Schedule/index.js +68 -12
  190. package/lib/modules/index.d.ts +1 -0
  191. package/lib/modules/index.js +11 -0
  192. package/lib/plugins/request.d.ts +7 -0
  193. package/lib/server/index.d.ts +1 -0
  194. package/lib/server/index.js +166 -39
  195. package/lib/server/modules/form/index.d.ts +19 -0
  196. package/lib/server/modules/form/index.js +73 -0
  197. package/lib/server/modules/form/types.d.ts +13 -0
  198. package/lib/server/modules/form/types.js +9 -0
  199. package/lib/server/modules/index.d.ts +3 -0
  200. package/lib/server/modules/index.js +15 -1
  201. package/lib/server/modules/order/index.d.ts +19 -0
  202. package/lib/server/modules/order/index.js +160 -7
  203. package/lib/server/modules/order/types.d.ts +4 -0
  204. package/lib/server/modules/products/index.d.ts +28 -7
  205. package/lib/server/modules/products/index.js +226 -63
  206. package/lib/server/modules/products/replication.d.ts +8 -0
  207. package/lib/server/modules/products/replication.js +30 -0
  208. package/lib/server/modules/products/types.d.ts +12 -1
  209. package/lib/server/modules/products/types.js +3 -0
  210. package/lib/server/test.json +1 -1
  211. package/lib/server/utils/small-ticket.d.ts +1 -85
  212. package/lib/server/utils/small-ticket.js +9 -2305
  213. package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
  214. package/lib/shared/payment/loadPaymentMethods.js +40 -0
  215. package/lib/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
  216. package/lib/shared/receipt/customerInvoiceLanguages.js +58 -0
  217. package/lib/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
  218. package/lib/shared/receipt/loadCustomerInvoiceLayout.js +124 -0
  219. package/lib/shared/receipt/small-ticket.d.ts +96 -0
  220. package/lib/shared/receipt/small-ticket.js +2555 -0
  221. package/lib/shared/receipt/templateVisibility.d.ts +26 -0
  222. package/lib/shared/receipt/templateVisibility.js +67 -0
  223. package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
  224. package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
  225. package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
  226. package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
  227. package/lib/solution/BaseSales/index.d.ts +43 -16
  228. package/lib/solution/BaseSales/index.js +401 -33
  229. package/lib/solution/BaseSales/pickupTiming.d.ts +47 -0
  230. package/lib/solution/BaseSales/pickupTiming.js +290 -0
  231. package/lib/solution/BaseSales/types.d.ts +12 -0
  232. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
  233. package/lib/solution/BaseSales/utils/parseSalesResponse.js +7 -0
  234. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -8
  235. package/lib/solution/BookingByStep/index.d.ts +4 -2
  236. package/lib/solution/BookingByStep/index.js +7 -3
  237. package/lib/solution/BookingTicket/index.d.ts +23 -3
  238. package/lib/solution/BookingTicket/index.js +197 -9
  239. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
  240. package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -1
  241. package/lib/solution/BookingTicket/utils/cartView.js +3 -1
  242. package/lib/solution/OrderInvoicePreview/index.d.ts +66 -0
  243. package/lib/solution/OrderInvoicePreview/index.js +246 -0
  244. package/lib/solution/RegisterAndLogin/config.js +57 -11
  245. package/lib/solution/RegisterAndLogin/index.d.ts +2 -0
  246. package/lib/solution/RegisterAndLogin/index.js +9 -1
  247. package/lib/solution/RegisterAndLogin/utils.d.ts +12 -4
  248. package/lib/solution/RegisterAndLogin/utils.js +24 -17
  249. package/lib/solution/ScanOrder/index.js +59 -20
  250. package/lib/solution/ScanOrder/types.d.ts +3 -0
  251. package/lib/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
  252. package/lib/solution/UnifiedBookingSales/businessAvailability.js +138 -0
  253. package/lib/solution/UnifiedBookingSales/index.d.ts +36 -4
  254. package/lib/solution/UnifiedBookingSales/index.js +562 -75
  255. package/lib/solution/UnifiedBookingSales/types.d.ts +16 -2
  256. package/lib/solution/VenueBooking/index.d.ts +15 -2
  257. package/lib/solution/VenueBooking/index.js +243 -96
  258. package/lib/solution/VenueBooking/types.d.ts +2 -1
  259. package/lib/solution/VenueBooking/types.js +1 -0
  260. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  261. package/lib/solution/VenueBooking/utils/dateSummary.js +7 -4
  262. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
  263. package/lib/solution/VenueBooking/utils/smartPricing.js +224 -0
  264. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
  265. package/lib/solution/VenueBooking/utils/timeSlot.js +5 -2
  266. package/lib/solution/index.d.ts +1 -0
  267. package/lib/solution/index.js +11 -0
  268. package/package.json +1 -1
@@ -24,10 +24,18 @@ class ScheduleModule extends _BaseModule.BaseModule {
24
24
  openCache = false;
25
25
  fatherModule;
26
26
  hasLoadedScheduleList = false;
27
+ scheduleListPromise = null;
28
+ scheduleListRequestVersion = 0;
29
+ scheduleCatalogScope = '';
30
+ otherParams = {};
27
31
  constructor(name, version) {
28
32
  super(name, version);
29
33
  }
30
34
  async initialize(core, options) {
35
+ // The store proxies initialState, so capture its input before resets write through it.
36
+ const initialScheduleList = options.initialState?.scheduleList;
37
+ const hasInitialScheduleList = Array.isArray(initialScheduleList);
38
+ this.resetScheduleCatalog();
31
39
  this.core = core;
32
40
 
33
41
  // 获取依赖的插件
@@ -40,24 +48,18 @@ class ScheduleModule extends _BaseModule.BaseModule {
40
48
  // this.state = { ...this.state, ...options.initialState }
41
49
  // }
42
50
  this.store = options?.store;
51
+ this.updateOtherParams(options.otherParams || {});
43
52
  if (options.initialState) {
44
- this.store.scheduleList = options.initialState.scheduleList;
53
+ this.store.scheduleList = hasInitialScheduleList ? initialScheduleList : [];
45
54
  this.syncScheduleMap();
46
55
  this.store.availabilityDateList = options.initialState.availabilityDateList;
47
- this.hasLoadedScheduleList = Array.isArray(options.initialState.scheduleList);
56
+ this.hasLoadedScheduleList = hasInitialScheduleList;
48
57
  } else {
49
58
  this.store.scheduleList = [];
50
59
  this.store.map = new Map();
51
60
  this.store.availabilityDateList = [];
52
61
  this.hasLoadedScheduleList = false;
53
62
  }
54
- if (options.otherParams?.cacheId) {
55
- this.openCache = options.otherParams.openCache;
56
- this.cacheId = options.otherParams.cacheId;
57
- }
58
- if (options.otherParams?.fatherModule) {
59
- this.fatherModule = options.otherParams.fatherModule;
60
- }
61
63
  }
62
64
 
63
65
  /**
@@ -68,9 +70,34 @@ class ScheduleModule extends _BaseModule.BaseModule {
68
70
  */
69
71
  updateOtherParams(params) {
70
72
  const otherParams = params || {};
73
+ this.otherParams = {
74
+ ...otherParams
75
+ };
71
76
  this.openCache = otherParams.openCache ?? false;
72
77
  this.cacheId = otherParams.cacheId;
73
78
  this.fatherModule = otherParams.fatherModule;
79
+ this.syncScheduleCatalogScope();
80
+ }
81
+ syncScheduleCatalogScope() {
82
+ const context = this.core?.context;
83
+ const shopId = typeof context?.getData === 'function' ? context.getData('shop_id') : context?.shop_id;
84
+ const params = this.otherParams;
85
+ const scope = JSON.stringify([this.cacheId, this.fatherModule, params.businessCode ?? params.business_code, params.channel, params.platform, params.businessTimezone, shopId].map(value => String(value ?? '').trim()));
86
+ if (scope !== this.scheduleCatalogScope) {
87
+ this.resetScheduleCatalog();
88
+ this.scheduleCatalogScope = scope;
89
+ }
90
+ }
91
+ resetScheduleCatalog() {
92
+ this.scheduleListRequestVersion += 1;
93
+ this.scheduleListPromise = null;
94
+ this.hasLoadedScheduleList = false;
95
+ this.store.scheduleList = [];
96
+ this.store.map = new Map();
97
+ }
98
+ destroy() {
99
+ this.resetScheduleCatalog();
100
+ super.destroy();
74
101
  }
75
102
 
76
103
  /**
@@ -79,14 +106,40 @@ class ScheduleModule extends _BaseModule.BaseModule {
79
106
  * @memberof ScheduleModule
80
107
  */
81
108
  async loadAllSchedule(options = {}) {
82
- const scheduleList = await this.request.get(`/schedule`, {
109
+ this.syncScheduleCatalogScope();
110
+ const useCache = options.useCache ?? true;
111
+ if (useCache) {
112
+ if (this.scheduleListPromise) return this.scheduleListPromise;
113
+ if (this.hasLoadedScheduleList) return;
114
+ }
115
+ const requestVersion = ++this.scheduleListRequestVersion;
116
+ const promise = this.loadScheduleCatalog(useCache, requestVersion);
117
+ this.scheduleListPromise = promise;
118
+ try {
119
+ await promise;
120
+ } finally {
121
+ if (this.scheduleListPromise === promise) {
122
+ this.scheduleListPromise = null;
123
+ }
124
+ }
125
+ }
126
+ async loadScheduleCatalog(useCache, requestVersion) {
127
+ const response = await this.request.get(`/schedule`, {
83
128
  num: 999
84
129
  }, {
85
- useCache: options.useCache ?? true
130
+ useCache
86
131
  });
87
- this.setScheduleList(scheduleList.data?.list || []);
132
+ if (response.code !== undefined && Number(response.code) !== 200 || response.status === false || typeof response.status === 'number' && response.status >= 400 || response.success === false) {
133
+ throw new Error(response.message || 'Schedule catalog request failed');
134
+ }
135
+ this.syncScheduleCatalogScope();
136
+ // A refresh or a different runtime may have superseded this request.
137
+ if (requestVersion === this.scheduleListRequestVersion) {
138
+ this.setScheduleList(response.data?.list || []);
139
+ }
88
140
  }
89
141
  setScheduleList(list) {
142
+ this.syncScheduleCatalogScope();
90
143
  this.store.scheduleList = list;
91
144
  this.syncScheduleMap();
92
145
  this.hasLoadedScheduleList = true;
@@ -95,9 +148,11 @@ class ScheduleModule extends _BaseModule.BaseModule {
95
148
  this.store.map = new Map((this.store.scheduleList || []).map(schedule => [Number(schedule.id), schedule]));
96
149
  }
97
150
  getScheduleList() {
151
+ this.syncScheduleCatalogScope();
98
152
  return this.store.scheduleList || [];
99
153
  }
100
154
  isScheduleListLoaded() {
155
+ this.syncScheduleCatalogScope();
101
156
  return this.hasLoadedScheduleList;
102
157
  }
103
158
  async loadScheduleAvailableDate({
@@ -149,6 +204,7 @@ class ScheduleModule extends _BaseModule.BaseModule {
149
204
  return dates;
150
205
  }
151
206
  getScheduleListByIds(ids) {
207
+ this.syncScheduleCatalogScope();
152
208
  const idSet = new Set(ids.map(id => String(id)));
153
209
  if (this.store.map instanceof Map && this.store.map.size > 0) {
154
210
  return ids.map(id => this.store.map.get(Number(id))).filter(Boolean);
@@ -17,6 +17,7 @@ export * from './Schedule';
17
17
  export * from './Quotation';
18
18
  export * from './ScanOrderLogger';
19
19
  export * from './OpenData';
20
+ export * from './FulfillmentTiming';
20
21
  export * from './BookingContext';
21
22
  export * from './Holder';
22
23
  export * from './ResourcePlanner';
@@ -212,6 +212,17 @@ Object.keys(_OpenData).forEach(function (key) {
212
212
  }
213
213
  });
214
214
  });
215
+ var _FulfillmentTiming = require("./FulfillmentTiming");
216
+ Object.keys(_FulfillmentTiming).forEach(function (key) {
217
+ if (key === "default" || key === "__esModule") return;
218
+ if (key in exports && exports[key] === _FulfillmentTiming[key]) return;
219
+ Object.defineProperty(exports, key, {
220
+ enumerable: true,
221
+ get: function () {
222
+ return _FulfillmentTiming[key];
223
+ }
224
+ });
225
+ });
215
226
  var _BookingContext = require("./BookingContext");
216
227
  Object.keys(_BookingContext).forEach(function (key) {
217
228
  if (key === "default" || key === "__esModule") return;
@@ -56,6 +56,13 @@ export interface CacheProps {
56
56
  * 请求配置
57
57
  */
58
58
  export interface RequestOptions {
59
+ /** Customer-only, credential-free GET /open/document/{id} on picoding. */
60
+ publicInvoiceDocument?: boolean;
61
+ /** Route through the host's configured picoding environment. */
62
+ pisell2?: boolean;
63
+ /** Let the caller handle read-only preview failures without host navigation/toasts. */
64
+ manualErrorHandling?: boolean;
65
+ skipErrorHandler?: boolean;
59
66
  url?: string;
60
67
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
61
68
  headers?: Record<string, string>;
@@ -499,6 +499,7 @@ declare class Server {
499
499
  private buildLocalPaymentSurchargeUpdate;
500
500
  private handleGetLocalPayment;
501
501
  private handleUpdateLocalPayment;
502
+ private handleFinalizeLocalEftposPayment;
502
503
  private runLocalPaymentUpdateInQueue;
503
504
  private processLocalPaymentUpdate;
504
505
  private processSuccessfulLocalPayment;
@@ -7,6 +7,7 @@ var _exportNames = {};
7
7
  exports.default = void 0;
8
8
  var _dayjs = _interopRequireDefault(require("dayjs"));
9
9
  var _decimal = _interopRequireDefault(require("decimal.js"));
10
+ var _localEftposState = require("../modules/Order/localEftposState");
10
11
  var _lodashEs = require("lodash-es");
11
12
  var _products = require("./modules/products");
12
13
  var _menu = require("./modules/menu");
@@ -16,6 +17,7 @@ var _resource = require("./modules/resource");
16
17
  var _floorPlan = require("./modules/floor-plan");
17
18
  var _types = require("./modules/floor-plan/types");
18
19
  var _payment = require("./modules/payment");
20
+ var _form = require("./modules/form");
19
21
  var _schedule2 = require("./utils/schedule");
20
22
  var _time = require("./utils/time");
21
23
  var _types2 = require("./modules/products/types");
@@ -25,6 +27,7 @@ var _types3 = require("./modules/order/types");
25
27
  var _filterOrders = require("./modules/order/utils/filterOrders");
26
28
  var _filterBookings = require("./modules/order/utils/filterBookings");
27
29
  var _smallTicket = require("./utils/small-ticket");
30
+ var _templateVisibility = require("../shared/receipt/templateVisibility");
28
31
  var _BaseSales = require("../solution/BaseSales");
29
32
  var _paymentUtils = require("../modules/Order/payment-utils");
30
33
  var _salesNotes = require("../modules/Order/salesNotes");
@@ -181,6 +184,16 @@ class Server {
181
184
  payMethods: []
182
185
  }
183
186
  },
187
+ form: {
188
+ name: 'form',
189
+ moduleClass: _form.FormModule,
190
+ moduleName: 'server_form',
191
+ version: '1.0.0',
192
+ defaultStore: {
193
+ list: [],
194
+ map: new Map()
195
+ }
196
+ },
184
197
  resource: {
185
198
  name: 'resource',
186
199
  moduleClass: _resource.ResourceModule,
@@ -527,7 +540,7 @@ class Server {
527
540
 
528
541
  // 监听 ProductsModule 同步完成事件,重新计算并推送查询结果
529
542
  this.core.effects.on(_types2.ProductsHooks.onProductsSyncCompleted, payload => {
530
- this.recomputeAndNotifyProductQuery({
543
+ return this.recomputeAndNotifyProductQuery({
531
544
  changedIds: payload?.changedIds
532
545
  });
533
546
  });
@@ -645,7 +658,7 @@ class Server {
645
658
  const normalizedData = await this.normalizeCheckoutSubmitData(params.data, title);
646
659
  const numberedData = await this.ensureCheckoutOrderNumbers(normalizedData, title);
647
660
  const checkoutData = this.normalizeCheckoutCollections((0, _osPrivatePayload.stripOsPrivatePayloadFields)(this.applyCheckoutFulfillmentBuzzer(numberedData, title)));
648
- const remoteCheckoutData = this.buildRemoteCheckoutData(checkoutData, title);
661
+ const remoteCheckoutData = (0, _localEftposState.stripLocalEftposState)(this.buildRemoteCheckoutData(checkoutData, title));
649
662
  const deviceHeaders = await this.buildCheckoutDeviceHeaders(title);
650
663
  if (!this.app?.request?.post) {
651
664
  throw new Error('app.request 不可用');
@@ -783,7 +796,7 @@ class Server {
783
796
  }
784
797
  const freshPayments = freshRecord.payments;
785
798
  const mergedPayments = (0, _paymentUtils.mergeOrderPaymentListsByIdentity)(localPayments, freshPayments, {
786
- preserveUnmatchedExistingWhen: _paymentUtils.isIdentifiedPendingOrderPayment
799
+ preserveUnmatchedExistingWhen: payment => (0, _paymentUtils.isIdentifiedPendingOrderPayment)(payment) || (0, _localEftposState.isLocalFinalizedPayment)(payment)
787
800
  });
788
801
  const remoteIdentityKeys = new Set(freshPayments.flatMap(payment => (0, _paymentUtils.getOrderPaymentIdentityKeys)(payment)));
789
802
  const preservedPending = localPayments.filter(payment => (0, _paymentUtils.isIdentifiedPendingOrderPayment)(payment) && !(0, _paymentUtils.getOrderPaymentIdentityKeys)(payment).some(key => remoteIdentityKeys.has(key)));
@@ -823,6 +836,9 @@ class Server {
823
836
  need_sync: 0,
824
837
  is_draft_order: 0
825
838
  };
839
+ if (!Array.isArray(fresh.holder_relations) && Array.isArray(checkoutData?.holder_relations)) {
840
+ syncedOrder.holder_relations = (0, _lodashEs.cloneDeep)(checkoutData.holder_relations);
841
+ }
826
842
  await this.order.upsertOrdersFromRemote([syncedOrder], 'checkoutSync');
827
843
  this.logInfo(`${title}: sync_sales 完整订单已同步到本地`, {
828
844
  order_id: fresh.order_id,
@@ -1336,6 +1352,19 @@ class Server {
1336
1352
  method: 'post',
1337
1353
  path: '/shop/local/updateLocalPayment',
1338
1354
  handler: this.handleUpdateLocalPayment.bind(this)
1355
+ }, {
1356
+ method: 'post',
1357
+ path: '/shop/local/finalizeLocalEftposPayment',
1358
+ handler: this.handleFinalizeLocalEftposPayment.bind(this)
1359
+ }, {
1360
+ method: 'post',
1361
+ path: '/shop/local/orderPaymentReadiness',
1362
+ handler: async ({
1363
+ data
1364
+ }) => ({
1365
+ code: 200,
1366
+ data: await this.order?.getLocalOrderForPaymentReadiness(data?.sale_id)
1367
+ })
1339
1368
  }, {
1340
1369
  method: 'post',
1341
1370
  path: '/shop/machinecode/batch',
@@ -2997,7 +3026,7 @@ class Server {
2997
3026
  data: null
2998
3027
  };
2999
3028
  }
3000
- const queueKey = `${String(saleId)}:${String(paymentNumber)}`;
3029
+ const queueKey = String(saleId);
3001
3030
  return this.runLocalPaymentUpdateInQueue(queueKey, () => this.processLocalPaymentUpdate({
3002
3031
  operationId,
3003
3032
  saleId,
@@ -3009,6 +3038,42 @@ class Server {
3009
3038
  hasSurchargeInput
3010
3039
  }), requestContext);
3011
3040
  };
3041
+ handleFinalizeLocalEftposPayment = async ({
3042
+ data
3043
+ }) => {
3044
+ const {
3045
+ sale_id: saleId,
3046
+ payment_number: paymentNumber,
3047
+ result,
3048
+ failed_transaction_numbers: numbers = []
3049
+ } = data || {};
3050
+ if (!saleId || !paymentNumber || !Array.isArray(numbers) || numbers.some(number => typeof number !== 'string' || !number.trim()) || result !== 'failed' && result !== 'not_started' || result === 'failed' && numbers.length === 0 || result === 'not_started' && numbers.length !== 0) {
3051
+ return {
3052
+ code: 400,
3053
+ status: false,
3054
+ message: '缺少明确的支付结果或交易编号',
3055
+ data: null
3056
+ };
3057
+ }
3058
+ return this.runLocalPaymentUpdateInQueue(String(saleId), async () => {
3059
+ if (!this.order) throw new Error('Order 模块未注册');
3060
+ const finalized = await this.order.finalizeLocalEftposPayment({
3061
+ saleId,
3062
+ paymentNumber,
3063
+ result,
3064
+ failedTransactionNumbers: [...new Set(numbers)]
3065
+ });
3066
+ return {
3067
+ code: 200,
3068
+ status: true,
3069
+ local_only: true,
3070
+ data: finalized
3071
+ };
3072
+ }, {
3073
+ sale_id: saleId,
3074
+ payment_number: paymentNumber
3075
+ });
3076
+ };
3012
3077
  async runLocalPaymentUpdateInQueue(key, task, context) {
3013
3078
  const queuedAt = Date.now();
3014
3079
  const hasPreviousTask = this.localPaymentUpdateQueues.has(key);
@@ -3768,7 +3833,7 @@ class Server {
3768
3833
  device_id: debugDeviceId,
3769
3834
  payload: {
3770
3835
  backendPath: params.backendPath,
3771
- data: params.data,
3836
+ data: (0, _localEftposState.stripLocalEftposState)(params.data),
3772
3837
  invoice: this.normalizePrintInvoiceLayoutConfig(params.invoiceLayoutConfig),
3773
3838
  template_settings: this.normalizePrintInvoiceTemplateSettings(params.invoiceTemplateSettings),
3774
3839
  external_sale_number: params.data?.external_sale_number,
@@ -3851,7 +3916,8 @@ class Server {
3851
3916
  }
3852
3917
  const printableOrder = await this.withLocalSmallTicketData(params.order, {
3853
3918
  requireFullyPaid: params.requireFullyPaid,
3854
- invoiceTemplateSettings: params.invoiceTemplateSettings
3919
+ invoiceTemplateSettings: params.invoiceTemplateSettings,
3920
+ applyTemplateVisibility: true
3855
3921
  });
3856
3922
  if (!(0, _smallTicket.hasSmallTicketData)(printableOrder.payment_info?.small_ticket_data)) {
3857
3923
  return {
@@ -3873,9 +3939,11 @@ class Server {
3873
3939
  invoiceLayoutConfig: params.invoiceLayoutConfig,
3874
3940
  invoiceTemplateSettings: params.invoiceTemplateSettings
3875
3941
  });
3942
+ // Receipt visibility belongs to this output only. Do not return a filtered
3943
+ // snapshot to callers that may retain the order for later sync or reprints.
3876
3944
  return {
3877
3945
  printed: true,
3878
- order: printableOrder
3946
+ order: (0, _templateVisibility.requiresInvoiceDataFiltering)(params.invoiceTemplateSettings) ? params.order : printableOrder
3879
3947
  };
3880
3948
  }
3881
3949
  shouldLookupLocalPrintOrder(input) {
@@ -4084,7 +4152,10 @@ class Server {
4084
4152
  small_ticket_data_flag: 1,
4085
4153
  payment_info: paymentInfo
4086
4154
  }, {
4087
- locales: this.normalizeRequestedReceiptLocales(input.locales)
4155
+ locales: this.normalizeRequestedReceiptLocales(input.locales),
4156
+ invoiceTemplateSettings: input.template_settings === undefined ? undefined : this.normalizePrintInvoiceTemplateSettings(input.template_settings),
4157
+ applyTemplateVisibility: true,
4158
+ includeReceiptKeys: input.template_settings !== undefined
4088
4159
  });
4089
4160
  const smallTicketData = rebuiltOrder.payment_info?.small_ticket_data;
4090
4161
  if (!(0, _smallTicket.hasSmallTicketData)(smallTicketData)) {
@@ -4102,7 +4173,17 @@ class Server {
4102
4173
  status: true,
4103
4174
  message: '',
4104
4175
  data: {
4105
- small_ticket_data: smallTicketData
4176
+ small_ticket_data: smallTicketData,
4177
+ template_visibility_applied: true,
4178
+ // These products and currency settings are the exact source used for
4179
+ // this receipt, not the potentially newer active tempOrder.
4180
+ source: {
4181
+ ...rebuiltOrder,
4182
+ payment_info: {
4183
+ ...(rebuiltOrder.payment_info || {}),
4184
+ small_ticket_data: undefined
4185
+ }
4186
+ }
4106
4187
  }
4107
4188
  };
4108
4189
  } catch (error) {
@@ -4307,6 +4388,16 @@ class Server {
4307
4388
  backendPath,
4308
4389
  title
4309
4390
  } = params;
4391
+ const lookup = params.data?.order_id || params.data?.external_sale_number;
4392
+ const localOrder = lookup && (await this.order?.getLocalOrderByLookup?.(lookup));
4393
+ if ((0, _localEftposState.requiresLocalPaymentRefresh)(params.data) || (0, _localEftposState.requiresLocalPaymentRefresh)(localOrder)) {
4394
+ return {
4395
+ code: 409,
4396
+ status: false,
4397
+ message: _localEftposState.PAYMENT_REFRESH_MESSAGE,
4398
+ data: null
4399
+ };
4400
+ }
4310
4401
  const extractedInvoice = this.extractInvoiceLayoutConfig(params.data, {
4311
4402
  includePublicInvoice: true
4312
4403
  });
@@ -4343,15 +4434,24 @@ class Server {
4343
4434
  });
4344
4435
  if (pendingResult?.status === true) {
4345
4436
  const pendingOrder = pendingResult.data;
4346
- if (pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder) && this.shouldAutoPrintCheckoutReceipt()) {
4347
- await this.dispatchLocalReceiptPrint({
4348
- checkoutData,
4349
- order: pendingOrder,
4350
- response: pendingResult,
4351
- requireFullyPaid: true,
4352
- invoiceLayoutConfig,
4353
- invoiceTemplateSettings
4354
- });
4437
+ if (pendingOrder && this.shouldBuildSmallTicketData(checkoutData, invoiceTemplateSettings) && this.isSalesOrderFullyPaid(pendingOrder) && this.shouldAutoPrintCheckoutReceipt()) {
4438
+ try {
4439
+ await this.dispatchLocalReceiptPrint({
4440
+ checkoutData,
4441
+ order: pendingOrder,
4442
+ response: pendingResult,
4443
+ requireFullyPaid: true,
4444
+ invoiceLayoutConfig,
4445
+ invoiceTemplateSettings
4446
+ });
4447
+ } catch (error) {
4448
+ // The sale is already persisted. A failed receipt must not cancel its
4449
+ // sync task or send an unfiltered fallback to the printer.
4450
+ pendingResult.receipt_print_error = this.getUnknownErrorMessage(error);
4451
+ this.logError(`${title}: 小票生成失败,订单仍继续同步`, {
4452
+ error: pendingResult.receipt_print_error
4453
+ });
4454
+ }
4355
4455
  }
4356
4456
  await this.dispatchCheckoutSyncTask({
4357
4457
  backendPath,
@@ -4409,16 +4509,24 @@ class Server {
4409
4509
  }
4410
4510
  const response = this.withSyncedOrderIdInCheckoutResponse(syncResult.normalizedResponse, syncResult.syncedOrder);
4411
4511
  const syncedOrder = syncResult.syncedOrder;
4412
- if (syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData) && this.isSalesOrderFullyPaid(syncedOrder)) {
4413
- await this.dispatchLocalReceiptPrint({
4414
- checkoutData: syncResult.checkoutData,
4415
- order: syncedOrder,
4416
- response: syncResult.normalizedResponse,
4417
- requireFullyPaid: true,
4418
- invoiceLayoutConfig,
4419
- invoiceTemplateSettings
4420
- // print_all 的 type=0 是收据打印;不要沿用同步成功后的券/手环打印 type=99。
4421
- });
4512
+ if (syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData, invoiceTemplateSettings) && this.isSalesOrderFullyPaid(syncedOrder)) {
4513
+ try {
4514
+ await this.dispatchLocalReceiptPrint({
4515
+ checkoutData: syncResult.checkoutData,
4516
+ order: syncedOrder,
4517
+ response: syncResult.normalizedResponse,
4518
+ requireFullyPaid: true,
4519
+ invoiceLayoutConfig,
4520
+ invoiceTemplateSettings
4521
+ });
4522
+ } catch (error) {
4523
+ // Checkout already succeeded remotely; report the receipt failure
4524
+ // separately instead of implying that payment/order creation failed.
4525
+ response.receipt_print_error = this.getUnknownErrorMessage(error);
4526
+ this.logError(`${title}: 小票生成失败,订单已同步`, {
4527
+ error: response.receipt_print_error
4528
+ });
4529
+ }
4422
4530
  }
4423
4531
  return response;
4424
4532
  } catch (error) {
@@ -4627,10 +4735,12 @@ class Server {
4627
4735
  if (this.core.context?.getPlatform?.() !== 'android') return true;
4628
4736
  return this.app?.storage?.getStorage?.(AUTO_PRINT_STORAGE_KEY) !== 'false';
4629
4737
  }
4630
- shouldBuildSmallTicketData(order) {
4738
+ shouldBuildSmallTicketData(order, invoiceTemplateSettings) {
4631
4739
  if (!order || typeof order !== 'object') return false;
4632
- // if (hasSmallTicketData(order.payment_info?.small_ticket_data)) return false;
4633
- return Number(order.small_ticket_data_flag ?? order.smallTicketDataFlag ?? 0) === 1;
4740
+ const flag = order.small_ticket_data_flag ?? order.smallTicketDataFlag;
4741
+ // A synced order can omit the generation flag; required display filtering
4742
+ // still rebuilds its output. An explicit 0 retains the no-auto-print intent.
4743
+ return Number(flag ?? 0) === 1 || flag == null && (0, _templateVisibility.requiresInvoiceDataFiltering)(invoiceTemplateSettings);
4634
4744
  }
4635
4745
  shouldPrintSyncedOrder(params) {
4636
4746
  if (this.hasPaymentStatus(params.syncedOrder)) {
@@ -4934,7 +5044,8 @@ class Server {
4934
5044
  }
4935
5045
  }
4936
5046
  async withLocalSmallTicketData(order, options) {
4937
- if (!this.shouldBuildSmallTicketData(order)) return order;
5047
+ const mustApplyVisibility = options?.applyTemplateVisibility === true && (0, _templateVisibility.requiresInvoiceDataFiltering)(options.invoiceTemplateSettings);
5048
+ if (!this.shouldBuildSmallTicketData(order) && !mustApplyVisibility) return order;
4938
5049
  if (options?.requireFullyPaid && !this.isSalesOrderFullyPaid(order)) return order;
4939
5050
  try {
4940
5051
  const normalizedCollections = (0, _orderCollectionIdentity.normalizeOrderCollections)(order, {
@@ -4958,7 +5069,9 @@ class Server {
4958
5069
  order: enrichedOrder,
4959
5070
  shopInfo: this.getSmallTicketShopInfo(),
4960
5071
  locales: [...(0, _OpenData.resolveInvoiceReceiptLocales)(options?.invoiceTemplateSettings), ...(options?.locales || [])],
4961
- productMap
5072
+ productMap,
5073
+ includeReceiptKeys: options?.includeReceiptKeys,
5074
+ templateSettings: options?.applyTemplateVisibility ? options.invoiceTemplateSettings : undefined
4962
5075
  });
4963
5076
  return {
4964
5077
  ...enrichedOrder,
@@ -4971,6 +5084,7 @@ class Server {
4971
5084
  this.logError('withLocalSmallTicketData: 生成本地小票数据失败', {
4972
5085
  error: error instanceof Error ? error.message : String(error)
4973
5086
  });
5087
+ if (mustApplyVisibility) throw error;
4974
5088
  return order;
4975
5089
  }
4976
5090
  }
@@ -5032,7 +5146,15 @@ class Server {
5032
5146
  order: null
5033
5147
  };
5034
5148
  }
5035
- await this.order.upsertOrdersFromRemote([fresh]);
5149
+ const localBeforeRefresh = this.order.getLocalOrderFromMemoryByLookup?.(lookup) || (this.shouldForceRemoteSalesDetail(data) ? await this.order.getLocalOrderByLookup(lookup) : null);
5150
+ if ((0, _localEftposState.requiresLocalPaymentRefresh)(localBeforeRefresh)) {
5151
+ if (String(fresh.order_id) !== String(localBeforeRefresh.order_id)) {
5152
+ throw new Error('远端订单身份不匹配,请重新刷新');
5153
+ }
5154
+ await this.order.completeLocalPaymentRefresh(fresh);
5155
+ } else {
5156
+ await this.order.upsertOrdersFromRemote([fresh]);
5157
+ }
5036
5158
  let savedOrder = await this.order.getLocalOrderByLookup(lookup);
5037
5159
  if (!savedOrder && fresh.order_id !== undefined && fresh.order_id !== null && String(fresh.order_id) !== String(lookup)) {
5038
5160
  savedOrder = await this.order.getLocalOrderByLookup(fresh.order_id);
@@ -5349,7 +5471,7 @@ class Server {
5349
5471
  }
5350
5472
  buildOrderSalesDetailBackendPath(lookup, data) {
5351
5473
  const rawWith = data && typeof data === 'object' ? data.with : undefined;
5352
- const withFields = Array.isArray(rawWith) && rawWith.length > 0 ? rawWith : ['products', 'scheduleEvents'];
5474
+ const withFields = Array.isArray(rawWith) && rawWith.length > 0 ? rawWith : ['all'];
5353
5475
  const searchParams = new URLSearchParams();
5354
5476
  withFields.forEach(field => {
5355
5477
  if (field === undefined || field === null || field === '') return;
@@ -5383,6 +5505,9 @@ class Server {
5383
5505
  if (fresh.order_number !== undefined && fresh.order_number !== null) {
5384
5506
  patch.order_number = fresh.order_number;
5385
5507
  }
5508
+ if (Array.isArray(fresh.holder_relations)) {
5509
+ patch.holder_relations = (0, _lodashEs.cloneDeep)(fresh.holder_relations);
5510
+ }
5386
5511
  return patch;
5387
5512
  }
5388
5513
  buildSyncedOrderForPrint(params) {
@@ -5750,9 +5875,11 @@ class Server {
5750
5875
 
5751
5876
  // 使用 filterOrders 进行过滤、排序、分页
5752
5877
  const result = (0, _filterOrders.filterOrders)(rawList, data);
5753
- result.list.forEach(order => {
5754
- order.payments = order.payments?.filter(payment => !(0, _paymentUtils.isPendingOrderPayment)(payment));
5755
- });
5878
+ // filterOrders retains store object references; hide pending only in the list response.
5879
+ result.list = result.list.map(order => ({
5880
+ ...order,
5881
+ payments: order.payments?.filter(payment => !(0, _paymentUtils.isPendingOrderPayment)(payment))
5882
+ }));
5756
5883
  this.logInfo('computeOrderQueryResult: 过滤结果', {
5757
5884
  rawCount: rawList.length,
5758
5885
  filteredCount: result.count,
@@ -6120,7 +6247,7 @@ class Server {
6120
6247
  const result = await this.computeProductQueryResult(subscriber.context, {
6121
6248
  changedIds: options?.changedIds
6122
6249
  });
6123
- subscriber.callback(result);
6250
+ await subscriber.callback(result);
6124
6251
  this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
6125
6252
  subscriberId
6126
6253
  });
@@ -0,0 +1,19 @@
1
+ import { BaseModule } from '../../../modules/BaseModule';
2
+ import type { Module, ModuleOptions, PisellCore } from '../../../types';
3
+ /**
4
+ * 表单定义缓存。数据源负责 HTTP 与 Ably 订阅;本模块仅向 OS 消费方公开只读标题映射。
5
+ */
6
+ export declare class FormModule extends BaseModule implements Module {
7
+ protected defaultName: string;
8
+ protected defaultVersion: string;
9
+ private store;
10
+ private dataSource;
11
+ private refreshTimer?;
12
+ initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
13
+ preload(): Promise<void>;
14
+ getTitleMap(): Record<string, Record<string, string> | string>;
15
+ private scheduleRefresh;
16
+ private refresh;
17
+ destroy(): Promise<void>;
18
+ }
19
+ export default FormModule;