@pisell/pisellos 2.3.172 → 2.3.173

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 (84) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -1
  3. package/dist/modules/BookingContext/utils/productExtend.d.ts +5 -0
  4. package/dist/modules/BookingContext/utils/productExtend.js +61 -23
  5. package/dist/modules/Discount/index.js +0 -1
  6. package/dist/modules/OpenData/index.d.ts +1 -0
  7. package/dist/modules/OpenData/index.js +1 -0
  8. package/dist/modules/OpenData/salesSettings.d.ts +32 -0
  9. package/dist/modules/OpenData/salesSettings.js +80 -0
  10. package/dist/modules/OpenData/types.d.ts +13 -0
  11. package/dist/modules/Order/index.d.ts +3 -25
  12. package/dist/modules/Order/index.js +1313 -1772
  13. package/dist/modules/Order/types.d.ts +0 -7
  14. package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
  15. package/dist/modules/Product/index.d.ts +1 -1
  16. package/dist/modules/ProductList/index.js +12 -33
  17. package/dist/modules/Rules/index.d.ts +0 -2
  18. package/dist/modules/Rules/index.js +21 -29
  19. package/dist/solution/BaseSales/index.d.ts +1 -16
  20. package/dist/solution/BaseSales/index.js +1325 -1511
  21. package/dist/solution/BookingByStep/index.d.ts +2 -2
  22. package/dist/solution/BookingTicket/index.d.ts +2 -2
  23. package/dist/solution/BookingTicket/index.js +108 -200
  24. package/dist/solution/BookingTicket/types.d.ts +2 -14
  25. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
  26. package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -4
  27. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +58 -94
  28. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -1
  29. package/dist/solution/BookingTicket/utils/scan/handleScan.js +1 -2
  30. package/dist/solution/UnifiedBookingSales/index.d.ts +23 -2
  31. package/dist/solution/UnifiedBookingSales/index.js +923 -683
  32. package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
  33. package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
  34. package/dist/utils/platform.d.ts +0 -2
  35. package/dist/utils/platform.js +0 -6
  36. package/lib/index.d.ts +0 -1
  37. package/lib/index.js +0 -12
  38. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  39. package/lib/modules/BookingContext/utils/productExtend.d.ts +5 -0
  40. package/lib/modules/BookingContext/utils/productExtend.js +36 -3
  41. package/lib/modules/Discount/index.js +0 -1
  42. package/lib/modules/OpenData/index.d.ts +1 -0
  43. package/lib/modules/OpenData/index.js +12 -0
  44. package/lib/modules/OpenData/salesSettings.d.ts +32 -0
  45. package/lib/modules/OpenData/salesSettings.js +70 -0
  46. package/lib/modules/OpenData/types.d.ts +13 -0
  47. package/lib/modules/Order/index.d.ts +3 -25
  48. package/lib/modules/Order/index.js +38 -192
  49. package/lib/modules/Order/types.d.ts +0 -7
  50. package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
  51. package/lib/modules/Product/index.d.ts +1 -1
  52. package/lib/modules/ProductList/index.js +0 -15
  53. package/lib/modules/Rules/index.d.ts +0 -2
  54. package/lib/modules/Rules/index.js +0 -6
  55. package/lib/solution/BaseSales/index.d.ts +1 -16
  56. package/lib/solution/BaseSales/index.js +9 -89
  57. package/lib/solution/BookingByStep/index.d.ts +2 -2
  58. package/lib/solution/BookingTicket/index.d.ts +2 -2
  59. package/lib/solution/BookingTicket/index.js +2 -38
  60. package/lib/solution/BookingTicket/types.d.ts +2 -14
  61. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
  62. package/lib/solution/BookingTicket/utils/addProductDecision.js +3 -4
  63. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -14
  64. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -1
  65. package/lib/solution/BookingTicket/utils/scan/handleScan.js +1 -2
  66. package/lib/solution/UnifiedBookingSales/index.d.ts +23 -2
  67. package/lib/solution/UnifiedBookingSales/index.js +131 -15
  68. package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
  69. package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
  70. package/lib/utils/platform.d.ts +0 -2
  71. package/lib/utils/platform.js +0 -7
  72. package/package.json +1 -1
  73. package/dist/inventory/index.d.ts +0 -92
  74. package/dist/inventory/index.js +0 -509
  75. package/dist/modules/Order/utils/productVoucherGroups.d.ts +0 -15
  76. package/dist/modules/Order/utils/productVoucherGroups.js +0 -115
  77. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +0 -10
  78. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +0 -117
  79. package/lib/inventory/index.d.ts +0 -92
  80. package/lib/inventory/index.js +0 -287
  81. package/lib/modules/Order/utils/productVoucherGroups.d.ts +0 -15
  82. package/lib/modules/Order/utils/productVoucherGroups.js +0 -64
  83. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +0 -10
  84. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +0 -71
@@ -7,7 +7,6 @@ var _exportNames = {
7
7
  BaseSalesImpl: true
8
8
  };
9
9
  exports.BaseSalesImpl = void 0;
10
- var _inventory = require("../../inventory");
11
10
  var _BaseModule = require("../../modules/BaseModule");
12
11
  var _localEftposState = require("../../modules/Order/localEftposState");
13
12
  var _types = require("./types");
@@ -512,40 +511,6 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
512
511
  order: undefined
513
512
  };
514
513
  otherParams = {};
515
- getInventory() {
516
- return this.otherParams.inventory;
517
- }
518
- async prepareCheckout(signal) {
519
- const inventory = this.getInventory();
520
- const hooks = this.otherParams.checkoutHooks;
521
- if (!inventory && !hooks?.beforeCheckout) return undefined;
522
- if (!this.store.order) throw new Error('Order module is not ready');
523
- return this.store.order.prepareCheckout(async items => {
524
- const assertCurrent = () => {
525
- if (signal?.aborted) throw Object.assign(new Error('Checkout cancelled'), {
526
- name: 'AbortError'
527
- });
528
- if (inventory !== this.getInventory() || hooks !== this.otherParams.checkoutHooks) throw (0, _inventory.salesGuardError)('The sales context changed. Please try again.');
529
- };
530
- assertCurrent();
531
- try {
532
- await hooks?.beforeCheckout?.({
533
- items,
534
- signal
535
- });
536
- if (inventory) await inventory.refresh({
537
- reason: 'checkout',
538
- force: true,
539
- signal
540
- });
541
- assertCurrent();
542
- return inventory?.freezeCheckout(items);
543
- } catch (error) {
544
- if (error?.name === 'AbortError') throw error;
545
- throw (0, _inventory.salesGuardError)(error instanceof Error ? error.message : String(error));
546
- }
547
- });
548
- }
549
514
  cacheId;
550
515
  /**
551
516
  * 由已在初始化阶段解析过设备短号的业务解决方案写入。
@@ -1436,35 +1401,12 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1436
1401
  }
1437
1402
  return (0, _types2.createModule)(moduleName, this.name);
1438
1403
  }
1439
- inventoryOrderHooks;
1440
1404
  getSubModuleHooks(moduleName) {
1441
1405
  const optionHooks = this.initializeOptions.hooks || {};
1442
1406
  const otherHooks = this.otherParams.hooks || {};
1443
1407
  if (moduleName === 'order') {
1444
1408
  const directOrderHooks = optionHooks;
1445
- const hooks = optionHooks.order || this.otherParams.order?.hooks || otherHooks.order || (directOrderHooks.onBeforeMergeProductToOrder || directOrderHooks.onBeforeCartCommit ? directOrderHooks : undefined);
1446
- const inventory = this.getInventory();
1447
- if (!inventory) {
1448
- this.inventoryOrderHooks = undefined;
1449
- return hooks;
1450
- }
1451
- if (this.inventoryOrderHooks?.inventory === inventory && this.inventoryOrderHooks.base === hooks) {
1452
- return this.inventoryOrderHooks.hooks;
1453
- }
1454
- const combined = {
1455
- ...hooks,
1456
- onBeforeCartCommit: async context => {
1457
- await hooks?.onBeforeCartCommit?.(context);
1458
- if (inventory !== this.getInventory()) throw (0, _inventory.salesGuardError)('The sales context changed. Please try again.');
1459
- inventory.validate(context.proposedItems, context.currentItems);
1460
- }
1461
- };
1462
- this.inventoryOrderHooks = {
1463
- inventory,
1464
- base: hooks,
1465
- hooks: combined
1466
- };
1467
- return combined;
1409
+ return optionHooks.order || this.otherParams.order?.hooks || otherHooks.order || (directOrderHooks.onBeforeMergeProductToOrder ? directOrderHooks : undefined);
1468
1410
  }
1469
1411
  return optionHooks[moduleName] || this.otherParams[moduleName]?.hooks || otherHooks[moduleName];
1470
1412
  }
@@ -1512,10 +1454,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1512
1454
  const nextSubModuleOtherParams = this.buildSubModuleOtherParams(moduleName);
1513
1455
  await targetModule.updateOtherParams(nextSubModuleOtherParams, {
1514
1456
  changedParams,
1515
- cover,
1516
- ...(moduleName === 'order' ? {
1517
- hooks: this.getSubModuleHooks(moduleName)
1518
- } : {})
1457
+ cover
1519
1458
  });
1520
1459
  }));
1521
1460
  }
@@ -1664,17 +1603,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1664
1603
  }
1665
1604
  return isChanged;
1666
1605
  }
1667
- initialization;
1668
-
1669
- /** Hosts can await readiness without changing Core's synchronous registration API. */
1670
- whenInitialized() {
1671
- return this.initialization || Promise.reject(new Error('Sales module is not registered'));
1672
- }
1673
- initialize(core, options = {}) {
1674
- this.initialization = this.initializeSalesRuntime(core, options);
1675
- return this.initialization;
1676
- }
1677
- async initializeSalesRuntime(core, options = {}) {
1606
+ async initialize(core, options = {}) {
1678
1607
  this.resetPickupTimingCache();
1679
1608
  this.core = core;
1680
1609
  this.initializeOptions = options || {};
@@ -1734,19 +1663,17 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
1734
1663
  this.serverOrderChangeUnsubscribe = null;
1735
1664
  this.paymentMethodsChangedUnsubscribe?.();
1736
1665
  this.paymentMethodsChangedUnsubscribe = null;
1737
- for (const key of Object.keys(this.store)) {
1738
- if (this.reusedSharedSubModuleNames.has(key)) continue;
1666
+ Object.keys(this.store).forEach(key => {
1667
+ if (this.reusedSharedSubModuleNames.has(key)) return;
1739
1668
  const sub = this.store[key];
1740
1669
  if (sub && typeof sub.destroy === 'function') {
1741
1670
  try {
1742
- // A host may register a replacement after destroy resolves. Wait for
1743
- // nested modules so their cleanup cannot unregister the replacement.
1744
- await sub.destroy();
1671
+ sub.destroy();
1745
1672
  } catch (error) {
1746
1673
  console.warn(`[BaseSales] 子模块 ${key} 销毁失败`, error);
1747
1674
  }
1748
1675
  }
1749
- }
1676
+ });
1750
1677
  this.currentSalesDetail = null;
1751
1678
  this.paymentNumberDevicePrefix = null;
1752
1679
  this.queuedServerOrderChanges = [];
@@ -2514,10 +2441,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
2514
2441
  }
2515
2442
  await discountModule.setDiscountList(params.discountList);
2516
2443
  }
2517
- async scanPromotionCode(code, customerId, options) {
2444
+ async scanPromotionCode(code, customerId) {
2518
2445
  try {
2519
2446
  if (!this.store.order) throw new Error('order 模块未初始化');
2520
- const raw = await this.store.order.scanCode(code, customerId, options);
2447
+ const raw = await this.store.order.scanCode(code, customerId);
2521
2448
  if (raw.isAvailable) {
2522
2449
  await this.store.order.recalculateSummary({
2523
2450
  createIfMissing: true
@@ -4337,13 +4264,6 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
4337
4264
  });
4338
4265
  });
4339
4266
  }
4340
- setProductVoucherGroups(groups) {
4341
- if (!this.store.order) throw new Error('order 模块未初始化');
4342
- this.store.order.setProductVoucherGroups(groups);
4343
- }
4344
- validateProductVoucherSelection() {
4345
- this.store.order?.validateProductVoucherSelection();
4346
- }
4347
4267
  async addProductToOrder(product, booking, options) {
4348
4268
  try {
4349
4269
  if (!this.store.order) throw new Error('order 模块未初始化');
@@ -328,7 +328,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
328
328
  date: string;
329
329
  status: string;
330
330
  week: string;
331
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
331
+ weekNum: 0 | 1 | 2 | 6 | 3 | 4 | 5;
332
332
  }[]>;
333
333
  submitTimeSlot(timeSlots: TimeSliceItem): void;
334
334
  private getScheduleDataByIds;
@@ -375,7 +375,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
375
375
  };
376
376
  setOtherData(key: string, value: any): void;
377
377
  getOtherData(key: string): any;
378
- getProductTypeById(id: number): Promise<"duration" | "normal" | "session">;
378
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
379
379
  /**
380
380
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
381
381
  *
@@ -447,7 +447,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
447
447
  /**
448
448
  * 构造 BookingContext 计算上下文(供 getProductExtend / getResourceByIds 等读 API 复用)。
449
449
  */
450
- private buildBookingCalcContext;
450
+ protected buildBookingCalcContext(extra?: Partial<BookingCalcContext>): BookingCalcContext;
451
451
  /**
452
452
  * 取商品当前可选资源列表(透传 OS BookingContext utils#getResourceByIds)。
453
453
  * `extraResources` 用于把拖入未绑定的资源也展示出来。
@@ -480,7 +480,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
480
480
  /**
481
481
  * 拼装 addProductDecision 通用上下文(从 store 自取)。
482
482
  */
483
- private buildAddProductCtx;
483
+ protected buildAddProductCtx(extra?: Partial<AddProductDecideContext>): AddProductDecideContext;
484
484
  /**
485
485
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
486
486
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
@@ -30,7 +30,6 @@ var _handleScan = require("./utils/scan/handleScan");
30
30
  var _scanCache = _interopRequireDefault(require("./utils/scan/scanCache"));
31
31
  var _formatGlobalScan = require("./utils/scan/formatGlobalScan");
32
32
  var _applyGlobalScan = require("./utils/scan/applyGlobalScan");
33
- var _applyProductVoucherCollectionScan = require("./utils/scan/applyProductVoucherCollectionScan");
34
33
  var _cartView = require("./utils/cartView");
35
34
  var _addProductDecision = require("./utils/addProductDecision");
36
35
  var _buildCacheItemFromOrderLine = require("../../modules/BookingContext/utils/buildCacheItemFromOrderLine");
@@ -1846,20 +1845,6 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
1846
1845
  return bridge.openBookingEdit(payload);
1847
1846
  } : undefined
1848
1847
  } : undefined;
1849
- if (guardedBridge?.scanScope === 'product-voucher') {
1850
- if (!guardedBridge.applyPromotionCode) return {
1851
- status: 'failed',
1852
- reason: 'no_bridge'
1853
- };
1854
- const promotion = await guardedBridge.applyPromotionCode(trimmed);
1855
- return promotion.isAccepted ?? promotion.isAvailable ? {
1856
- status: 'success',
1857
- kind: 'promotion'
1858
- } : {
1859
- status: 'failed',
1860
- reason: 'not_found'
1861
- };
1862
- }
1863
1848
  const localSearch = v => this.store.products.findProductsByCodeOrBarcode(v);
1864
1849
  const scanCallback = (0, _handleScan.handleGlobalScan)(this.request, localSearch, this.getSubmitOrderSalesChannel());
1865
1850
  const raw = await scanCallback({
@@ -1874,7 +1859,7 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
1874
1859
  reason: 'not_found'
1875
1860
  };
1876
1861
  }
1877
- const host = {
1862
+ const result = await (0, _applyGlobalScan.applyGlobalScan)({
1878
1863
  setOrderCustomer: customer => {
1879
1864
  beforeScanCommit();
1880
1865
  this.setOrderCustomer(customer);
@@ -1895,31 +1880,10 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
1895
1880
  beforeScanCommit();
1896
1881
  return this.scanWalletAsset(scanCode);
1897
1882
  }
1898
- };
1899
- const result = guardedBridge?.scanScope === 'product-voucher-collection' ? await (0, _applyProductVoucherCollectionScan.applyProductVoucherCollectionScan)({
1900
- ...host,
1901
- waitForCustomerDiscounts: () => this.orderCustomerDiscountRefreshInFlight || Promise.resolve(),
1902
- loadCustomerDiscounts: async () => {
1903
- beforeScanCommit();
1904
- const customerId = Number(this.getOrderCustomer()?.customer_id || 0);
1905
- if (customerId <= 1) return [];
1906
- await this.refreshDiscountConfigAfterOrderCustomerChange(customerId);
1907
- beforeScanCommit();
1908
- return this.getDiscountList();
1909
- }
1910
- }, formatted, guardedBridge) : await (0, _applyGlobalScan.applyGlobalScan)(host, formatted, guardedBridge);
1883
+ }, formatted, guardedBridge);
1911
1884
  bridge?.refresh?.();
1912
1885
  return result;
1913
1886
  } catch (error) {
1914
- if (bridge?.scanScope === 'product-voucher-collection') {
1915
- if (bridge.isCurrent?.() === false) return {
1916
- status: 'cancelled'
1917
- };
1918
- return {
1919
- status: 'failed',
1920
- reason: 'entry_resolution_failed'
1921
- };
1922
- }
1923
1887
  console.error('[BookingTicket] handleGlobalScanCode failed', error);
1924
1888
  bridge?.onNotify?.('fail', 'pisell2.text.scan-global-failed');
1925
1889
  return {
@@ -208,10 +208,6 @@ export interface AddAddTimeProductsToBookingInput {
208
208
  }
209
209
  /** 扫码宿主桥接:SalesSdk 在 pubsub 订阅回调里注入,OS 需要 UI 时直接调用 */
210
210
  export interface GlobalScanHostBridge {
211
- /** product-voucher handles voucher codes only; product-voucher-collection also resolves wallet customer vouchers. */
212
- scanScope?: 'all' | 'product-voucher' | 'product-voucher-collection';
213
- /** A one-shot entry may outlive its page while requests are in flight. */
214
- isCurrent?: () => boolean;
215
211
  openProductDetail?: (payload: Record<string, any>) => Promise<any | null>;
216
212
  openBookingEdit?: (payload: Record<string, any>) => Promise<any | null>;
217
213
  confirmDetail?: (input: {
@@ -236,13 +232,11 @@ export interface GlobalScanHostBridge {
236
232
  */
237
233
  applyPromotionCode?: (code: string, customerId?: number, options?: {
238
234
  suppressFailureNotification?: boolean;
239
- productVouchersOnly?: boolean;
240
235
  }) => Promise<{
241
236
  isAvailable?: boolean;
242
237
  isAccepted?: boolean;
243
238
  type?: string;
244
239
  unavailableReason?: string;
245
- scannedDiscountList?: Record<string, any>[];
246
240
  }>;
247
241
  /** 当前订单已有其他客户时,由宿主复用客户组件完成确认及切换。 */
248
242
  requestCustomerSwitch?: (customer: ICustomer) => Promise<boolean | null>;
@@ -250,7 +244,7 @@ export interface GlobalScanHostBridge {
250
244
  refresh?: () => void;
251
245
  }
252
246
  /** handleGlobalScanCode 结构化返回 */
253
- export type GlobalScanHandleResult = ({
247
+ export type GlobalScanHandleResult = {
254
248
  status: 'success';
255
249
  kind: 'customer' | 'products' | 'promotion';
256
250
  meta?: {
@@ -263,11 +257,5 @@ export type GlobalScanHandleResult = ({
263
257
  status: 'cancelled';
264
258
  } | {
265
259
  status: 'failed';
266
- reason: 'empty_code' | 'not_found' | 'invalid_data' | 'no_bridge' | 'entry_resolution_failed';
267
- }) & {
268
- /** product-voucher-collection returns voucher candidates; the caller decides how to use them. */
269
- redemption?: {
270
- source: 'wallet' | 'scan';
271
- vouchers: Record<string, any>[];
272
- };
260
+ reason: 'empty_code' | 'not_found' | 'invalid_data' | 'no_bridge';
273
261
  };
@@ -5,7 +5,7 @@ import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from
5
5
  * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
6
6
  *
7
7
  * 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
8
- * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
8
+ * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(kiosk 强制进入;其他渠道由 `getIsAutoClose` 决定)
9
9
  * 3. `add`:两关均通过,直接 transform + 加车
10
10
  */
11
11
  export type AddProductDecision = {
@@ -17,13 +17,12 @@ var _dayjs = _interopRequireDefault(require("dayjs"));
17
17
  var _BookingContext = require("../../../modules/BookingContext");
18
18
  var _transformBaseProductToOrderProduct = require("../../BaseSales/utils/transformBaseProductToOrderProduct");
19
19
  var _weighingProductSku = require("./weighingProductSku");
20
- var _platform = require("../../../utils/platform");
21
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
21
  /**
23
22
  * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
24
23
  *
25
24
  * 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
26
- * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
25
+ * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(kiosk 强制进入;其他渠道由 `getIsAutoClose` 决定)
27
26
  * 3. `add`:两关均通过,直接 transform + 加车
28
27
  */
29
28
 
@@ -40,11 +39,11 @@ function needsSpecDetailModal(item) {
40
39
  }
41
40
 
42
41
  /**
43
- * 第二段:预约商品是否仍需打开资源 / 时间编辑(自助终端强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
42
+ * 第二段:预约商品是否仍需打开资源 / 时间编辑(kiosk 强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
44
43
  */
45
44
  function needsBookingEdit(cacheItem, ctx) {
46
45
  if (isNormalBookingProduct(cacheItem)) return false;
47
- if ((0, _platform.isSelfServicePlatform)(ctx?.channel)) return true;
46
+ if (ctx?.channel === 'kiosk') return true;
48
47
  const isAutoAllocationOn = ctx?.isAutoAllocationOn || (() => true);
49
48
  return !(0, _BookingContext.getIsAutoClose)(cacheItem, isAutoAllocationOn);
50
49
  }
@@ -289,18 +289,6 @@ async function applyGlobalScan(host, formatted, bridge) {
289
289
  // batch-search 可能返回来源门店客户;先映射到当前门店,确保 Wallet
290
290
  // 支付资产查询使用本店客户上下文。
291
291
  const bindResult = await bindWalletPassCustomer();
292
- // Voucher collection prioritizes goods coupons resolved from the wristband/order.
293
- // Only this opt-in flow checks them before selecting a payment wallet asset.
294
- const collectionPromotion = bridge?.scanScope === 'product-voucher-collection' && bridge.applyPromotionCode ? await bridge.applyPromotionCode(scanCode, getRealCustomerId(activeCustomer), {
295
- suppressFailureNotification: true,
296
- productVouchersOnly: true
297
- }) : undefined;
298
- if (collectionPromotion?.isAccepted ?? collectionPromotion?.isAvailable) {
299
- return {
300
- status: 'success',
301
- kind: 'promotion'
302
- };
303
- }
304
292
  const walletSelection = await trySelectWalletAsset();
305
293
  if (walletSelection) return walletSelection;
306
294
  if (!bridge?.applyPromotionCode) {
@@ -310,9 +298,9 @@ async function applyGlobalScan(host, formatted, bridge) {
310
298
  };
311
299
  }
312
300
  const promotionCustomerId = getRealCustomerId(activeCustomer);
313
- const promotionResult = collectionPromotion ?? (bindResult.customerBound ? await bridge.applyPromotionCode(scanCode, promotionCustomerId, {
301
+ const promotionResult = bindResult.customerBound ? await bridge.applyPromotionCode(scanCode, promotionCustomerId, {
314
302
  suppressFailureNotification: true
315
- }) : await bridge.applyPromotionCode(scanCode, promotionCustomerId));
303
+ }) : await bridge.applyPromotionCode(scanCode, promotionCustomerId);
316
304
  if (promotionResult?.isAccepted ?? promotionResult?.isAvailable) {
317
305
  return {
318
306
  status: 'success',
@@ -10,7 +10,6 @@ exports.searchWalletPass = exports.searchWallet = exports.searchProduct = export
10
10
  const searchWalletPass = async (request, code) => {
11
11
  const params = {
12
12
  code,
13
- resolve_ticket_order: 1,
14
13
  translate_flag: 1,
15
14
  // 翻译识别码名称 0:不翻译 1:翻译
16
15
  relation_product: 1,
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.handleUniversalScan = exports.handleGlobalScan = exports.handleCustomerScan = void 0;
7
7
  var _cloudSearch = require("./cloudSearch");
8
8
  var _scanCache = _interopRequireDefault(require("./scanCache"));
9
- var _platform = require("../../../../utils/platform");
10
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
10
  /**
12
11
  * Promise.any 的替代实现
@@ -108,7 +107,7 @@ const handleGlobalScan = (request, localSearch, channel) => {
108
107
  if (value.startsWith('WL')) {
109
108
  requestList = [(0, _cloudSearch.searchWallet)(request, value)];
110
109
  } else {
111
- requestList = [...((0, _platform.isSelfServicePlatform)(channel) ? [] : [(0, _cloudSearch.searchOrder)(request, value)]), (0, _cloudSearch.searchWalletPass)(request, value), (0, _cloudSearch.searchWallet)(request, value), (0, _cloudSearch.searchProduct)(request, value)];
110
+ requestList = [...(channel === 'kiosk' ? [] : [(0, _cloudSearch.searchOrder)(request, value)]), (0, _cloudSearch.searchWalletPass)(request, value), (0, _cloudSearch.searchWallet)(request, value), (0, _cloudSearch.searchProduct)(request, value)];
112
111
  }
113
112
  return requestList;
114
113
  };
@@ -1,6 +1,8 @@
1
1
  import type { Module, ModuleOptions, PisellCore } from '../../types';
2
2
  import type { ProductData } from '../../modules';
3
- import { type InvoiceLayoutConfig, type InvoiceTemplateSettings, type OpenDataConfig } from '../../modules/OpenData';
3
+ import type { BookingCalcContext } from '../../modules/BookingContext';
4
+ import type { AddProductDecideContext } from '../BookingTicket/utils/addProductDecision';
5
+ import { type InvoiceLayoutConfig, type InvoiceTemplateSettings, type OpenDataConfig, type ResolvedSalesSettings } from '../../modules/OpenData';
4
6
  import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../modules/Schedule/types';
5
7
  import type { ProductListLoadProductsParams, ProductListStoreQueryParams } from '../../modules/ProductList';
6
8
  import type { AvailabilityDateRange, AvailabilityOccupancy, AvailabilityProduct, AvailabilityResource, GetProductTimeRangesRequest } from '../../modules/ResourcePlanner';
@@ -9,6 +11,7 @@ import type { BusinessAvailability } from '../../modules/BusinessAvailability';
9
11
  import { BookingTicket } from '../BookingTicket';
10
12
  import type { AllergyRequirement } from '../../model/strategy/adapter/itemRule';
11
13
  export * from './types';
14
+ export * from './salesSettings';
12
15
  export type { BusinessAvailability, BusinessClosedBehavior } from '../../modules/BusinessAvailability';
13
16
  export { AvailabilityError } from '../../modules/ResourcePlanner';
14
17
  /**
@@ -156,7 +159,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
156
159
  /** 在 Kiosk 拉起支付设备前补齐订单号,同一订单重试复用已分配的号码。 */
157
160
  ensureLocalOrderNumbersForCheckout(): Promise<void>;
158
161
  /**
159
- * PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
162
+ * PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
160
163
  * 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
161
164
  */
162
165
  protected shouldUseCheckoutSyncTask(): boolean;
@@ -178,6 +181,24 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
178
181
  /** A successful configuration belongs to this business runtime until an explicit refresh. */
179
182
  loadOpenData(params: UnifiedBookingSalesLoadOpenDataParams): Promise<OpenDataConfig>;
180
183
  getOpenData(): Promise<OpenDataConfig | null>;
184
+ /** One policy snapshot for all Sales 2.0 consumers. Network errors must reach the caller. */
185
+ getSalesSettings(): Promise<ResolvedSalesSettings>;
186
+ private getLoadedSalesSettings;
187
+ private getProductBookingsForScheduling;
188
+ private shouldApplyMultipleBookingScheduling;
189
+ private resolveLoadedDefaultBookingStart;
190
+ /** Used by the SKU flow after Holder changes, without changing an explicit user-selected time. */
191
+ resolveDefaultBookingStart(params: {
192
+ holderIds?: unknown;
193
+ fallback?: string;
194
+ }): Promise<string | undefined>;
195
+ protected buildBookingCalcContext(extra?: Partial<BookingCalcContext>): BookingCalcContext;
196
+ protected buildAddProductCtx(extra?: Partial<AddProductDecideContext>): AddProductDecideContext;
197
+ /** Re-evaluate an automatic default after Holder enrichment, or restore a known explicit TimeBar start. */
198
+ applyDefaultBookingStart(cacheItem: any, options?: {
199
+ holderIds?: unknown;
200
+ explicitStart?: string;
201
+ }): Promise<any>;
181
202
  protected loadPickupTimingOpenData(_force: boolean): Promise<Record<string, unknown>>;
182
203
  private resetAllergyItemRuleState;
183
204
  private fetchAllergyItemRuleConfigs;