@pisell/pisellos 0.10.80 → 0.10.82

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 (42) hide show
  1. package/dist/modules/ProductList/index.js +5 -0
  2. package/dist/modules/ResourcePlanner/planner.js +2 -1
  3. package/dist/solution/BookingByStep/index.d.ts +1 -1
  4. package/dist/solution/BookingTicket/index.d.ts +1 -1
  5. package/dist/solution/BookingTicket/index.js +36 -31
  6. package/dist/solution/ScanOrder/index.d.ts +0 -1
  7. package/dist/solution/ScanOrder/index.js +62 -59
  8. package/dist/solution/ScanOrder/types.d.ts +2 -0
  9. package/dist/solution/ScanOrder/types.js +2 -0
  10. package/dist/solution/UnifiedBookingSales/index.d.ts +11 -1
  11. package/dist/solution/UnifiedBookingSales/index.js +1485 -1163
  12. package/dist/solution/UnifiedBookingSales/types.d.ts +5 -0
  13. package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +11 -5
  14. package/dist/solution/VenueBooking/index.js +111 -104
  15. package/dist/solution/VenueBooking/types.d.ts +2 -0
  16. package/dist/solution/VenueBooking/types.js +3 -1
  17. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +1 -0
  18. package/dist/solution/VenueBooking/utils/smartPricing.js +6 -1
  19. package/dist/utils/hostLogger.d.ts +10 -0
  20. package/dist/utils/hostLogger.js +20 -0
  21. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  22. package/lib/modules/ProductList/index.js +5 -0
  23. package/lib/modules/ResourcePlanner/planner.js +2 -1
  24. package/lib/solution/BookingByStep/index.d.ts +1 -1
  25. package/lib/solution/BookingTicket/index.d.ts +1 -1
  26. package/lib/solution/BookingTicket/index.js +5 -4
  27. package/lib/solution/ScanOrder/index.d.ts +0 -1
  28. package/lib/solution/ScanOrder/index.js +47 -41
  29. package/lib/solution/ScanOrder/types.d.ts +2 -0
  30. package/lib/solution/ScanOrder/types.js +1 -0
  31. package/lib/solution/UnifiedBookingSales/index.d.ts +11 -1
  32. package/lib/solution/UnifiedBookingSales/index.js +269 -57
  33. package/lib/solution/UnifiedBookingSales/types.d.ts +5 -0
  34. package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +9 -5
  35. package/lib/solution/VenueBooking/index.js +38 -47
  36. package/lib/solution/VenueBooking/types.d.ts +2 -0
  37. package/lib/solution/VenueBooking/types.js +3 -1
  38. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +1 -0
  39. package/lib/solution/VenueBooking/utils/smartPricing.js +6 -1
  40. package/lib/utils/hostLogger.d.ts +10 -0
  41. package/lib/utils/hostLogger.js +25 -0
  42. package/package.json +1 -1
@@ -440,9 +440,14 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
440
440
  channel = (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.channel;
441
441
  _context7.next = 5;
442
442
  return this.request.post('/product/query', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
443
+ // Bypass the endpoint cache when seeding this pool; subsequent reads still
444
+ // reuse the venue catalog session's single local snapshot.
445
+ force_ignore_cache_flag: 1,
443
446
  // The customer endpoint otherwise filters out future/variant members.
444
447
  open_quotation: 0,
445
448
  open_bundle: 1,
449
+ // Preserve the same deposit source data used by the existing sales flow.
450
+ open_deposit: 1,
446
451
  with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS),
447
452
  with_count: ['bundleGroup', 'optionGroup'],
448
453
  with_schedule: 1,
@@ -171,6 +171,7 @@ function resolveCutOffPolicyIssue(policy) {
171
171
  return null;
172
172
  }
173
173
  function addLeadWindow(base, unit, unitType, _timezoneName) {
174
+ // Calendar-day lead times retain the current local hour, minute and second.
174
175
  if (unitType === 'days') return addLocalCalendarDays(base, unit);
175
176
  if (unitType === 'hours') return addLocalHours(base, unit);
176
177
  return addLocalMinutes(base, unit);
@@ -1925,7 +1926,7 @@ export function queryAvailabilityProjection(projection, request) {
1925
1926
  var _extractFixedOffsetMi6, _request$productIds2;
1926
1927
  var runtimeOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1927
1928
  var normalizedPartySize = normalizePartySize(request.partySize);
1928
- var evaluatedAt = formatDateTime(localDateToScalar(new Date()), projection.meta.timezone, (_extractFixedOffsetMi6 = extractFixedOffsetMinutes(projection.meta.now)) !== null && _extractFixedOffsetMi6 !== void 0 ? _extractFixedOffsetMi6 : captureRuntimeOffsetMinutes());
1929
+ var evaluatedAt = runtimeOptions.evaluatedAt || formatDateTime(localDateToScalar(new Date()), projection.meta.timezone, (_extractFixedOffsetMi6 = extractFixedOffsetMinutes(projection.meta.now)) !== null && _extractFixedOffsetMi6 !== void 0 ? _extractFixedOffsetMi6 : captureRuntimeOffsetMinutes());
1929
1930
  if (request.target === 'time') {
1930
1931
  assertTimeCandidates(request);
1931
1932
  assertRangesWithinProjection(projection, request.candidates);
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
329
+ weekNum: 0 | 2 | 1 | 3 | 5 | 6 | 4;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -360,7 +360,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
360
360
  * 获取当前的客户搜索条件
361
361
  * @returns 当前搜索条件
362
362
  */
363
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
363
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
364
364
  /**
365
365
  * 获取客户列表状态(包含滚动加载相关状态)
366
366
  * @returns 客户状态
@@ -594,35 +594,40 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
594
594
  key: "configureIdGeneratorFromOpenData",
595
595
  value: function () {
596
596
  var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
597
- var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
597
+ var _this$otherParams5, _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
598
598
  var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
599
599
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
600
600
  while (1) switch (_context9.prev = _context9.next) {
601
601
  case 0:
602
+ if (!isCustomerUserPlatform((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform)) {
603
+ _context9.next = 2;
604
+ break;
605
+ }
606
+ return _context9.abrupt("return");
607
+ case 2:
602
608
  // 业务码切换或配置失败时不能复用上一次初始化的短号。
603
609
  this.setPaymentNumberDevicePrefix(null);
604
- idGenerator = this.getIdGeneratorPlugin();
605
- if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
606
- _context9.next = 5;
610
+ idGenerator = this.getIdGeneratorPlugin(); // Optional host capability. Do not warn or cache absence: POS may register it later.
611
+ if (!(typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.configure) !== 'function')) {
612
+ _context9.next = 6;
607
613
  break;
608
614
  }
609
- console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
610
615
  return _context9.abrupt("return");
611
- case 5:
616
+ case 6:
612
617
  openDataConfig = null;
613
- _context9.prev = 6;
614
- _context9.next = 9;
618
+ _context9.prev = 7;
619
+ _context9.next = 10;
615
620
  return this.loadOpenDataConfig();
616
- case 9:
621
+ case 10:
617
622
  openDataConfig = _context9.sent;
618
- _context9.next = 16;
623
+ _context9.next = 17;
619
624
  break;
620
- case 12:
621
- _context9.prev = 12;
622
- _context9.t0 = _context9["catch"](6);
625
+ case 13:
626
+ _context9.prev = 13;
627
+ _context9.t0 = _context9["catch"](7);
623
628
  console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context9.t0);
624
629
  return _context9.abrupt("return");
625
- case 16:
630
+ case 17:
626
631
  // if (!openDataConfig) return;
627
632
  receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
628
633
  receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
@@ -633,21 +638,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
633
638
  "type": "start_time",
634
639
  "time": "00:00"
635
640
  };
636
- _context9.next = 24;
641
+ _context9.next = 25;
637
642
  return this.getShortNumberOrDeviceId();
638
- case 24:
643
+ case 25:
639
644
  deviceId = _context9.sent;
640
645
  this.setPaymentNumberDevicePrefix(deviceId);
641
646
  businessCode = this.getBookingTicketBusinessCode();
642
647
  if (businessCode) {
643
- _context9.next = 30;
648
+ _context9.next = 31;
644
649
  break;
645
650
  }
646
651
  console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
647
652
  return _context9.abrupt("return");
648
- case 30:
649
- _context9.prev = 30;
650
- _context9.next = 33;
653
+ case 31:
654
+ _context9.prev = 31;
655
+ _context9.next = 34;
651
656
  return idGenerator.configure({
652
657
  biz: businessCode,
653
658
  config: {
@@ -662,18 +667,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
662
667
  shopOrderPrefix: shopOrderPrefix
663
668
  }
664
669
  });
665
- case 33:
666
- _context9.next = 38;
670
+ case 34:
671
+ _context9.next = 39;
667
672
  break;
668
- case 35:
669
- _context9.prev = 35;
670
- _context9.t1 = _context9["catch"](30);
673
+ case 36:
674
+ _context9.prev = 36;
675
+ _context9.t1 = _context9["catch"](31);
671
676
  console.warn('[BookingTicket] idGenerator 配置失败', _context9.t1);
672
- case 38:
677
+ case 39:
673
678
  case "end":
674
679
  return _context9.stop();
675
680
  }
676
- }, _callee9, this, [[6, 12], [30, 35]]);
681
+ }, _callee9, this, [[7, 13], [31, 36]]);
677
682
  }));
678
683
  function configureIdGeneratorFromOpenData() {
679
684
  return _configureIdGeneratorFromOpenData.apply(this, arguments);
@@ -1838,8 +1843,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1838
1843
  }, {
1839
1844
  key: "getCustomerContactScope",
1840
1845
  value: function getCustomerContactScope() {
1841
- var _this$otherParams5, _this$otherParams6, _this$otherParams7;
1842
- return JSON.stringify([this.getPickupTimingScope(), (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.channel, (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.shop_id, (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.tenantId]);
1846
+ var _this$otherParams6, _this$otherParams7, _this$otherParams8;
1847
+ return JSON.stringify([this.getPickupTimingScope(), (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel, (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.shop_id, (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.tenantId]);
1843
1848
  }
1844
1849
  }, {
1845
1850
  key: "getCustomerContactOrderKey",
@@ -1906,7 +1911,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1906
1911
  key: "prefillOrderCustomerContactInfo",
1907
1912
  value: function prefillOrderCustomerContactInfo(customer, customerChanged) {
1908
1913
  var _order$_extend2,
1909
- _this$otherParams8,
1914
+ _this$otherParams9,
1910
1915
  _this4 = this;
1911
1916
  var order = this.getTempOrder();
1912
1917
  var customerId = Number(order === null || order === void 0 ? void 0 : order.customer_id);
@@ -1922,7 +1927,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1922
1927
  }
1923
1928
  // A relation explicitly returned as null is authoritative. Only a missing relation needs fetching.
1924
1929
  if (customer.contacts_info !== undefined) return;
1925
- var userPlatform = isCustomerUserPlatform((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform);
1930
+ var userPlatform = isCustomerUserPlatform((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.platform);
1926
1931
  var getAuthenticatedCustomerId = function getAuthenticatedCustomerId() {
1927
1932
  var _this4$core, _this4$core$getPlugin, _this4$core$getPlugin2;
1928
1933
  return Number((_this4$core = _this4.core) === null || _this4$core === void 0 || (_this4$core$getPlugin = _this4$core.getPlugin) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin = _this4$core$getPlugin.call(_this4$core, 'user')) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin.get) === null || _this4$core$getPlugin2 === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin2.call(_this4$core$getPlugin)) === null || _this4$core$getPlugin2 === void 0 ? void 0 : _this4$core$getPlugin2.id);
@@ -56,7 +56,6 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
56
56
  private refreshOrderMarketingAfterLogin;
57
57
  constructor(name?: string, version?: string);
58
58
  protected getRegisteredModuleNames(): readonly string[];
59
- protected createSubModule(moduleName: string): Module | null;
60
59
  /** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
61
60
  getCacheId(): string | undefined;
62
61
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
@@ -33,7 +33,7 @@ import { AccountHooks } from "../../modules/Account/types";
33
33
  import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
34
34
  import Decimal from 'decimal.js';
35
35
  import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, collectLinkProductIdsFromReservationRules, computeResourceIsFull, filterProductsForScanOrderMore, findReservationRuleProductByResourceId, getProductIdentityIndex, getSafeProductNum, hasCustomCapacityProduct, pickFirstCustomCapacityDimensionId, pickFirstCustomCapacityPaxBounds, normalizeEnabledItemRuleIds, normalizeOrderProduct, normalizeItemRuleStrategies, pickFirstDurationMinutesFromProducts, toNonNegativeInt, toPriceString, toBoolean, toPositiveString } from "./utils";
36
- import { createModule } from "../BookingByStep/types";
36
+ import { writeHostLog } from "../../utils/hostLogger";
37
37
  import { ProductList } from "../../modules/ProductList";
38
38
  import { getDateIsInSchedule } from "../../modules/Schedule/getDateIsInSchedule";
39
39
  import { composeLinePrice, buildSubmitPayload, createUuidV4, getProductSkuOptions, normalizeSubmitCollectPaxValue, sumOptionUnitPrice } from "../../modules/Order/utils";
@@ -89,10 +89,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
89
89
  _createClass(ScanOrderImpl, [{
90
90
  key: "getScanOrderLoggerContext",
91
91
  value: function getScanOrderLoggerContext() {
92
+ var _this$window, _this$otherParams, _this$otherParams2, _this$otherParams3;
92
93
  return {
93
94
  cacheId: this.cacheId,
94
95
  solutionName: this.name,
95
- moduleName: 'scanOrder'
96
+ moduleName: 'scanOrder',
97
+ host: (_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.location) === null || _this$window === void 0 ? void 0 : _this$window.host,
98
+ platform: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform,
99
+ channel: (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel,
100
+ businessCode: (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode
96
101
  };
97
102
  }
98
103
  }, {
@@ -148,7 +153,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
148
153
  key: "addScanOrderLog",
149
154
  value: function () {
150
155
  var _addScanOrderLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
151
- var payload, extra, logger;
156
+ var _params$payload;
157
+ var payload, extra;
152
158
  return _regeneratorRuntime().wrap(function _callee$(_context) {
153
159
  while (1) switch (_context.prev = _context.next) {
154
160
  case 0:
@@ -156,25 +162,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
156
162
  cacheId: this.cacheId
157
163
  }, params.payload || {});
158
164
  extra = _objectSpread({}, params.extra || {});
159
- logger = this.store.scanOrderLogger;
160
- if (logger) {
161
- _context.next = 6;
162
- break;
163
- }
164
- if ((params.level || 'info') === 'error') {
165
- console.error('[ScanOrder][log-fallback]', params.title, {
165
+ writeHostLog(this.core, _objectSpread(_objectSpread({
166
+ type: params.level || 'info',
167
+ title: params.title
168
+ }, params.timestamp ? {
169
+ date: params.timestamp
170
+ } : {}), {}, {
171
+ metadata: {
172
+ module: 'scanOrder',
173
+ action: ((_params$payload = params.payload) === null || _params$payload === void 0 ? void 0 : _params$payload.method) || 'addLog',
166
174
  payload: payload,
167
- extra: extra
168
- });
169
- } else {}
170
- return _context.abrupt("return");
171
- case 6:
172
- _context.next = 8;
173
- return logger.addLog(_objectSpread(_objectSpread({}, params), {}, {
174
- payload: payload,
175
- extra: extra
175
+ extra: extra,
176
+ context: this.getScanOrderLoggerContext()
177
+ }
176
178
  }));
177
- case 8:
179
+ case 3:
178
180
  case "end":
179
181
  return _context.stop();
180
182
  }
@@ -434,15 +436,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
434
436
  }, {
435
437
  key: "getRegisteredModuleNames",
436
438
  value: function getRegisteredModuleNames() {
437
- return ['scanOrderLogger', 'products', 'order', 'salesSummary', 'schedule'];
438
- }
439
- }, {
440
- key: "createSubModule",
441
- value: function createSubModule(moduleName) {
442
- if (moduleName === 'scanOrderLogger') {
443
- return createModule('scanOrderLogger', this.name);
444
- }
445
- return _get(_getPrototypeOf(ScanOrderImpl.prototype), "createSubModule", this).call(this, moduleName);
439
+ return ['products', 'order', 'salesSummary', 'schedule'];
446
440
  }
447
441
 
448
442
  /** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
@@ -455,10 +449,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
455
449
  key: "initialize",
456
450
  value: function () {
457
451
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(core) {
458
- var _options$otherParams, _this$otherParams, _this$otherParams2, _this$otherParams3;
452
+ var _options$otherParams, _this$otherParams4, _this$otherParams5;
459
453
  var options,
460
- _this$otherParams4,
461
- _this$otherParams5,
462
454
  _this$store$order,
463
455
  _this$store$order2,
464
456
  _args6 = arguments;
@@ -466,14 +458,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
466
458
  while (1) switch (_context6.prev = _context6.next) {
467
459
  case 0:
468
460
  options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
461
+ this.core = core;
462
+ this.otherParams = options.otherParams || {};
463
+ this.cacheId = this.otherParams.cacheId;
469
464
  this.logMethodStart('initialize');
470
465
  this.store = _objectSpread(_objectSpread({}, this.store), options.store);
471
466
  this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
472
467
  this.store.status = 'initializing';
473
468
  this.store.error = null;
474
- this.otherParams = options.otherParams || {};
475
- this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
476
- this.itemRuleRuntimeConfig = ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.scanOrderItemRule) || ((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.itemRule) || {};
469
+ this.itemRuleRuntimeConfig = ((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.scanOrderItemRule) || ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.itemRule) || {};
477
470
  this.itemRuleConfigs = [];
478
471
  this.itemRuleConfigsPromise = null;
479
472
  this.itemRulePrefillApplied = false;
@@ -482,19 +475,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
482
475
  passed: null,
483
476
  failures: []
484
477
  };
485
- _context6.next = 16;
478
+ _context6.next = 17;
486
479
  return _get(_getPrototypeOf(ScanOrderImpl.prototype), "initialize", this).call(this, core, options);
487
- case 16:
488
- if (this.store.scanOrderLogger) {
489
- this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.scanOrderLoggerProvider) || 'feishu');
490
- this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.scanOrderLoggerConfig) || {
491
- feishu: {
492
- webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed',
493
- errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f'
494
- }
495
- });
496
- this.store.scanOrderLogger.setContext(this.getScanOrderLoggerContext());
497
- }
480
+ case 17:
498
481
  this.registerCustomerLoginListeners();
499
482
  _context6.prev = 18;
500
483
  _context6.next = 21;
@@ -519,7 +502,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
519
502
  case 30:
520
503
  _context6.prev = 30;
521
504
  _context6.t0 = _context6["catch"](25);
522
- console.warn('[ScanOrder] loadAllSchedule 失败,operating_hours 判定将跳过', _context6.t0);
505
+ void this.addScanOrderLog({
506
+ level: 'warning',
507
+ title: '[ScanOrder] loadAllSchedule failed; operating_hours check skipped',
508
+ payload: {
509
+ method: 'loadAllSchedule',
510
+ error: this.serializeError(_context6.t0)
511
+ }
512
+ });
523
513
  case 33:
524
514
  _context6.next = 35;
525
515
  return this.refreshItemRuleQuantityLimits();
@@ -533,19 +523,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
533
523
  this.logMethodSuccess('initialize', {
534
524
  status: this.store.status
535
525
  });
536
- _context6.next = 48;
526
+ _context6.next = 47;
537
527
  break;
538
528
  case 41:
539
529
  _context6.prev = 41;
540
530
  _context6.t1 = _context6["catch"](18);
541
531
  this.store.status = 'error';
542
532
  this.store.error = _context6.t1 instanceof Error ? _context6.t1.message : '初始化失败';
543
- console.error('[ScanOrder] 初始化失败', _context6.t1);
544
533
  this.logMethodError('initialize', _context6.t1, {
545
534
  status: this.store.status
546
535
  });
547
536
  throw _context6.t1;
548
- case 48:
537
+ case 47:
549
538
  case "end":
550
539
  return _context6.stop();
551
540
  }
@@ -3244,9 +3233,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3244
3233
  }, {
3245
3234
  key: "readUIStateBucket",
3246
3235
  value: function readUIStateBucket() {
3247
- var _this$window;
3236
+ var _this$window2;
3248
3237
  var key = this.getUIStateBucketKey();
3249
- if (!key || !((_this$window = this.window) !== null && _this$window !== void 0 && _this$window.localStorage)) return {};
3238
+ if (!key || !((_this$window2 = this.window) !== null && _this$window2 !== void 0 && _this$window2.localStorage)) return {};
3250
3239
  try {
3251
3240
  var raw = this.window.localStorage.getItem(key) || '{}';
3252
3241
  var parsed = JSON.parse(raw);
@@ -3258,13 +3247,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3258
3247
  }, {
3259
3248
  key: "writeUIStateBucket",
3260
3249
  value: function writeUIStateBucket(bucket) {
3261
- var _this$window2;
3250
+ var _this$window3;
3262
3251
  var key = this.getUIStateBucketKey();
3263
- if (!key || !((_this$window2 = this.window) !== null && _this$window2 !== void 0 && _this$window2.localStorage)) return;
3252
+ if (!key || !((_this$window3 = this.window) !== null && _this$window3 !== void 0 && _this$window3.localStorage)) return;
3264
3253
  try {
3265
3254
  this.window.localStorage.setItem(key, JSON.stringify(bucket));
3266
3255
  } catch (error) {
3267
- console.warn('[ScanOrder] writeUIStateBucket failed', error);
3256
+ void this.addScanOrderLog({
3257
+ level: 'warning',
3258
+ title: '[ScanOrder] writeUIStateBucket failed',
3259
+ payload: {
3260
+ method: 'writeUIStateBucket',
3261
+ error: this.serializeError(error)
3262
+ }
3263
+ });
3268
3264
  }
3269
3265
  }
3270
3266
  }, {
@@ -3297,13 +3293,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3297
3293
  }, {
3298
3294
  key: "clearUIState",
3299
3295
  value: function clearUIState() {
3300
- var _this$window3;
3296
+ var _this$window4;
3301
3297
  var key = this.getUIStateBucketKey();
3302
- if (!key || !((_this$window3 = this.window) !== null && _this$window3 !== void 0 && _this$window3.localStorage)) return;
3298
+ if (!key || !((_this$window4 = this.window) !== null && _this$window4 !== void 0 && _this$window4.localStorage)) return;
3303
3299
  try {
3304
3300
  this.window.localStorage.removeItem(key);
3305
3301
  } catch (error) {
3306
- console.warn('[ScanOrder] clearUIState failed', error);
3302
+ void this.addScanOrderLog({
3303
+ level: 'warning',
3304
+ title: '[ScanOrder] clearUIState failed',
3305
+ payload: {
3306
+ method: 'clearUIState',
3307
+ error: this.serializeError(error)
3308
+ }
3309
+ });
3307
3310
  }
3308
3311
  }
3309
3312
  }, {
@@ -308,6 +308,7 @@ export interface ScanOrderState {
308
308
  products?: ProductList;
309
309
  order?: OrderModule;
310
310
  salesSummary?: SalesSummaryModule;
311
+ /** @deprecated Retained for compatibility; solution logs use app.getApp().logger. */
311
312
  scanOrderLogger?: ScanOrderLoggerModule;
312
313
  schedule?: ScheduleModule;
313
314
  itemRuleQuantityLimits: QuantityLimitResult[];
@@ -317,6 +318,7 @@ export interface ScanOrderState {
317
318
  };
318
319
  entryPaxNumber: number | null;
319
320
  }
321
+ /** @deprecated Configure the host app logger; ScanOrder no longer selects a provider. */
320
322
  export interface ScanOrderLoggerRuntimeConfig {
321
323
  provider?: ScanOrderLoggerProviderType;
322
324
  providerConfig?: ScanOrderLoggerProviderConfig;
@@ -31,4 +31,6 @@ export var ScanOrderHooks = /*#__PURE__*/function (ScanOrderHooks) {
31
31
 
32
32
  /** `/order/resource/occupy-detail` 单条 `occupy_details[i]` */
33
33
 
34
+ /** @deprecated Configure the host app logger; ScanOrder no longer selects a provider. */
35
+
34
36
  /** ScanOrder.scanCode 对外的轻量结果(不含 discountList,UI 在 resolve 后调 getDiscountList) */
@@ -97,6 +97,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
97
97
  private allergyItemRuleConfigs;
98
98
  private allergyItemRuleConfigsPromise;
99
99
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
100
+ private initializeUnifiedSalesRuntime;
100
101
  protected getSubmitOrderSalesChannel(): string;
101
102
  /** Only the explicit Kiosk Sales consumer entry enables this policy; POS stays unchanged. */
102
103
  protected isBusinessAvailabilityEnabled(): boolean;
@@ -127,6 +128,9 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
127
128
  private cloneAvailabilityPrepareParams;
128
129
  private getAvailabilityDurationCandidateAnchorAt;
129
130
  private createAvailabilityContextRef;
131
+ private getSolutionLogContext;
132
+ private writeSolutionLog;
133
+ private logSolutionFailure;
130
134
  private emitAvailabilityDiagnostic;
131
135
  private touchAvailabilityContext;
132
136
  private touchAvailabilityProjection;
@@ -289,6 +293,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
289
293
  stageRetailProducts(params: UnifiedBookingSalesStageRetailProductsParams): Promise<Record<string, any> | null>;
290
294
  /** Explicit capability: order-scoped Tickets extras use guarded writes without implicit SKU merging. */
291
295
  supportsVenueTicketExtras(): boolean;
296
+ /** The venue retail write path accepts per-line Holder relations for both templates. */
297
+ supportsVenueExtraHolders(): boolean;
292
298
  /**
293
299
  * Adds one retail line without replacing the cart's existing retail selection.
294
300
  * This is intentionally separate from stageRetailProducts(), whose contract is
@@ -327,11 +333,14 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
327
333
  private buildAvailabilityProjectionSnapshot;
328
334
  private getSharedPreparedAvailabilitySnapshot;
329
335
  private refreshAvailabilityContextProjection;
336
+ /** Read an existing customer selection without refreshing its clock or occupancy snapshot. */
337
+ private getCustomerSelectionProjection;
330
338
  private ensureAvailabilityContextProjection;
331
339
  private tryAcquireAvailabilityCommitLock;
332
340
  private releaseAvailabilityCommitLock;
333
341
  /** IO boundary: loads catalog, schedules, resources, occupancies, and registers one context. */
334
342
  prepareAvailabilityProjection(params: UnifiedBookingSalesPrepareAvailabilityProjectionParams): Promise<AvailabilityContextRef>;
343
+ private prepareAvailabilityContext;
335
344
  /** Candidate calculation over the current context projection and runtime minute. */
336
345
  getProductTimeRanges(contextId: string, request?: GetProductTimeRangesRequest): Promise<ContextualProductTimeRangeGroup[]>;
337
346
  /** Thin facade: auto-refresh on cart drift, then delegate to the pure projection query. */
@@ -342,7 +351,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
342
351
  private assertAvailabilityCommitWriteCAS;
343
352
  private findProductLineByUid;
344
353
  private findLinkedBooking;
345
- /** Revalidates against the latest landed occupancy cache, then mutates exactly one product line. */
354
+ /** Customer snapshot writes defer availability to checkout; other callers retain cache revalidation. */
346
355
  commitAvailabilitySelection(contextId: string, params: ContextualCommitAvailabilitySelectionParams): Promise<UnifiedBookingSalesCommitAvailabilitySelectionResult>;
356
+ private commitAvailabilitySelectionWithLock;
347
357
  }
348
358
  export declare const UnifiedBookingSales: typeof UnifiedBookingSalesImpl;