@pisell/pisellos 2.3.51 → 2.3.53

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 (161) hide show
  1. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
  2. package/dist/modules/Discount/index.d.ts +0 -1
  3. package/dist/modules/Discount/index.js +11 -40
  4. package/dist/modules/Discount/types.d.ts +0 -1
  5. package/dist/modules/OpenData/index.js +2 -2
  6. package/dist/modules/Order/index.d.ts +7 -9
  7. package/dist/modules/Order/index.js +165 -140
  8. package/dist/modules/Order/types.d.ts +21 -12
  9. package/dist/modules/Order/types.js +11 -0
  10. package/dist/modules/Order/utils.d.ts +0 -10
  11. package/dist/modules/Order/utils.js +3 -35
  12. package/dist/modules/Product/types.d.ts +0 -1
  13. package/dist/modules/ProductList/index.js +14 -33
  14. package/dist/modules/Quotation/index.d.ts +1 -1
  15. package/dist/modules/Quotation/index.js +2 -2
  16. package/dist/modules/Rules/index.js +32 -56
  17. package/dist/modules/SalesSummary/index.js +13 -12
  18. package/dist/modules/SalesSummary/utils.js +7 -1
  19. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  20. package/dist/modules/ScanOrderLogger/index.js +2 -15
  21. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  22. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  23. package/dist/modules/Schedule/index.d.ts +1 -3
  24. package/dist/modules/Schedule/index.js +16 -21
  25. package/dist/modules/Summary/utils.js +13 -38
  26. package/dist/modules/index.d.ts +0 -2
  27. package/dist/modules/index.js +1 -3
  28. package/dist/plugins/window.d.ts +0 -1
  29. package/dist/server/index.d.ts +0 -14
  30. package/dist/server/index.js +793 -907
  31. package/dist/solution/BaseSales/index.d.ts +15 -12
  32. package/dist/solution/BaseSales/index.js +194 -178
  33. package/dist/solution/BaseSales/utils/cartPromotion.js +5 -3
  34. package/dist/solution/BookingByStep/index.d.ts +1 -16
  35. package/dist/solution/BookingByStep/index.js +215 -294
  36. package/dist/solution/BookingByStep/types.d.ts +1 -2
  37. package/dist/solution/BookingByStep/types.js +1 -3
  38. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  39. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  40. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  41. package/dist/solution/BookingTicket/index.d.ts +2 -14
  42. package/dist/solution/BookingTicket/index.js +2 -2
  43. package/dist/solution/BookingTicket/types.d.ts +3 -0
  44. package/dist/solution/BookingTicket/utils/cartView.js +44 -32
  45. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  46. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
  47. package/dist/solution/Sales/index.d.ts +1 -0
  48. package/dist/solution/Sales/index.js +16 -2
  49. package/dist/solution/ScanOrder/index.d.ts +14 -26
  50. package/dist/solution/ScanOrder/index.js +739 -1142
  51. package/dist/solution/ScanOrder/types.d.ts +1 -21
  52. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  53. package/dist/solution/ScanOrder/utils.js +25 -66
  54. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  55. package/dist/solution/ShopDiscount/index.js +87 -125
  56. package/dist/solution/VenueBooking/index.d.ts +11 -39
  57. package/dist/solution/VenueBooking/index.js +841 -1167
  58. package/dist/solution/VenueBooking/types.d.ts +0 -3
  59. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  60. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  61. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  62. package/dist/solution/index.d.ts +0 -1
  63. package/dist/solution/index.js +1 -2
  64. package/dist/types/index.d.ts +0 -1
  65. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  66. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
  67. package/lib/modules/Discount/index.d.ts +0 -1
  68. package/lib/modules/Discount/index.js +0 -9
  69. package/lib/modules/Discount/types.d.ts +0 -1
  70. package/lib/modules/OpenData/index.js +1 -1
  71. package/lib/modules/Order/index.d.ts +7 -9
  72. package/lib/modules/Order/index.js +89 -38
  73. package/lib/modules/Order/types.d.ts +21 -12
  74. package/lib/modules/Order/utils.d.ts +0 -10
  75. package/lib/modules/Order/utils.js +5 -36
  76. package/lib/modules/Product/types.d.ts +0 -1
  77. package/lib/modules/ProductList/index.js +31 -40
  78. package/lib/modules/Quotation/index.d.ts +1 -1
  79. package/lib/modules/Quotation/index.js +2 -2
  80. package/lib/modules/Rules/index.js +32 -44
  81. package/lib/modules/SalesSummary/index.js +7 -6
  82. package/lib/modules/SalesSummary/utils.js +5 -1
  83. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  84. package/lib/modules/ScanOrderLogger/index.js +1 -13
  85. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  86. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  87. package/lib/modules/Schedule/index.d.ts +1 -3
  88. package/lib/modules/Schedule/index.js +8 -10
  89. package/lib/modules/Summary/utils.js +1 -21
  90. package/lib/modules/index.d.ts +0 -2
  91. package/lib/modules/index.js +1 -5
  92. package/lib/plugins/window.d.ts +0 -1
  93. package/lib/server/index.d.ts +0 -14
  94. package/lib/server/index.js +15 -72
  95. package/lib/solution/BaseSales/index.d.ts +15 -12
  96. package/lib/solution/BaseSales/index.js +52 -35
  97. package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
  98. package/lib/solution/BookingByStep/index.d.ts +1 -16
  99. package/lib/solution/BookingByStep/index.js +18 -60
  100. package/lib/solution/BookingByStep/types.d.ts +1 -2
  101. package/lib/solution/BookingByStep/types.js +0 -5
  102. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  103. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  104. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  105. package/lib/solution/BookingTicket/index.d.ts +2 -14
  106. package/lib/solution/BookingTicket/index.js +2 -10
  107. package/lib/solution/BookingTicket/types.d.ts +3 -0
  108. package/lib/solution/BookingTicket/utils/cartView.js +43 -30
  109. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  110. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  111. package/lib/solution/Sales/index.d.ts +1 -0
  112. package/lib/solution/Sales/index.js +15 -3
  113. package/lib/solution/ScanOrder/index.d.ts +14 -26
  114. package/lib/solution/ScanOrder/index.js +182 -449
  115. package/lib/solution/ScanOrder/types.d.ts +1 -21
  116. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  117. package/lib/solution/ScanOrder/utils.js +0 -31
  118. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  119. package/lib/solution/ShopDiscount/index.js +0 -14
  120. package/lib/solution/VenueBooking/index.d.ts +11 -39
  121. package/lib/solution/VenueBooking/index.js +110 -322
  122. package/lib/solution/VenueBooking/types.d.ts +0 -3
  123. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  124. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  125. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  126. package/lib/solution/index.d.ts +0 -1
  127. package/lib/solution/index.js +1 -3
  128. package/lib/types/index.d.ts +0 -1
  129. package/package.json +1 -1
  130. package/dist/modules/Holder/index.d.ts +0 -48
  131. package/dist/modules/Holder/index.js +0 -640
  132. package/dist/modules/Holder/types.d.ts +0 -123
  133. package/dist/modules/Holder/types.js +0 -1
  134. package/dist/modules/Holder/utils.d.ts +0 -13
  135. package/dist/modules/Holder/utils.js +0 -34
  136. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  137. package/dist/modules/ResourcePlanner/index.js +0 -181
  138. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  139. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  140. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  141. package/dist/modules/ResourcePlanner/types.js +0 -1
  142. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  143. package/dist/solution/UnifiedBookingSales/index.js +0 -1891
  144. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  145. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  146. package/lib/modules/Holder/index.d.ts +0 -48
  147. package/lib/modules/Holder/index.js +0 -402
  148. package/lib/modules/Holder/types.d.ts +0 -123
  149. package/lib/modules/Holder/types.js +0 -17
  150. package/lib/modules/Holder/utils.d.ts +0 -13
  151. package/lib/modules/Holder/utils.js +0 -71
  152. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  153. package/lib/modules/ResourcePlanner/index.js +0 -148
  154. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  155. package/lib/modules/ResourcePlanner/planner.js +0 -933
  156. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  157. package/lib/modules/ResourcePlanner/types.js +0 -17
  158. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  159. package/lib/solution/UnifiedBookingSales/index.js +0 -1084
  160. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  161. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -18,5 +18,3 @@ export * from './Quotation';
18
18
  export * from './ScanOrderLogger';
19
19
  export * from './OpenData';
20
20
  export * from './BookingContext';
21
- export * from './Holder';
22
- export * from './ResourcePlanner';
@@ -36,8 +36,6 @@ __reExport(modules_exports, require("./Quotation"), module.exports);
36
36
  __reExport(modules_exports, require("./ScanOrderLogger"), module.exports);
37
37
  __reExport(modules_exports, require("./OpenData"), module.exports);
38
38
  __reExport(modules_exports, require("./BookingContext"), module.exports);
39
- __reExport(modules_exports, require("./Holder"), module.exports);
40
- __reExport(modules_exports, require("./ResourcePlanner"), module.exports);
41
39
  // Annotate the CommonJS export names for ESM import in node:
42
40
  0 && (module.exports = {
43
41
  ...require("./Product"),
@@ -59,7 +57,5 @@ __reExport(modules_exports, require("./ResourcePlanner"), module.exports);
59
57
  ...require("./Quotation"),
60
58
  ...require("./ScanOrderLogger"),
61
59
  ...require("./OpenData"),
62
- ...require("./BookingContext"),
63
- ...require("./Holder"),
64
- ...require("./ResourcePlanner")
60
+ ...require("./BookingContext")
65
61
  });
@@ -16,7 +16,6 @@ export interface WindowPlugin extends Plugin {
16
16
  history: History;
17
17
  interaction?: any;
18
18
  getWalletPassEvaluator?: () => WalletPassEvaluator;
19
- getLocalStorage?: (key: string) => string | null;
20
19
  }
21
20
  /**
22
21
  * 简单的 Storage 接口实现
@@ -49,10 +49,6 @@ declare class Server {
49
49
  private productQuerySubscribers;
50
50
  /** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
51
51
  private productQueryScheduleTimers;
52
- /** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
53
- private menuScheduleRefreshInFlight;
54
- private lastMenuScheduleRefreshAt;
55
- private readonly MENU_SCHEDULE_REFRESH_COOLDOWN_MS;
56
52
  private orderQuerySubscribers;
57
53
  private bookingQuerySubscribers;
58
54
  private bookingRemoteQuerySubscribers;
@@ -266,16 +262,6 @@ declare class Server {
266
262
  * 存储订阅者信息,便于数据变更时推送最新结果
267
263
  */
268
264
  private handleProductQuery;
269
- /**
270
- * ProductList callers such as standalone retail pages do not always have a selected schedule.
271
- * In that case query against the current local time so menu availability can still be evaluated.
272
- */
273
- private resolveProductQueryScheduleContext;
274
- /**
275
- * OpenData 的关联餐牌可能已更新,而 server_menu/server_schedule 仍命中本地持久化缓存。
276
- * 仅在当前筛选没有任何生效餐牌时刷新一次,并由调用方重新计算筛选结果。
277
- */
278
- private refreshMenuScheduleCacheAfterEmptyResult;
279
265
  /**
280
266
  * 按商品 id 查询单条(GET /shop/product/query/:productId)
281
267
  * schedule_date 必填:query 或 data;schedule_datetime 可选。不走订阅。
@@ -82,10 +82,6 @@ var Server = class {
82
82
  this.productQuerySubscribers = /* @__PURE__ */ new Map();
83
83
  /** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
84
84
  this.productQueryScheduleTimers = /* @__PURE__ */ new Map();
85
- /** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
86
- this.menuScheduleRefreshInFlight = null;
87
- this.lastMenuScheduleRefreshAt = 0;
88
- this.MENU_SCHEDULE_REFRESH_COOLDOWN_MS = 30 * 1e3;
89
85
  // ---- 订单 / 预约列表查询订阅者 ----
90
86
  this.orderQuerySubscribers = /* @__PURE__ */ new Map();
91
87
  this.bookingQuerySubscribers = /* @__PURE__ */ new Map();
@@ -219,11 +215,7 @@ var Server = class {
219
215
  */
220
216
  this.handleProductQuery = async ({ url, method, data, config }) => {
221
217
  console.log("[Server] handleProductQuery:", url, method, data, config);
222
- const { menu_list_ids, customer_id, ids, extension_type, strategy_context } = data;
223
- const { schedule_date, schedule_datetime } = this.resolveProductQueryScheduleContext({
224
- schedule_date: data.schedule_date,
225
- schedule_datetime: data.schedule_datetime
226
- });
218
+ const { menu_list_ids, schedule_datetime, schedule_date, customer_id, ids, extension_type, strategy_context } = data;
227
219
  const { callback, subscriberId } = config || {};
228
220
  this.logInfo("handleProductQuery: 开始处理商品查询请求", {
229
221
  menu_list_ids,
@@ -2219,12 +2211,15 @@ var Server = class {
2219
2211
  return;
2220
2212
  const scheduleDate = subscriber.context.schedule_date || (0, import_dayjs.default)().format("YYYY-MM-DD");
2221
2213
  const timerIds = [];
2222
- setInterval(() => {
2223
- const currentTime = (0, import_dayjs.default)().format("hh:mm");
2224
- if (timePoints.includes(currentTime)) {
2225
- this.onScheduleTimePointTimerFire(subscriberId);
2226
- }
2227
- }, 6e4);
2214
+ for (const timePoint of timePoints) {
2215
+ const delayMs = this.computeScheduleTimePointDelayMs(scheduleDate, timePoint);
2216
+ if (delayMs < 0)
2217
+ continue;
2218
+ const timerId = setTimeout(() => {
2219
+ void this.onScheduleTimePointTimerFire(subscriberId, timerId);
2220
+ }, delayMs);
2221
+ timerIds.push(timerId);
2222
+ }
2228
2223
  if (timerIds.length > 0) {
2229
2224
  this.productQueryScheduleTimers.set(subscriberId, timerIds);
2230
2225
  subscriber.scheduleTimerIds = timerIds;
@@ -2239,7 +2234,7 @@ var Server = class {
2239
2234
  * schedule 变价时间点定时器触发:刷新 schedule_datetime 后重算并 callback。
2240
2235
  */
2241
2236
  async onScheduleTimePointTimerFire(subscriberId, timerId) {
2242
- timerId && this.removeScheduleTimerRef(subscriberId, timerId);
2237
+ this.removeScheduleTimerRef(subscriberId, timerId);
2243
2238
  if (!this.productQuerySubscribers.has(subscriberId))
2244
2239
  return;
2245
2240
  const subscriber = this.productQuerySubscribers.get(subscriberId);
@@ -2282,43 +2277,6 @@ var Server = class {
2282
2277
  this.scheduleSubscriberTimePointReloads(subscriberId, timePoints);
2283
2278
  }
2284
2279
  }
2285
- /**
2286
- * ProductList callers such as standalone retail pages do not always have a selected schedule.
2287
- * In that case query against the current local time so menu availability can still be evaluated.
2288
- */
2289
- resolveProductQueryScheduleContext(params) {
2290
- const now = (0, import_dayjs.default)();
2291
- const schedule_datetime = typeof params.schedule_datetime === "string" && params.schedule_datetime.trim() ? params.schedule_datetime : now.format("YYYY-MM-DD HH:mm:ss");
2292
- const schedule_date = typeof params.schedule_date === "string" && params.schedule_date.trim() ? params.schedule_date : (0, import_dayjs.default)(schedule_datetime).isValid() ? (0, import_dayjs.default)(schedule_datetime).format("YYYY-MM-DD") : now.format("YYYY-MM-DD");
2293
- return { schedule_date, schedule_datetime };
2294
- }
2295
- /**
2296
- * OpenData 的关联餐牌可能已更新,而 server_menu/server_schedule 仍命中本地持久化缓存。
2297
- * 仅在当前筛选没有任何生效餐牌时刷新一次,并由调用方重新计算筛选结果。
2298
- */
2299
- async refreshMenuScheduleCacheAfterEmptyResult() {
2300
- if (!this.menu || !this.schedule)
2301
- return false;
2302
- const now = Date.now();
2303
- if (now - this.lastMenuScheduleRefreshAt < this.MENU_SCHEDULE_REFRESH_COOLDOWN_MS) {
2304
- return false;
2305
- }
2306
- if (!this.menuScheduleRefreshInFlight) {
2307
- this.lastMenuScheduleRefreshAt = now;
2308
- this.menuScheduleRefreshInFlight = Promise.all([
2309
- this.menu.loadMenuList(),
2310
- this.schedule.loadAllSchedule()
2311
- ]).then(() => void 0).catch((error) => {
2312
- this.logWarning("刷新菜单/日程缓存失败,继续使用现有缓存", {
2313
- error: error instanceof Error ? error.message : String(error)
2314
- });
2315
- }).finally(() => {
2316
- this.menuScheduleRefreshInFlight = null;
2317
- });
2318
- }
2319
- await this.menuScheduleRefreshInFlight;
2320
- return true;
2321
- }
2322
2280
  /**
2323
2281
  * 执行 sales 搜索并登记可见订单号。
2324
2282
  * 搜索参数完全透传后端,OS 不做过滤、筛选、排序。
@@ -3821,22 +3779,10 @@ var Server = class {
3821
3779
  data: (normalized == null ? void 0 : normalized.data) ?? null
3822
3780
  };
3823
3781
  }
3824
- const response = this.withSyncedOrderIdInCheckoutResponse(
3782
+ return this.withSyncedOrderIdInCheckoutResponse(
3825
3783
  syncResult.normalizedResponse,
3826
3784
  syncResult.syncedOrder
3827
3785
  );
3828
- const syncedOrder = syncResult.syncedOrder;
3829
- if (syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData) && this.isSalesOrderFullyPaid(syncedOrder)) {
3830
- await this.dispatchLocalReceiptPrint({
3831
- checkoutData: syncResult.checkoutData,
3832
- order: syncedOrder,
3833
- response: syncResult.normalizedResponse,
3834
- requireFullyPaid: true,
3835
- // print_all 的 type=0 是收据打印;不要沿用同步成功后的券/手环打印 type=99。
3836
- isManualPrint: true
3837
- });
3838
- }
3839
- return response;
3840
3786
  } catch (error) {
3841
3787
  const backendError = this.extractBackendErrorResponse(error);
3842
3788
  if (backendError) {
@@ -5126,16 +5072,13 @@ var Server = class {
5126
5072
  let activeMenuList = [];
5127
5073
  if (menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0) {
5128
5074
  const tMenu = performance.now();
5129
- const getActiveMenus = () => this.menu.getMenuByIds(menu_list_ids).filter((menu) => {
5075
+ const menuList = this.menu.getMenuByIds(menu_list_ids);
5076
+ activeMenuList = menuList.filter((menu) => {
5130
5077
  var _a;
5131
5078
  return ((_a = this.schedule) == null ? void 0 : _a.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
5132
5079
  });
5133
- activeMenuList = getActiveMenus();
5134
- if (!activeMenuList.length && await this.refreshMenuScheduleCacheAfterEmptyResult()) {
5135
- activeMenuList = getActiveMenus();
5136
- }
5137
5080
  (0, import_product.perfMark)("computeQuery.filterActiveMenu", performance.now() - tMenu, {
5138
- totalMenu: menu_list_ids.length,
5081
+ totalMenu: menuList.length,
5139
5082
  activeMenu: activeMenuList.length
5140
5083
  });
5141
5084
  }
@@ -2,7 +2,7 @@ import { Module, ModuleOptions, PisellCore } from '../../types';
2
2
  import { BaseModule } from '../../modules/BaseModule';
3
3
  import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult, BaseSalesCashPaymentConfig, BaseSalesPayCashParams, BaseSalesPayCashResult, BaseSalesCommitPaymentMethodParams, BaseSalesCommitPaymentMethodResult, BaseSalesConfirmWalletPaymentResult } from './types';
4
4
  import { OrderModule } from '../../modules/Order';
5
- import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from '../../modules/Order/types';
5
+ import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions } from '../../modules/Order/types';
6
6
  import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
7
7
  import type { Discount } from '../../modules/Discount/types';
8
8
  import { RequestPlugin, WindowPlugin } from '../../plugins';
@@ -109,6 +109,16 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
109
109
  private applyQuotationScheduleResolver;
110
110
  private loadQuotationForPriceQuery;
111
111
  private getPriceQueryProductId;
112
+ /**
113
+ * Change Time / customer reprice 必须沿用商品列表的渠道口径。
114
+ * SalesSdk Provider 通常将渠道存为 platform,因此不能只读取 otherParams.channel。
115
+ */
116
+ private getPriceQueryChannel;
117
+ /**
118
+ * /product/query 的智能定价评估只读取 strategy_context;
119
+ * application_code 仅作为接口兼容字段,不能替代 channel / business_code。
120
+ */
121
+ private getPriceQueryStrategyContext;
112
122
  private getPriceQuerySchedule;
113
123
  private loadProductsForPriceQuery;
114
124
  private loadProductForPriceQuery;
@@ -180,7 +190,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
180
190
  /** 获取附加费用(运费/服务费/税费等)。 */
181
191
  getSurcharges(): ISalesSurcharge[];
182
192
  getTempOrder(): OrderTempOrder | null;
183
- replaceTempOrder(tempOrder: OrderTempOrder): Promise<OrderTempOrder>;
193
+ replaceTempOrder(tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions): Promise<OrderTempOrder>;
184
194
  getOrderIdentity(): import("../../modules/Order/types").OrderIdentitySnapshot | null;
185
195
  getOrderSnapshot(): import("../../modules/Order/types").OrderSnapshot | null;
186
196
  getOrderSyncState(): import("../../modules/Order/types").OrderSyncState;
@@ -280,13 +290,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
280
290
  confirmPendingVoucherPayments?: boolean;
281
291
  enhancePayload?: SubmitPayloadEnhancer;
282
292
  }): Promise<T>;
283
- /**
284
- * 默认保持 WebPOS 的本地待同步订单模式;需要云端确认后才算成功的渠道可覆盖此策略。
285
- * otherParams.checkoutSyncTaskEnabled 优先,便于同一 solution 按入口恢复旧行为。
286
- */
287
- protected shouldUseCheckoutSyncTask(): boolean;
288
- /** 可由特定 solution 为真实 checkout 补充默认收据数据请求。 */
289
- protected getDefaultCheckoutSmallTicketDataFlag(): number | undefined;
290
293
  printLocalOrderReceipt<T = any>(lookup?: BaseSalesPrintLocalOrderReceiptParams): Promise<T>;
291
294
  private getSubmitPaymentStatus;
292
295
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
@@ -421,7 +424,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
421
424
  getQuotationCustomerScopeInfo(): BaseSalesQuotationCustomerScopeInfo;
422
425
  shouldRecalculateProductBookingPricesForContextChange(params: BaseSalesPriceRecalculationContextChange): boolean;
423
426
  calculateProductBookingPrices(paramsList: BaseSalesCalculateProductBookingPriceParams[]): Promise<BaseSalesProductBookingPriceResult[]>;
424
- addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput): Promise<import("../../modules/Order/types").OrderProduct[]>;
427
+ addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
425
428
  updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
426
429
  updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
427
430
  updateOrderProductQuantity(params: BaseSalesUpdateOrderProductQuantityParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
@@ -437,8 +440,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
437
440
  * @example
438
441
  * await baseSales.removeProductsFromOrder([identityA, identityB]);
439
442
  */
440
- removeProductsFromOrder(identities: BaseSalesOrderProductIdentity[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
441
- removeProductFromOrder(identity: BaseSalesOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
443
+ removeProductsFromOrder(identities: BaseSalesOrderProductIdentity[], options?: RemoveProductsFromOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
444
+ removeProductFromOrder(identity: BaseSalesOrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
442
445
  /**
443
446
  * 注入促销评估器到底层 OrderModule。
444
447
  *
@@ -702,6 +702,36 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
702
702
  return null;
703
703
  return productId;
704
704
  }
705
+ /**
706
+ * Change Time / customer reprice 必须沿用商品列表的渠道口径。
707
+ * SalesSdk Provider 通常将渠道存为 platform,因此不能只读取 otherParams.channel。
708
+ */
709
+ getPriceQueryChannel(channel) {
710
+ var _a, _b, _c;
711
+ const strategyContext = ((_a = this.otherParams) == null ? void 0 : _a.strategy_context) && typeof this.otherParams.strategy_context === "object" ? this.otherParams.strategy_context : {};
712
+ const value = channel ?? strategyContext.channel ?? ((_b = this.otherParams) == null ? void 0 : _b.channel) ?? ((_c = this.otherParams) == null ? void 0 : _c.platform);
713
+ if (value === void 0 || value === null || String(value).trim() === "") {
714
+ return void 0;
715
+ }
716
+ return String(value).trim();
717
+ }
718
+ /**
719
+ * /product/query 的智能定价评估只读取 strategy_context;
720
+ * application_code 仅作为接口兼容字段,不能替代 channel / business_code。
721
+ */
722
+ getPriceQueryStrategyContext(channel) {
723
+ var _a, _b, _c;
724
+ const inherited = ((_a = this.otherParams) == null ? void 0 : _a.strategy_context) && typeof this.otherParams.strategy_context === "object" ? this.otherParams.strategy_context : {};
725
+ const strategyContext = { ...inherited };
726
+ const resolvedChannel = this.getPriceQueryChannel(channel);
727
+ const businessCode = strategyContext.business_code ?? ((_b = this.otherParams) == null ? void 0 : _b.businessCode) ?? ((_c = this.otherParams) == null ? void 0 : _c.business_code);
728
+ if (resolvedChannel)
729
+ strategyContext.channel = resolvedChannel;
730
+ if (businessCode !== void 0 && businessCode !== null && String(businessCode).trim() !== "") {
731
+ strategyContext.business_code = String(businessCode).trim();
732
+ }
733
+ return strategyContext;
734
+ }
705
735
  getPriceQuerySchedule(params) {
706
736
  const booking = params.booking || {};
707
737
  if (typeof booking.start_date === "string" && booking.start_date.trim()) {
@@ -729,13 +759,15 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
729
759
  };
730
760
  }
731
761
  async loadProductsForPriceQuery(params) {
732
- var _a, _b;
762
+ var _a;
733
763
  const ids = Array.from(new Set(
734
764
  params.ids.filter((id) => Number.isFinite(id))
735
765
  ));
736
766
  const productsById = /* @__PURE__ */ new Map();
737
767
  if (!ids.length || !this.request)
738
768
  return productsById;
769
+ const channel = this.getPriceQueryChannel(params.channel);
770
+ const strategyContext = this.getPriceQueryStrategyContext(channel);
739
771
  try {
740
772
  const response = await this.request.post("/product/query", {
741
773
  ids,
@@ -747,13 +779,14 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
747
779
  customer_id: params.customerId,
748
780
  schedule_date: params.schedule.schedule_date,
749
781
  schedule_datetime: params.schedule.schedule_datetime,
750
- application_code: params.channel || ((_a = this.otherParams) == null ? void 0 : _a.channel)
782
+ application_code: channel,
783
+ ...Object.keys(strategyContext).length ? { strategy_context: strategyContext } : {}
751
784
  }, {
752
785
  osServer: true,
753
786
  customToast: () => {
754
787
  }
755
788
  });
756
- const list = ((_b = response == null ? void 0 : response.data) == null ? void 0 : _b.list) || (response == null ? void 0 : response.list) || [];
789
+ const list = ((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) || (response == null ? void 0 : response.list) || [];
757
790
  if (!Array.isArray(list))
758
791
  return productsById;
759
792
  list.forEach((item) => {
@@ -1008,7 +1041,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1008
1041
  return isChanged;
1009
1042
  }
1010
1043
  async initialize(core, options = {}) {
1011
- var _a, _b, _c, _d;
1044
+ var _a, _b;
1012
1045
  this.core = core;
1013
1046
  this.initializeOptions = options || {};
1014
1047
  this.paymentNumberDevicePrefix = null;
@@ -1019,9 +1052,10 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1019
1052
  this.request = core.getPlugin("request");
1020
1053
  this.appPlugin = core.getPlugin("app");
1021
1054
  if (!this.appPlugin) {
1055
+ throw new Error("Checkout 解决方案需要 app 插件支持");
1022
1056
  }
1023
- const app = (_c = (_b = this.appPlugin) == null ? void 0 : _b.getApp) == null ? void 0 : _c.call(_b);
1024
- this.logger = app == null ? void 0 : app.logger;
1057
+ const app = this.appPlugin.getApp();
1058
+ this.logger = app.logger;
1025
1059
  const targetCacheData = this.readSessionCacheData();
1026
1060
  const moduleNames = this.getRegisteredModuleNames();
1027
1061
  moduleNames.forEach((step) => {
@@ -1046,7 +1080,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1046
1080
  if (this.store.schedule && !this.isScheduleListLoaded(this.store.schedule)) {
1047
1081
  await this.store.schedule.loadAllSchedule();
1048
1082
  }
1049
- if (this.store.order && typeof ((_d = this.otherParams) == null ? void 0 : _d.enableTempOrderPersist) === "boolean") {
1083
+ if (this.store.order && typeof ((_b = this.otherParams) == null ? void 0 : _b.enableTempOrderPersist) === "boolean") {
1050
1084
  this.store.order.setEnableTempOrderPersist(
1051
1085
  this.otherParams.enableTempOrderPersist
1052
1086
  );
@@ -1190,10 +1224,10 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1190
1224
  const result = ((_a = this.store.order) == null ? void 0 : _a.getTempOrder()) || null;
1191
1225
  return result;
1192
1226
  }
1193
- async replaceTempOrder(tempOrder) {
1227
+ async replaceTempOrder(tempOrder, options) {
1194
1228
  if (!this.store.order)
1195
1229
  throw new Error("order 模块未初始化");
1196
- const nextTempOrder = await this.store.order.replaceTempOrder(tempOrder);
1230
+ const nextTempOrder = await this.store.order.replaceTempOrder(tempOrder, options);
1197
1231
  await this.effectsEmit("onTempOrderReplaced", { tempOrder: nextTempOrder });
1198
1232
  return nextTempOrder;
1199
1233
  }
@@ -1900,7 +1934,6 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1900
1934
  throw new Error("BaseSales 解决方案需要 order 模块支持");
1901
1935
  }
1902
1936
  const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
1903
- const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
1904
1937
  const submitParams = {
1905
1938
  cacheId: this.cacheId,
1906
1939
  platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
@@ -1910,11 +1943,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1910
1943
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
1911
1944
  ...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
1912
1945
  ...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
1913
- ...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
1946
+ ...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
1914
1947
  ...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
1915
1948
  ...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
1916
1949
  };
1917
- return this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams);
1950
+ return this.store.order.submitTempOrder(submitParams);
1918
1951
  }
1919
1952
  async saveSalesOrderDraft(params) {
1920
1953
  var _a, _b, _c, _d;
@@ -1936,35 +1969,20 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1936
1969
  throw new Error("BaseSales 解决方案需要 order 模块支持");
1937
1970
  }
1938
1971
  const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
1939
- const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
1940
1972
  const submitParams = {
1941
1973
  cacheId: this.cacheId,
1942
1974
  platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
1943
1975
  businessCode: ((_b = this.otherParams) == null ? void 0 : _b.businessCode) || ((_c = this.otherParams) == null ? void 0 : _c.business_code),
1944
1976
  channel: this.getSubmitOrderSalesChannel(),
1945
1977
  type: (_d = this.otherParams) == null ? void 0 : _d.type,
1946
- request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
1947
1978
  ...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
1948
1979
  ...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
1949
- ...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
1980
+ ...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
1950
1981
  ...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
1951
1982
  ...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
1952
1983
  };
1953
1984
  return this.store.order.submitTempOrderAsync(submitParams);
1954
1985
  }
1955
- /**
1956
- * 默认保持 WebPOS 的本地待同步订单模式;需要云端确认后才算成功的渠道可覆盖此策略。
1957
- * otherParams.checkoutSyncTaskEnabled 优先,便于同一 solution 按入口恢复旧行为。
1958
- */
1959
- shouldUseCheckoutSyncTask() {
1960
- var _a;
1961
- const configured = (_a = this.otherParams) == null ? void 0 : _a.checkoutSyncTaskEnabled;
1962
- return typeof configured === "boolean" ? configured : true;
1963
- }
1964
- /** 可由特定 solution 为真实 checkout 补充默认收据数据请求。 */
1965
- getDefaultCheckoutSmallTicketDataFlag() {
1966
- return void 0;
1967
- }
1968
1986
  async printLocalOrderReceipt(lookup) {
1969
1987
  var _a, _b, _c, _d, _e, _f, _g;
1970
1988
  if (!this.store.order) {
@@ -2024,7 +2042,6 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
2024
2042
  const channel = params.channel ?? this.getSubmitOrderSalesChannel();
2025
2043
  const syncParams = {
2026
2044
  ...params,
2027
- checkoutSyncTaskEnabled: this.shouldUseCheckoutSyncTask(),
2028
2045
  ...businessCode !== void 0 ? { businessCode } : {},
2029
2046
  ...channel !== void 0 ? { channel } : {}
2030
2047
  };
@@ -3187,11 +3204,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
3187
3204
  });
3188
3205
  });
3189
3206
  }
3190
- async addProductToOrder(product, booking) {
3207
+ async addProductToOrder(product, booking, options) {
3191
3208
  try {
3192
3209
  if (!this.store.order)
3193
3210
  throw new Error("order 模块未初始化");
3194
- const products = await this.store.order.addProductToOrder(product, booking);
3211
+ const products = await this.store.order.addProductToOrder(product, booking, options);
3195
3212
  return products;
3196
3213
  } catch (error) {
3197
3214
  throw error;
@@ -3267,17 +3284,17 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
3267
3284
  * @example
3268
3285
  * await baseSales.removeProductsFromOrder([identityA, identityB]);
3269
3286
  */
3270
- async removeProductsFromOrder(identities) {
3287
+ async removeProductsFromOrder(identities, options) {
3271
3288
  try {
3272
3289
  if (!this.store.order)
3273
3290
  throw new Error("order 模块未初始化");
3274
- return await this.store.order.removeProductsFromOrder(identities);
3291
+ return await this.store.order.removeProductsFromOrder(identities, options);
3275
3292
  } catch (error) {
3276
3293
  throw error;
3277
3294
  }
3278
3295
  }
3279
- async removeProductFromOrder(identity) {
3280
- return this.removeProductsFromOrder([identity]);
3296
+ async removeProductFromOrder(identity, options) {
3297
+ return this.removeProductsFromOrder([identity], options);
3281
3298
  }
3282
3299
  // ─── 促销/赠品 透传(迁移自 booking usePromotion) ────────────────
3283
3300
  /**
@@ -367,8 +367,11 @@ function getProductLineNoteSignature(product) {
367
367
  return uid ? `note:${uid}` : `note:${normalizedNote}`;
368
368
  }
369
369
  function getPromotionLineMergeBoundary(product) {
370
- var _a;
371
- if (((_a = product == null ? void 0 : product.metadata) == null ? void 0 : _a.is_edit_for_runtime) !== true)
370
+ var _a, _b;
371
+ if (Number(((_a = product == null ? void 0 : product.product_sku) == null ? void 0 : _a.open_sold_weight) || 0) === 1) {
372
+ return `weighing:${getOrderProductUid(product)}`;
373
+ }
374
+ if (((_b = product == null ? void 0 : product.metadata) == null ? void 0 : _b.is_edit_for_runtime) !== true)
372
375
  return "";
373
376
  return `edit:${getOrderProductUid(product)}`;
374
377
  }
@@ -10,7 +10,6 @@ import { ITime } from '../../modules/Date/types';
10
10
  import dayjs from 'dayjs';
11
11
  import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
12
12
  import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
13
- import { IAppendFormRecordParams } from '../../modules/Holder/types';
14
13
  export declare class BookingByStepImpl extends BaseModule implements Module {
15
14
  protected defaultName: string;
16
15
  protected defaultVersion: string;
@@ -127,20 +126,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
127
126
  * @param params
128
127
  */
129
128
  fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
130
- /**
131
- * 获取 holder 表单 map
132
- */
133
- getHolderFormMap(): import("../../modules").HolderFormMap;
134
- /**
135
- * 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
136
- */
137
- refreshAllHolderFormRecords(params?: {
138
- customer_id?: number;
139
- }): Promise<import("../../modules").HolderFormMap>;
140
- /**
141
- * 添加表单记录
142
- */
143
- appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
144
129
  setDateRange(dateRange: ITime[]): Promise<void>;
145
130
  clearDateRange(): void;
146
131
  getDateRange(): Promise<ITime[]>;
@@ -317,7 +302,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
317
302
  autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
318
303
  errorList: any[];
319
304
  };
320
- getTimeSlotByAllResources(resources_code: string, split?: number): any[];
305
+ getTimeSlotByAllResources(resources_code: string): any[];
321
306
  getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
322
307
  resources_code: string;
323
308
  startDate: string;