@pisell/pisellos 2.2.323 → 2.2.325

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 (199) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/inventory/index.d.ts +92 -0
  4. package/dist/inventory/index.js +509 -0
  5. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  6. package/dist/modules/BookingContext/index.d.ts +2 -2
  7. package/dist/modules/BookingContext/index.js +55 -25
  8. package/dist/modules/BookingContext/types.d.ts +2 -0
  9. package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
  10. package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
  11. package/dist/modules/BookingContext/utils/index.d.ts +1 -0
  12. package/dist/modules/BookingContext/utils/index.js +1 -0
  13. package/dist/modules/BookingContext/utils/productExtend.d.ts +20 -1
  14. package/dist/modules/BookingContext/utils/productExtend.js +122 -29
  15. package/dist/modules/Date/index.d.ts +1 -1
  16. package/dist/modules/Date/index.js +60 -14
  17. package/dist/modules/Date/types.d.ts +5 -0
  18. package/dist/modules/Discount/index.js +1 -0
  19. package/dist/modules/OpenData/index.d.ts +1 -0
  20. package/dist/modules/OpenData/index.js +1 -0
  21. package/dist/modules/OpenData/salesSettings.d.ts +32 -0
  22. package/dist/modules/OpenData/salesSettings.js +80 -0
  23. package/dist/modules/OpenData/types.d.ts +16 -0
  24. package/dist/modules/OpenData/utils.d.ts +1 -1
  25. package/dist/modules/OpenData/utils.js +3 -2
  26. package/dist/modules/Order/index.d.ts +55 -12
  27. package/dist/modules/Order/index.js +2699 -1411
  28. package/dist/modules/Order/types.d.ts +43 -5
  29. package/dist/modules/Order/types.js +4 -0
  30. package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
  31. package/dist/modules/Order/unpaidAmountGap.js +72 -0
  32. package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
  33. package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  34. package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
  35. package/dist/modules/Order/utils.d.ts +3 -1
  36. package/dist/modules/Order/utils.js +6 -2
  37. package/dist/modules/Product/index.d.ts +1 -1
  38. package/dist/modules/ProductList/clientDataVariants.js +6 -2
  39. package/dist/modules/ProductList/index.d.ts +2 -0
  40. package/dist/modules/ProductList/index.js +161 -51
  41. package/dist/modules/ResourcePlanner/planner.js +58 -2
  42. package/dist/modules/ResourcePlanner/types.d.ts +13 -0
  43. package/dist/modules/Rules/index.d.ts +2 -0
  44. package/dist/modules/Rules/index.js +58 -39
  45. package/dist/modules/Schedule/index.d.ts +7 -1
  46. package/dist/modules/Schedule/index.js +155 -39
  47. package/dist/modules/Schedule/types.d.ts +2 -0
  48. package/dist/modules/bookingReadValidation.d.ts +6 -0
  49. package/dist/modules/bookingReadValidation.js +72 -0
  50. package/dist/plugins/request.d.ts +2 -0
  51. package/dist/server/index.d.ts +8 -0
  52. package/dist/server/index.js +1458 -1166
  53. package/dist/server/modules/order/index.js +2 -1
  54. package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
  55. package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
  56. package/dist/shared/receipt/small-ticket.d.ts +4 -0
  57. package/dist/shared/receipt/small-ticket.js +70 -12
  58. package/dist/solution/BaseSales/index.d.ts +39 -5
  59. package/dist/solution/BaseSales/index.js +1828 -1462
  60. package/dist/solution/BaseSales/types.d.ts +1 -0
  61. package/dist/solution/BaseSales/types.js +1 -0
  62. package/dist/solution/BookingByStep/index.d.ts +16 -2
  63. package/dist/solution/BookingByStep/index.js +676 -361
  64. package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
  65. package/dist/solution/BookingByStep/utils/resources.js +117 -76
  66. package/dist/solution/BookingTicket/index.d.ts +15 -3
  67. package/dist/solution/BookingTicket/index.js +249 -135
  68. package/dist/solution/BookingTicket/types.d.ts +14 -2
  69. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
  70. package/dist/solution/BookingTicket/utils/addProductDecision.js +39 -11
  71. package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
  72. package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
  73. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
  74. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +88 -0
  75. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  76. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  77. package/dist/solution/OrderInvoicePreview/index.js +14 -8
  78. package/dist/solution/ScanOrder/index.d.ts +2 -0
  79. package/dist/solution/ScanOrder/index.js +166 -67
  80. package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
  81. package/dist/solution/ScanOrder/menuAvailability.js +363 -0
  82. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  83. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
  84. package/dist/solution/UnifiedBookingSales/index.d.ts +96 -4
  85. package/dist/solution/UnifiedBookingSales/index.js +3374 -1177
  86. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
  87. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
  88. package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
  89. package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
  90. package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  91. package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
  92. package/dist/solution/UnifiedBookingSales/types.d.ts +71 -2
  93. package/dist/solution/UnifiedBookingSales/types.js +7 -1
  94. package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  95. package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +283 -0
  96. package/dist/utils/platform.d.ts +2 -0
  97. package/dist/utils/platform.js +6 -0
  98. package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
  99. package/dist/utils/pos-receipt-auto-print.js +14 -0
  100. package/lib/index.d.ts +1 -0
  101. package/lib/index.js +12 -0
  102. package/lib/inventory/index.d.ts +92 -0
  103. package/lib/inventory/index.js +287 -0
  104. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  105. package/lib/modules/BookingContext/index.d.ts +2 -2
  106. package/lib/modules/BookingContext/index.js +42 -10
  107. package/lib/modules/BookingContext/types.d.ts +2 -0
  108. package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
  109. package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
  110. package/lib/modules/BookingContext/utils/index.d.ts +1 -0
  111. package/lib/modules/BookingContext/utils/index.js +11 -0
  112. package/lib/modules/BookingContext/utils/productExtend.d.ts +20 -1
  113. package/lib/modules/BookingContext/utils/productExtend.js +96 -7
  114. package/lib/modules/Date/index.d.ts +1 -1
  115. package/lib/modules/Date/index.js +28 -5
  116. package/lib/modules/Date/types.d.ts +5 -0
  117. package/lib/modules/Discount/index.js +1 -0
  118. package/lib/modules/OpenData/index.d.ts +1 -0
  119. package/lib/modules/OpenData/index.js +12 -0
  120. package/lib/modules/OpenData/salesSettings.d.ts +32 -0
  121. package/lib/modules/OpenData/salesSettings.js +70 -0
  122. package/lib/modules/OpenData/types.d.ts +16 -0
  123. package/lib/modules/OpenData/utils.d.ts +1 -1
  124. package/lib/modules/OpenData/utils.js +3 -2
  125. package/lib/modules/Order/index.d.ts +55 -12
  126. package/lib/modules/Order/index.js +659 -80
  127. package/lib/modules/Order/types.d.ts +43 -5
  128. package/lib/modules/Order/types.js +2 -0
  129. package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
  130. package/lib/modules/Order/unpaidAmountGap.js +60 -0
  131. package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
  132. package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  133. package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
  134. package/lib/modules/Order/utils.d.ts +3 -1
  135. package/lib/modules/Order/utils.js +6 -2
  136. package/lib/modules/Product/index.d.ts +1 -1
  137. package/lib/modules/ProductList/clientDataVariants.js +6 -2
  138. package/lib/modules/ProductList/index.d.ts +2 -0
  139. package/lib/modules/ProductList/index.js +74 -0
  140. package/lib/modules/ResourcePlanner/planner.js +52 -1
  141. package/lib/modules/ResourcePlanner/types.d.ts +13 -0
  142. package/lib/modules/Rules/index.d.ts +2 -0
  143. package/lib/modules/Rules/index.js +25 -9
  144. package/lib/modules/Schedule/index.d.ts +7 -1
  145. package/lib/modules/Schedule/index.js +68 -4
  146. package/lib/modules/Schedule/types.d.ts +2 -0
  147. package/lib/modules/bookingReadValidation.d.ts +6 -0
  148. package/lib/modules/bookingReadValidation.js +56 -0
  149. package/lib/plugins/request.d.ts +2 -0
  150. package/lib/server/index.d.ts +8 -0
  151. package/lib/server/index.js +194 -19
  152. package/lib/server/modules/order/index.js +2 -1
  153. package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
  154. package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
  155. package/lib/shared/receipt/small-ticket.d.ts +4 -0
  156. package/lib/shared/receipt/small-ticket.js +63 -8
  157. package/lib/solution/BaseSales/index.d.ts +39 -5
  158. package/lib/solution/BaseSales/index.js +212 -18
  159. package/lib/solution/BaseSales/types.d.ts +1 -0
  160. package/lib/solution/BaseSales/types.js +1 -0
  161. package/lib/solution/BookingByStep/index.d.ts +16 -2
  162. package/lib/solution/BookingByStep/index.js +222 -14
  163. package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
  164. package/lib/solution/BookingByStep/utils/resources.js +25 -15
  165. package/lib/solution/BookingTicket/index.d.ts +15 -3
  166. package/lib/solution/BookingTicket/index.js +47 -4
  167. package/lib/solution/BookingTicket/types.d.ts +14 -2
  168. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
  169. package/lib/solution/BookingTicket/utils/addProductDecision.js +37 -6
  170. package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
  171. package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
  172. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
  173. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +54 -0
  174. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  175. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  176. package/lib/solution/OrderInvoicePreview/index.js +7 -1
  177. package/lib/solution/ScanOrder/index.d.ts +2 -0
  178. package/lib/solution/ScanOrder/index.js +72 -2
  179. package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
  180. package/lib/solution/ScanOrder/menuAvailability.js +203 -0
  181. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  182. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
  183. package/lib/solution/UnifiedBookingSales/index.d.ts +96 -4
  184. package/lib/solution/UnifiedBookingSales/index.js +1316 -73
  185. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
  186. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
  187. package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
  188. package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
  189. package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  190. package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
  191. package/lib/solution/UnifiedBookingSales/types.d.ts +71 -2
  192. package/lib/solution/UnifiedBookingSales/types.js +4 -1
  193. package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  194. package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +155 -0
  195. package/lib/utils/platform.d.ts +2 -0
  196. package/lib/utils/platform.js +7 -0
  197. package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
  198. package/lib/utils/pos-receipt-auto-print.js +13 -0
  199. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { InventoryController, type CheckoutRuntimeSnapshot } from '../../inventory';
1
2
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
3
  import { BaseModule } from '../../modules/BaseModule';
3
4
  import { type LocalEftposFinalization } from '../../modules/Order/localEftposState';
@@ -6,12 +7,13 @@ import { OrderModule } from '../../modules/Order';
6
7
  import { type PickupTimingBookingInput } from '../../modules/Order/pickupTiming';
7
8
  import type { PickupTimingAvailability, PickupTimingSelection, PickupTimingValidationResult } from '../../modules/FulfillmentTiming';
8
9
  import { type ContactInfoConfig } from '../../modules/OpenData/contactInfo';
9
- import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, ShopServiceData, ShopServiceType } from '../../modules/Order/types';
10
+ import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductsOptions, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, ShopServiceData, ShopServiceType } from '../../modules/Order/types';
10
11
  import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
11
12
  import type { Discount, VirtualCurrencyAsset } from '../../modules/Discount/types';
12
13
  import { RequestPlugin, WindowPlugin } from '../../plugins';
13
14
  export * from './types';
14
15
  import { ProductList } from '../../modules/ProductList';
16
+ import { type PosReceiptAutoPrintPaymentStatus } from '../../utils/pos-receipt-auto-print';
15
17
  import { PaymentModule } from '../../modules/Payment';
16
18
  import type { PaymentMethod, RoundingResult, WalletAssetId, WalletAssetsBehaviorOptions, WalletAssetsSnapshot, WalletAssetsState, WalletAssetSelectionSource, ScanWalletAssetResult } from '../../modules/Payment/types';
17
19
  import type { SalesSummaryModule } from '../../modules/SalesSummary';
@@ -52,6 +54,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
52
54
  protected appPlugin: AppPlugin;
53
55
  protected store: BaseSalesState;
54
56
  protected otherParams: Record<string, any>;
57
+ getInventory(): InventoryController | undefined;
58
+ prepareCheckout(signal?: AbortSignal): Promise<CheckoutRuntimeSnapshot | undefined>;
55
59
  protected cacheId: string | undefined;
56
60
  /**
57
61
  * 由已在初始化阶段解析过设备短号的业务解决方案写入。
@@ -66,6 +70,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
66
70
  request: RequestPlugin;
67
71
  protected currentSalesDetail: ISalesDetail | null;
68
72
  protected discountConfigCacheKey: string | null;
73
+ private discountConfigPrepareInFlight;
69
74
  protected hasManualDiscountSelection: boolean;
70
75
  private readonly reusedSharedSubModuleNames;
71
76
  private paymentMethodsCache;
@@ -78,6 +83,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
78
83
  private salesDetailHydrateQueue;
79
84
  private serverOrderChangeUnsubscribe;
80
85
  private paymentMethodsChangedUnsubscribe;
86
+ private orderSessionChangedUnsubscribe;
81
87
  private serverOrderChangeHydrateInFlight;
82
88
  private queuedServerOrderChanges;
83
89
  private serverOrderChangeSyncEnabled;
@@ -112,6 +118,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
112
118
  private syncCurrentSalesDetailFromServerOrderChange;
113
119
  private registerServerOrderChangeSync;
114
120
  private registerPaymentMethodsChangeSync;
121
+ private registerOrderSessionChangeSync;
115
122
  private hydrateLatestLoadedSalesDetail;
116
123
  private hydrateOrderPaymentNames;
117
124
  get payment(): PaymentModule | undefined;
@@ -129,7 +136,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
129
136
  * /product/query 的智能定价评估只读取 strategy_context;
130
137
  * application_code 仅作为接口兼容字段,不能替代 channel / business_code。
131
138
  */
132
- private getPriceQueryStrategyContext;
139
+ protected getPriceQueryStrategyContext(channel?: string): Record<string, any>;
133
140
  /**
134
141
  * 子类可在商品重报价前准备客户维度的策略上下文,例如等待 Wallet/优惠资产加载。
135
142
  */
@@ -156,6 +163,12 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
156
163
  private prepareRawProductForPriceQuery;
157
164
  private resolveLocalProductForPriceQuery;
158
165
  private loadProductsForPriceQuery;
166
+ /** Opt-in subclasses may supply page-owned raw pools; ordinary sales keep remote fallback. */
167
+ protected isVenueCatalogLocalPricingActive(): boolean;
168
+ protected getVenueCatalogLocalPriceSource(_productId: number, _selectedProduct?: Record<string, any>): {
169
+ product: Record<string, any>;
170
+ menuList: Record<string, any>[];
171
+ } | undefined;
159
172
  private resolveProductsForPriceQuery;
160
173
  private getAuthoritativeBundleItems;
161
174
  private findAuthoritativeBundleItem;
@@ -187,6 +200,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
187
200
  private getFulfillmentRefMode;
188
201
  private getCachedInvoiceLayoutConfig;
189
202
  private getCachedInvoiceTemplateSettings;
203
+ /** Only solutions with a current POS business configuration opt into this receipt policy. */
204
+ protected getPosReceiptAutoPrintPaymentStatuses(): PosReceiptAutoPrintPaymentStatus[] | undefined;
190
205
  private buildSubmitPayloadEnhancerWithOpenDataConfig;
191
206
  /**
192
207
  * 工厂入口:根据子模块名实例化对应模块。
@@ -194,6 +209,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
194
209
  * 可覆盖此方法并把未识别的 name 委托给 `super.createSubModule(name)`。
195
210
  */
196
211
  protected createSubModule(moduleName: string): Module | null;
212
+ private inventoryOrderHooks?;
197
213
  protected getSubModuleHooks(moduleName: string): any;
198
214
  /**
199
215
  * 构造传给 BaseSales 子模块的完整运行态参数,保证初始化和后续同步语义一致。
@@ -231,7 +247,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
231
247
  private isActiveVirtualSettlementOrder;
232
248
  private isHistoricalVirtualSettlementOrder;
233
249
  private syncAppDataToTempOrder;
250
+ private initialization?;
251
+ /** Hosts can await readiness without changing Core's synchronous registration API. */
252
+ whenInitialized(): Promise<void>;
234
253
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
254
+ private initializeSalesRuntime;
235
255
  destroy(): Promise<void>;
236
256
  /**
237
257
  * 加载销售订单到统一 tempOrder 工作区。
@@ -256,6 +276,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
256
276
  /** 获取附加费用(运费/服务费/税费等)。 */
257
277
  getSurcharges(): ISalesSurcharge[];
258
278
  getTempOrder(): OrderTempOrder | null;
279
+ getOrderSessionId(): string | null;
280
+ isOrderSessionCurrent(sessionId: string): boolean;
259
281
  replaceTempOrder(tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions): Promise<OrderTempOrder>;
260
282
  getOrderIdentity(): import("../../modules/Order/types").OrderIdentitySnapshot | null;
261
283
  getOrderSnapshot(): import("../../modules/Order/types").OrderSnapshot | null;
@@ -294,7 +316,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
294
316
  saveDraft(): Promise<void>;
295
317
  restoreOrder(): Promise<OrderTempOrder>;
296
318
  /**
297
- * 仅清空 tempOrder 购物车行(products / bookings / discount_list)。
319
+ * 清空 tempOrder 购物车行(products / bookings / discount_list)及整单折扣。
298
320
  * 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
299
321
  */
300
322
  clearOrderCartLines(): Promise<OrderTempOrder>;
@@ -340,7 +362,9 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
340
362
  discountList: Discount[];
341
363
  originalDiscountList?: Discount[];
342
364
  }): Promise<void>;
343
- scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
365
+ scanPromotionCode(code: string, customerId?: number, options?: {
366
+ productVouchersOnly?: boolean;
367
+ }): Promise<BaseSalesScanCodeResult>;
344
368
  setDiscountSelected(params: {
345
369
  discountId: number;
346
370
  isSelected: boolean;
@@ -520,15 +544,25 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
520
544
  submitBeforeSend?: boolean;
521
545
  }): Promise<T>;
522
546
  transformBaseProductToOrderProduct(params: TransformBaseProductToOrderProductParams): import("./utils/transformBaseProductToOrderProduct").BaseProductOrderProductInput | null;
547
+ /** Explicit pool source avoids races between two simultaneous Venue pricing contexts. */
548
+ protected calculateVenueCatalogProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams, source: {
549
+ product: Record<string, any>;
550
+ menuList: Record<string, any>[];
551
+ }): Promise<BaseSalesProductBookingPriceResult>;
523
552
  calculateProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams): Promise<BaseSalesProductBookingPriceResult>;
524
553
  getQuotationCustomerScopeInfo(): BaseSalesQuotationCustomerScopeInfo;
525
554
  private hasSmartPricingStrategies;
526
555
  shouldRecalculateProductBookingPricesForContextChange(params: BaseSalesPriceRecalculationContextChange): boolean;
527
556
  private resolveProductBookingPriceGroups;
528
557
  calculateProductBookingPrices(paramsList: BaseSalesCalculateProductBookingPriceParams[]): Promise<BaseSalesProductBookingPriceResult[]>;
558
+ setProductVoucherGroups(groups: Array<{
559
+ key: string;
560
+ discountIds: Array<number | string>;
561
+ }>): void;
562
+ validateProductVoucherSelection(): void;
529
563
  addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
530
564
  updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
531
- updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
565
+ updateOrderProducts(paramsList: UpdateOrderProductParams[], options?: UpdateOrderProductsOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
532
566
  updateOrderProductQuantity(params: BaseSalesUpdateOrderProductQuantityParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
533
567
  updateOrderBooking(params: UpdateOrderBookingParams): any[];
534
568
  /**
@@ -7,6 +7,7 @@ var _exportNames = {
7
7
  BaseSalesImpl: true
8
8
  };
9
9
  exports.BaseSalesImpl = void 0;
10
+ var _inventory = require("../../inventory");
10
11
  var _BaseModule = require("../../modules/BaseModule");
11
12
  var _localEftposState = require("../../modules/Order/localEftposState");
12
13
  var _types = require("./types");
@@ -39,6 +40,7 @@ var _orderCollectionIdentity = require("../../modules/Order/utils/orderCollectio
39
40
  var _dayjs = _interopRequireDefault(require("dayjs"));
40
41
  var _clientDataVariants = require("../../modules/ProductList/clientDataVariants");
41
42
  var _platform = require("../../utils/platform");
43
+ var _posReceiptAutoPrint = require("../../utils/pos-receipt-auto-print");
42
44
  var _Quotation = require("../../modules/Quotation");
43
45
  var _transformBaseProductToOrderProduct = require("./utils/transformBaseProductToOrderProduct");
44
46
  var _quotationPrice = require("./utils/quotationPrice");
@@ -512,6 +514,40 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
512
514
  order: undefined
513
515
  };
514
516
  otherParams = {};
517
+ getInventory() {
518
+ return this.otherParams.inventory;
519
+ }
520
+ async prepareCheckout(signal) {
521
+ const inventory = this.getInventory();
522
+ const hooks = this.otherParams.checkoutHooks;
523
+ if (!inventory && !hooks?.beforeCheckout) return undefined;
524
+ if (!this.store.order) throw new Error('Order module is not ready');
525
+ return this.store.order.prepareCheckout(async items => {
526
+ const assertCurrent = () => {
527
+ if (signal?.aborted) throw Object.assign(new Error('Checkout cancelled'), {
528
+ name: 'AbortError'
529
+ });
530
+ if (inventory !== this.getInventory() || hooks !== this.otherParams.checkoutHooks) throw (0, _inventory.salesGuardError)('The sales context changed. Please try again.');
531
+ };
532
+ assertCurrent();
533
+ try {
534
+ await hooks?.beforeCheckout?.({
535
+ items,
536
+ signal
537
+ });
538
+ if (inventory) await inventory.refresh({
539
+ reason: 'checkout',
540
+ force: true,
541
+ signal
542
+ });
543
+ assertCurrent();
544
+ return inventory?.freezeCheckout(items);
545
+ } catch (error) {
546
+ if (error?.name === 'AbortError') throw error;
547
+ throw (0, _inventory.salesGuardError)(error instanceof Error ? error.message : String(error));
548
+ }
549
+ });
550
+ }
515
551
  cacheId;
516
552
  /**
517
553
  * 由已在初始化阶段解析过设备短号的业务解决方案写入。
@@ -528,6 +564,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
528
564
  // 当前缓存中已加载的最新 SalesDetail;只读 getter 走它对外暴露详情数据。
529
565
  currentSalesDetail = null;
530
566
  discountConfigCacheKey = null;
567
+ discountConfigPrepareInFlight = null;
531
568
  hasManualDiscountSelection = false;
532
569
  reusedSharedSubModuleNames = new Set();
533
570
  paymentMethodsCache = [];
@@ -540,6 +577,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
540
577
  salesDetailHydrateQueue = Promise.resolve();
541
578
  serverOrderChangeUnsubscribe = null;
542
579
  paymentMethodsChangedUnsubscribe = null;
580
+ orderSessionChangedUnsubscribe = null;
543
581
  serverOrderChangeHydrateInFlight = null;
544
582
  queuedServerOrderChanges = [];
545
583
  serverOrderChangeSyncEnabled = false;
@@ -700,6 +738,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
700
738
  await this.getPaymentMethodsAsync();
701
739
  });
702
740
  }
741
+ registerOrderSessionChangeSync() {
742
+ this.orderSessionChangedUnsubscribe?.();
743
+ this.orderSessionChangedUnsubscribe = this.store.order?.effectsOn?.('onOrderSessionChanged', payload => this.effectsEmit(_types.BaseSalesHookNames.onOrderSessionChanged, payload)) || null;
744
+ }
703
745
  async hydrateLatestLoadedSalesDetail(record, loadSequence, options) {
704
746
  let hydratedSales = null;
705
747
  let skippedBeforeHydrate = false;
@@ -1017,6 +1059,9 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1017
1059
  products: [preparedProduct],
1018
1060
  queryPayload: params.queryPayload,
1019
1061
  handledByOsServer: false,
1062
+ ...(params.menuList ? {
1063
+ menuList: params.menuList
1064
+ } : {}),
1020
1065
  ...(scheduleList ? {
1021
1066
  scheduleList
1022
1067
  } : {})
@@ -1072,6 +1117,14 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1072
1117
  return productsById;
1073
1118
  }
1074
1119
  }
1120
+
1121
+ /** Opt-in subclasses may supply page-owned raw pools; ordinary sales keep remote fallback. */
1122
+ isVenueCatalogLocalPricingActive() {
1123
+ return false;
1124
+ }
1125
+ getVenueCatalogLocalPriceSource(_productId, _selectedProduct) {
1126
+ return undefined;
1127
+ }
1075
1128
  async resolveProductsForPriceQuery(params) {
1076
1129
  const selectedProducts = params.priceQueries.map(item => item.product || {});
1077
1130
  const productIds = selectedProducts.map(product => this.getPriceQueryProductId(product));
@@ -1079,6 +1132,30 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1079
1132
  if (!ids.length) {
1080
1133
  return selectedProducts.map(() => null);
1081
1134
  }
1135
+
1136
+ // An explicitly active Venue pool owns all its product reads. Missing raw data
1137
+ // or rules must fail visibly; never silently spend a second list/detail request.
1138
+ if (this.isVenueCatalogLocalPricingActive()) {
1139
+ const queryPayload = this.buildPriceQueryPayload({
1140
+ ids,
1141
+ schedule: params.schedule,
1142
+ customerId: params.customerId,
1143
+ channel: params.channel
1144
+ });
1145
+ return selectedProducts.map((selectedProduct, index) => {
1146
+ const source = productIds[index] == null ? undefined : this.getVenueCatalogLocalPriceSource(productIds[index], selectedProduct);
1147
+ const resolved = source && this.resolveLocalProductForPriceQuery({
1148
+ selectedProduct,
1149
+ rawProduct: source.product,
1150
+ menuList: source.menuList,
1151
+ queryPayload
1152
+ });
1153
+ if (!resolved) throw Object.assign(new Error('The complete venue product or pricing rules are not ready. Reload the catalog before continuing.'), {
1154
+ code: 'VENUE_LOCAL_PRICE_UNAVAILABLE'
1155
+ });
1156
+ return resolved;
1157
+ });
1158
+ }
1082
1159
  const handledByOsServer = this.request ? (0, _clientDataVariants.isProductQueryHandledByOsServer)(this.core, this.request) : false;
1083
1160
  const canUseLocalFastPath = this.isCustomerUserPriceQuery() && !handledByOsServer;
1084
1161
  if (!canUseLocalFastPath) {
@@ -1372,11 +1449,17 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1372
1449
  return undefined;
1373
1450
  }
1374
1451
  }
1452
+
1453
+ /** Only solutions with a current POS business configuration opt into this receipt policy. */
1454
+ getPosReceiptAutoPrintPaymentStatuses() {
1455
+ return undefined;
1456
+ }
1375
1457
  buildSubmitPayloadEnhancerWithOpenDataConfig(enhancePayload) {
1376
1458
  const fulfillmentRefMode = this.getFulfillmentRefMode();
1377
1459
  const invoiceLayoutConfig = this.getCachedInvoiceLayoutConfig();
1378
1460
  const invoiceTemplateSettings = this.getCachedInvoiceTemplateSettings();
1379
- if (!fulfillmentRefMode && !invoiceLayoutConfig && !invoiceTemplateSettings) {
1461
+ const receiptPaymentStatuses = this.getPosReceiptAutoPrintPaymentStatuses();
1462
+ if (!fulfillmentRefMode && !invoiceLayoutConfig && !invoiceTemplateSettings && receiptPaymentStatuses === undefined) {
1380
1463
  return enhancePayload;
1381
1464
  }
1382
1465
  return (payload, ctx) => {
@@ -1391,6 +1474,9 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1391
1474
  } : {}),
1392
1475
  ...(invoiceTemplateSettings ? {
1393
1476
  [OS_INVOICE_TEMPLATE_SETTINGS_FIELD]: (0, _lodashEs.cloneDeep)(invoiceTemplateSettings)
1477
+ } : {}),
1478
+ ...(receiptPaymentStatuses !== undefined ? {
1479
+ [_posReceiptAutoPrint.OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD]: [...receiptPaymentStatuses]
1394
1480
  } : {})
1395
1481
  };
1396
1482
  };
@@ -1407,12 +1493,35 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1407
1493
  }
1408
1494
  return (0, _types2.createModule)(moduleName, this.name);
1409
1495
  }
1496
+ inventoryOrderHooks;
1410
1497
  getSubModuleHooks(moduleName) {
1411
1498
  const optionHooks = this.initializeOptions.hooks || {};
1412
1499
  const otherHooks = this.otherParams.hooks || {};
1413
1500
  if (moduleName === 'order') {
1414
1501
  const directOrderHooks = optionHooks;
1415
- return optionHooks.order || this.otherParams.order?.hooks || otherHooks.order || (directOrderHooks.onBeforeMergeProductToOrder ? directOrderHooks : undefined);
1502
+ const hooks = optionHooks.order || this.otherParams.order?.hooks || otherHooks.order || (directOrderHooks.onBeforeMergeProductToOrder || directOrderHooks.onBeforeCartCommit ? directOrderHooks : undefined);
1503
+ const inventory = this.getInventory();
1504
+ if (!inventory) {
1505
+ this.inventoryOrderHooks = undefined;
1506
+ return hooks;
1507
+ }
1508
+ if (this.inventoryOrderHooks?.inventory === inventory && this.inventoryOrderHooks.base === hooks) {
1509
+ return this.inventoryOrderHooks.hooks;
1510
+ }
1511
+ const combined = {
1512
+ ...hooks,
1513
+ onBeforeCartCommit: async context => {
1514
+ await hooks?.onBeforeCartCommit?.(context);
1515
+ if (inventory !== this.getInventory()) throw (0, _inventory.salesGuardError)('The sales context changed. Please try again.');
1516
+ inventory.validate(context.proposedItems, context.currentItems);
1517
+ }
1518
+ };
1519
+ this.inventoryOrderHooks = {
1520
+ inventory,
1521
+ base: hooks,
1522
+ hooks: combined
1523
+ };
1524
+ return combined;
1416
1525
  }
1417
1526
  return optionHooks[moduleName] || this.otherParams[moduleName]?.hooks || otherHooks[moduleName];
1418
1527
  }
@@ -1460,7 +1569,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1460
1569
  const nextSubModuleOtherParams = this.buildSubModuleOtherParams(moduleName);
1461
1570
  await targetModule.updateOtherParams(nextSubModuleOtherParams, {
1462
1571
  changedParams,
1463
- cover
1572
+ cover,
1573
+ ...(moduleName === 'order' ? {
1574
+ hooks: this.getSubModuleHooks(moduleName)
1575
+ } : {})
1464
1576
  });
1465
1577
  }));
1466
1578
  }
@@ -1609,7 +1721,17 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1609
1721
  }
1610
1722
  return isChanged;
1611
1723
  }
1612
- async initialize(core, options = {}) {
1724
+ initialization;
1725
+
1726
+ /** Hosts can await readiness without changing Core's synchronous registration API. */
1727
+ whenInitialized() {
1728
+ return this.initialization || Promise.reject(new Error('Sales module is not registered'));
1729
+ }
1730
+ initialize(core, options = {}) {
1731
+ this.initialization = this.initializeSalesRuntime(core, options);
1732
+ return this.initialization;
1733
+ }
1734
+ async initializeSalesRuntime(core, options = {}) {
1613
1735
  this.resetPickupTimingCache();
1614
1736
  this.core = core;
1615
1737
  this.initializeOptions = options || {};
@@ -1660,6 +1782,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1660
1782
  await this.getPaymentMethodsAsync();
1661
1783
  this.registerPaymentMethodsChangeSync();
1662
1784
  this.registerServerOrderChangeSync();
1785
+ this.registerOrderSessionChangeSync();
1663
1786
  this.core.effects.emit(`${this.name}:onInited`, {});
1664
1787
  }
1665
1788
  async destroy() {
@@ -1669,17 +1792,21 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1669
1792
  this.serverOrderChangeUnsubscribe = null;
1670
1793
  this.paymentMethodsChangedUnsubscribe?.();
1671
1794
  this.paymentMethodsChangedUnsubscribe = null;
1672
- Object.keys(this.store).forEach(key => {
1673
- if (this.reusedSharedSubModuleNames.has(key)) return;
1795
+ this.orderSessionChangedUnsubscribe?.();
1796
+ this.orderSessionChangedUnsubscribe = null;
1797
+ for (const key of Object.keys(this.store)) {
1798
+ if (this.reusedSharedSubModuleNames.has(key)) continue;
1674
1799
  const sub = this.store[key];
1675
1800
  if (sub && typeof sub.destroy === 'function') {
1676
1801
  try {
1677
- sub.destroy();
1802
+ // A host may register a replacement after destroy resolves. Wait for
1803
+ // nested modules so their cleanup cannot unregister the replacement.
1804
+ await sub.destroy();
1678
1805
  } catch (error) {
1679
1806
  console.warn(`[BaseSales] 子模块 ${key} 销毁失败`, error);
1680
1807
  }
1681
1808
  }
1682
- });
1809
+ }
1683
1810
  this.currentSalesDetail = null;
1684
1811
  this.paymentNumberDevicePrefix = null;
1685
1812
  this.queuedServerOrderChanges = [];
@@ -1799,6 +1926,12 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1799
1926
  const result = this.store.order?.getTempOrder() || null;
1800
1927
  return result;
1801
1928
  }
1929
+ getOrderSessionId() {
1930
+ return this.store.order?.getOrderSessionId?.() || null;
1931
+ }
1932
+ isOrderSessionCurrent(sessionId) {
1933
+ return this.store.order?.isOrderSessionCurrent?.(sessionId) || false;
1934
+ }
1802
1935
  async replaceTempOrder(tempOrder, options) {
1803
1936
  if (!this.store.order) throw new Error('order 模块未初始化');
1804
1937
  const nextTempOrder = await this.store.order.replaceTempOrder(tempOrder, options);
@@ -2000,7 +2133,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
2000
2133
  }
2001
2134
 
2002
2135
  /**
2003
- * 仅清空 tempOrder 购物车行(products / bookings / discount_list)。
2136
+ * 清空 tempOrder 购物车行(products / bookings / discount_list)及整单折扣。
2004
2137
  * 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
2005
2138
  */
2006
2139
  async clearOrderCartLines() {
@@ -2216,9 +2349,16 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
2216
2349
  const searchedDiscountIds = new Set(searchedDiscountList.map(discount => String(discount.id)));
2217
2350
  let preparedDiscountList = [...searchedDiscountList, ...originalDiscountList.filter(discount => !searchedDiscountIds.has(String(discount.id)))];
2218
2351
  if (customerId && customerId !== 1) {
2219
- if (!params?.force && this.discountConfigCacheKey === discountConfigCacheKey) {
2352
+ const inFlight = this.discountConfigPrepareInFlight;
2353
+ // 客户刷新和商品查询共享配置准备;force 仅绕过已完成的缓存。
2354
+ if (inFlight?.key === discountConfigCacheKey && inFlight.epoch === requestEpoch) {
2355
+ preparedDiscountList = await inFlight.promise;
2356
+ if (!isCurrentRequest()) return getCurrentResult();
2357
+ } else if (!params?.force && this.discountConfigCacheKey === discountConfigCacheKey) {
2220
2358
  preparedDiscountList = originalDiscountList;
2221
2359
  } else {
2360
+ // 强制刷新失败后,下次普通加载也应重试,不能命中刷新前的缓存。
2361
+ this.discountConfigCacheKey = null;
2222
2362
  const prepareConfigPromise = this.store.order.loadDiscountConfig({
2223
2363
  customerId,
2224
2364
  action: discountAction,
@@ -2227,11 +2367,28 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
2227
2367
  });
2228
2368
  // OrderModule increments this epoch synchronously before its first await.
2229
2369
  requestEpoch = this.store.order.getCustomerWalletPrepareConfigEpoch?.();
2230
- preparedDiscountList = await prepareConfigPromise;
2231
- if (!isCurrentRequest()) return getCurrentResult();
2232
- await discountModule?.setOriginalDiscountList?.(preparedDiscountList);
2370
+ const prepareTask = {
2371
+ key: discountConfigCacheKey,
2372
+ epoch: requestEpoch,
2373
+ promise: prepareConfigPromise.then(async discountList => {
2374
+ if (!isCurrentRequest()) return discountList;
2375
+ await discountModule?.setOriginalDiscountList?.(discountList);
2376
+ if (isCurrentRequest()) {
2377
+ this.discountConfigCacheKey = discountConfigCacheKey;
2378
+ }
2379
+ return discountList;
2380
+ })
2381
+ };
2382
+ this.discountConfigPrepareInFlight = prepareTask;
2383
+ try {
2384
+ preparedDiscountList = await prepareTask.promise;
2385
+ } finally {
2386
+ // 旧请求结束时不能清掉客户/订单切换后创建的新任务。
2387
+ if (this.discountConfigPrepareInFlight === prepareTask) {
2388
+ this.discountConfigPrepareInFlight = null;
2389
+ }
2390
+ }
2233
2391
  if (!isCurrentRequest()) return getCurrentResult();
2234
- this.discountConfigCacheKey = discountConfigCacheKey;
2235
2392
  }
2236
2393
  }
2237
2394
  if (this.isActiveVirtualSettlementOrder(tempOrder)) {
@@ -2447,10 +2604,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
2447
2604
  }
2448
2605
  await discountModule.setDiscountList(params.discountList);
2449
2606
  }
2450
- async scanPromotionCode(code, customerId) {
2607
+ async scanPromotionCode(code, customerId, options) {
2451
2608
  try {
2452
2609
  if (!this.store.order) throw new Error('order 模块未初始化');
2453
- const raw = await this.store.order.scanCode(code, customerId);
2610
+ const raw = await this.store.order.scanCode(code, customerId, options);
2454
2611
  if (raw.isAvailable) {
2455
2612
  await this.store.order.recalculateSummary({
2456
2613
  createIfMissing: true
@@ -4112,6 +4269,36 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
4112
4269
  transformBaseProductToOrderProduct(params) {
4113
4270
  return (0, _transformBaseProductToOrderProduct.transformBaseProductToOrderProduct)(params);
4114
4271
  }
4272
+
4273
+ /** Explicit pool source avoids races between two simultaneous Venue pricing contexts. */
4274
+ async calculateVenueCatalogProductBookingPrice(params, source) {
4275
+ const customerId = params.customer_id ?? this.getCurrentOrderCustomerId();
4276
+ await this.prepareProductPriceQueryContext(customerId);
4277
+ const channel = this.getPriceQueryChannel(params.channel);
4278
+ const queryPayload = this.buildPriceQueryPayload({
4279
+ ids: [Number(source.product.id)],
4280
+ schedule: this.getPriceQuerySchedule(params),
4281
+ customerId,
4282
+ channel
4283
+ });
4284
+ const authoritativeProduct = this.resolveLocalProductForPriceQuery({
4285
+ selectedProduct: params.product,
4286
+ rawProduct: source.product,
4287
+ menuList: source.menuList,
4288
+ queryPayload
4289
+ });
4290
+ if (!authoritativeProduct) throw Object.assign(new Error('Complete product pricing rules are not ready. Please retry.'), {
4291
+ code: 'VENUE_LOCAL_PRICE_UNAVAILABLE'
4292
+ });
4293
+ return (0, _quotationPrice.calculateBaseSalesProductBookingPrice)({
4294
+ ...params,
4295
+ channel,
4296
+ customer_id: customerId,
4297
+ product: this.mergeProductForPriceQuery(params.product, authoritativeProduct),
4298
+ fallback_price: undefined,
4299
+ quotation: undefined
4300
+ });
4301
+ }
4115
4302
  async calculateProductBookingPrice(params) {
4116
4303
  const [result] = await this.calculateProductBookingPrices([params]);
4117
4304
  return result;
@@ -4323,6 +4510,13 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
4323
4510
  } : result;
4324
4511
  });
4325
4512
  }
4513
+ setProductVoucherGroups(groups) {
4514
+ if (!this.store.order) throw new Error('order 模块未初始化');
4515
+ this.store.order.setProductVoucherGroups(groups);
4516
+ }
4517
+ validateProductVoucherSelection() {
4518
+ this.store.order?.validateProductVoucherSelection();
4519
+ }
4326
4520
  async addProductToOrder(product, booking, options) {
4327
4521
  try {
4328
4522
  if (!this.store.order) throw new Error('order 模块未初始化');
@@ -4352,10 +4546,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
4352
4546
  throw error;
4353
4547
  }
4354
4548
  }
4355
- async updateOrderProducts(paramsList) {
4549
+ async updateOrderProducts(paramsList, options) {
4356
4550
  try {
4357
4551
  if (!this.store.order) throw new Error('order 模块未初始化');
4358
- const products = await this.store.order.updateOrderProducts(paramsList);
4552
+ const products = await this.store.order.updateOrderProducts(paramsList, options);
4359
4553
  return products;
4360
4554
  } catch (error) {
4361
4555
  throw error;
@@ -13,6 +13,7 @@ import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
13
13
  export declare const BaseSalesHookNames: {
14
14
  readonly onInited: "onInited";
15
15
  readonly onDestroy: "onDestroy";
16
+ readonly onOrderSessionChanged: "onOrderSessionChanged";
16
17
  readonly onRetryInit: "onRetryInit";
17
18
  readonly onRefresh: "onRefresh";
18
19
  readonly onCartValidationChanged: "onCartValidationChanged";
@@ -12,6 +12,7 @@ exports.createBaseSalesHook = createBaseSalesHook;
12
12
  const BaseSalesHookNames = exports.BaseSalesHookNames = {
13
13
  onInited: 'onInited',
14
14
  onDestroy: 'onDestroy',
15
+ onOrderSessionChanged: 'onOrderSessionChanged',
15
16
  onRetryInit: 'onRetryInit',
16
17
  onRefresh: 'onRefresh',
17
18
  onCartValidationChanged: 'onCartValidationChanged',
@@ -20,9 +20,20 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
20
20
  private shopStore;
21
21
  private store;
22
22
  private otherParams;
23
+ private scheduleRuntimeParams;
23
24
  private cacheId;
24
25
  private otherData;
25
26
  private platform;
27
+ private productDetailGeneration;
28
+ private sessionAvailabilityRequestVersion;
29
+ private lifecycleGeneration;
30
+ private disposed;
31
+ private resourcePreparation?;
32
+ private staleSelection;
33
+ private resourceSelectionKey;
34
+ /** Semantic selection token for async UI transitions. */
35
+ getBookingSelectionKey(): string;
36
+ private refreshCurrentProductSchedule;
26
37
  initialize(core: PisellCore, options: any): Promise<void>;
27
38
  initStep(stepList: (keyof BookingByStepState)[]): void;
28
39
  getCurrentStep(): {
@@ -108,7 +119,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
108
119
  * }
109
120
  * @memberof BookingByStepImpl
110
121
  */
111
- loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, }: LoadScheduleAvailableDateParams): Promise<ITime[]>;
122
+ loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, assertCurrent, }: LoadScheduleAvailableDateParams): Promise<ITime[]>;
112
123
  addAccount(account: Account | IHolder, extra?: {
113
124
  type: 'account' | 'holder';
114
125
  customerId: number;
@@ -152,7 +163,10 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
152
163
  startDate?: string;
153
164
  endDate?: string;
154
165
  type?: 'month' | 'day';
166
+ assertCurrent?: () => void;
155
167
  }): Promise<ITime[]>;
168
+ /** Prepare the exact cart/date selection before synchronous resource checks. */
169
+ prepareResourcesForCurrentSelection(): Promise<void>;
156
170
  /**
157
171
  * 获取购物车汇总信息
158
172
  */
@@ -375,7 +389,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
375
389
  };
376
390
  setOtherData(key: string, value: any): void;
377
391
  getOtherData(key: string): any;
378
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
392
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
379
393
  /**
380
394
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
381
395
  *