@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
@@ -145,6 +145,8 @@ export type ContextualAvailabilityQuery = Omit<Extract<AvailabilityQuery, {
145
145
  target: 'resource';
146
146
  }>, 'selectedRanges'> & {
147
147
  selectedRanges: ContextualProductTimeRange[];
148
+ /** PC/H5 only: retain the already-selected time while choosing resources in this snapshot. */
149
+ customerSelectionSnapshot?: boolean;
148
150
  });
149
151
  export type ContextualTimeAvailabilityItem = Omit<TimeAvailabilityItem, keyof ProductTimeRange> & ContextualProductTimeRange;
150
152
  export interface ContextualTimeAvailabilityGroup extends Omit<TimeAvailabilityGroup, 'times'> {
@@ -210,6 +212,8 @@ export interface UnifiedBookingSalesAddRetailProductParams {
210
212
  }
211
213
  export interface ContextualCommitAvailabilitySelectionParams {
212
214
  mode: 'add' | 'edit' | 'replace';
215
+ /** PC/H5 only: write the completed UI selection without re-querying availability; checkout is authoritative. */
216
+ customerSelectionSnapshot?: boolean;
213
217
  /** Local UI intent guard, checked again immediately before the Order mutation. */
214
218
  availabilityCommitGuard?: () => void;
215
219
  productLineUid?: string;
@@ -295,6 +299,7 @@ export interface UnifiedBookingSalesApi {
295
299
  loadProductsByScheduleDate: (params: UnifiedBookingSalesLoadProductsByScheduleDateParams) => Promise<unknown[]>;
296
300
  queryProducts: (params?: ProductListStoreQueryParams) => Promise<ProductData[]>;
297
301
  stageRetailProducts: (params: UnifiedBookingSalesStageRetailProductsParams) => Promise<Record<string, any> | null>;
302
+ supportsVenueExtraHolders: () => boolean;
298
303
  addRetailProduct: (params: UnifiedBookingSalesAddRetailProductParams) => Promise<Record<string, any>[]>;
299
304
  prepareAvailabilityProjection: (params: UnifiedBookingSalesPrepareAvailabilityProjectionParams) => Promise<AvailabilityContextRef>;
300
305
  getProductTimeRanges: (contextId: string, request?: GetProductTimeRangesRequest) => Promise<ContextualProductTimeRangeGroup[]>;
@@ -24,18 +24,24 @@ export function readVenueCatalogList(response, description) {
24
24
  throw venueCatalogError('VENUE_CATALOG_LOAD_FAILED', (response === null || response === void 0 ? void 0 : response.message) || "".concat(description, " could not be loaded."));
25
25
  }
26
26
  var total = (_ref = (_response$data$total = response.data.total) !== null && _response$data$total !== void 0 ? _response$data$total : response.data.total_count) !== null && _ref !== void 0 ? _ref : response.data.total_num;
27
- if (total != null && Number.isFinite(Number(total)) && Number(total) > list.length) {
27
+ if (total == null ? list.length >= 999 : !Number.isSafeInteger(Number(total)) || Number(total) < 0 || Number(total) > list.length) {
28
28
  throw venueCatalogError('VENUE_CATALOG_INCOMPLETE', "".concat(description, " is incomplete. A complete catalog response is required."));
29
29
  }
30
+ if (list.some(function (row) {
31
+ return !Number.isSafeInteger(Number(row === null || row === void 0 ? void 0 : row.form_record_id)) || Number(row.form_record_id) <= 0;
32
+ })) {
33
+ throw venueCatalogError('VENUE_CATALOG_INCOMPLETE', "".concat(description, " contains a record without a valid menu ID."));
34
+ }
30
35
  return list;
31
36
  }
32
37
  export function validateVenueMenus(records, ids) {
33
- return ids.map(function (id) {
38
+ return ids.flatMap(function (id) {
34
39
  var menu = records.find(function (row) {
35
40
  return Number(row.form_record_id) === id;
36
41
  });
37
- var config = menu === null || menu === void 0 ? void 0 : menu.partyroom_package;
38
- if (!menu || !['product_all', 'products', 'product_collection'].includes(config === null || config === void 0 ? void 0 : config.type) || !Array.isArray(menu.schedule) || menu.schedule.some(function (value) {
42
+ if (!menu || menu.deleted_at || menu.status && menu.status !== 'valid') return [];
43
+ var config = menu.partyroom_package;
44
+ if (!['product_all', 'products', 'product_collection'].includes(config === null || config === void 0 ? void 0 : config.type) || !Array.isArray(menu.schedule) || menu.schedule.some(function (value) {
39
45
  return !Number.isSafeInteger(Number(value)) || Number(value) <= 0;
40
46
  }) || config.type !== 'product_all' && (!Array.isArray(config.products) || config.products.some(function (row) {
41
47
  var value = Number(row === null || row === void 0 ? void 0 : row[config.type === 'products' ? 'product_id' : 'product_collection_id']);
@@ -43,7 +49,7 @@ export function validateVenueMenus(records, ids) {
43
49
  }))) {
44
50
  throw venueCatalogError('VENUE_MENU_INCOMPLETE', 'The configured menu is incomplete. Reload the booking page.');
45
51
  }
46
- return cloneDeep(menu);
52
+ return [cloneDeep(menu)];
47
53
  });
48
54
  }
49
55
 
@@ -34,6 +34,7 @@ import { BaseSalesImpl } from "../BaseSales";
34
34
  import { DEFAULT_SLOT_CONFIG, VenueBookingHooks } from "./types";
35
35
  import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, createEmptySummary, getProductIdentityIndex, getSafeProductNum, normalizeOrderProduct, normalizeItemRuleStrategies, toNonNegativeInt, toPriceString } from "./utils";
36
36
  import { createModule } from "../BookingByStep/types";
37
+ import { writeHostLog } from "../../utils/hostLogger";
37
38
  import { ProductList } from "../../modules/ProductList";
38
39
  import { DateModule } from "../../modules/Date";
39
40
  import { ScheduleModule } from "../../modules/Schedule";
@@ -121,10 +122,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
121
122
  _createClass(VenueBookingImpl, [{
122
123
  key: "getLoggerContext",
123
124
  value: function getLoggerContext() {
125
+ var _this$window, _this$otherParams, _this$otherParams2, _this$otherParams3;
124
126
  return {
125
127
  cacheId: this.cacheId,
126
128
  solutionName: this.name,
127
- moduleName: 'venueBooking'
129
+ moduleName: 'venueBooking',
130
+ 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,
131
+ platform: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform,
132
+ channel: (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel,
133
+ businessCode: (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode
128
134
  };
129
135
  }
130
136
  }, {
@@ -180,7 +186,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
180
186
  key: "addVenueBookingLog",
181
187
  value: function () {
182
188
  var _addVenueBookingLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
183
- var payload, extra, logger;
189
+ var _params$payload;
190
+ var payload, extra;
184
191
  return _regeneratorRuntime().wrap(function _callee$(_context) {
185
192
  while (1) switch (_context.prev = _context.next) {
186
193
  case 0:
@@ -188,25 +195,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
188
195
  cacheId: this.cacheId
189
196
  }, params.payload || {});
190
197
  extra = _objectSpread({}, params.extra || {});
191
- logger = this.store.scanOrderLogger;
192
- if (logger) {
193
- _context.next = 6;
194
- break;
195
- }
196
- if ((params.level || 'info') === 'error') {
197
- console.error('[VenueBooking][log-fallback]', params.title, {
198
+ writeHostLog(this.core, _objectSpread(_objectSpread({
199
+ type: params.level || 'info',
200
+ title: params.title
201
+ }, params.timestamp ? {
202
+ date: params.timestamp
203
+ } : {}), {}, {
204
+ metadata: {
205
+ module: 'venueBooking',
206
+ action: ((_params$payload = params.payload) === null || _params$payload === void 0 ? void 0 : _params$payload.method) || 'addLog',
198
207
  payload: payload,
199
- extra: extra
200
- });
201
- } else {}
202
- return _context.abrupt("return");
203
- case 6:
204
- _context.next = 8;
205
- return logger.addLog(_objectSpread(_objectSpread({}, params), {}, {
206
- payload: payload,
207
- extra: extra
208
+ extra: extra,
209
+ context: this.getLoggerContext()
210
+ }
208
211
  }));
209
- case 8:
212
+ case 3:
210
213
  case "end":
211
214
  return _context.stop();
212
215
  }
@@ -282,14 +285,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
282
285
  }, {
283
286
  key: "getRegisteredModuleNames",
284
287
  value: function getRegisteredModuleNames() {
285
- return ['scanOrderLogger', 'products', 'order', 'salesSummary', 'venueProducts', 'addonProducts', 'date', 'schedule', 'quotation', 'openData'];
288
+ return ['products', 'order', 'salesSummary', 'venueProducts', 'addonProducts', 'date', 'schedule', 'quotation', 'openData'];
286
289
  }
287
290
  }, {
288
291
  key: "createSubModule",
289
292
  value: function createSubModule(moduleName) {
290
293
  switch (moduleName) {
291
- case 'scanOrderLogger':
292
- return createModule('scanOrderLogger', this.name);
293
294
  case 'venueProducts':
294
295
  return new ProductList("".concat(this.name, "_venueProducts"));
295
296
  case 'addonProducts':
@@ -371,12 +372,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
371
372
  }, {
372
373
  key: "resolveHolderCustomerId",
373
374
  value: function resolveHolderCustomerId() {
374
- var _this$window, _this$window$getLocal;
375
+ var _this$window2, _this$window2$getLoca;
375
376
  if (this.smartPricingCustomerId !== undefined) {
376
377
  var _this$smartPricingCus;
377
378
  return (_this$smartPricingCus = this.smartPricingCustomerId) !== null && _this$smartPricingCus !== void 0 ? _this$smartPricingCus : undefined;
378
379
  }
379
- var customer = JSON.parse(((_this$window = this.window) === null || _this$window === void 0 || (_this$window$getLocal = _this$window.getLocalStorage) === null || _this$window$getLocal === void 0 ? void 0 : _this$window$getLocal.call(_this$window, 'customer')) || '{}');
380
+ var customer = JSON.parse(((_this$window2 = this.window) === null || _this$window2 === void 0 || (_this$window2$getLoca = _this$window2.getLocalStorage) === null || _this$window2$getLoca === void 0 ? void 0 : _this$window2$getLoca.call(_this$window2, 'customer')) || '{}');
380
381
  if (customer !== null && customer !== void 0 && customer.id) return Number(customer.id);
381
382
  return undefined;
382
383
  }
@@ -438,9 +439,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
438
439
  case 20:
439
440
  _context3.prev = 20;
440
441
  _context3.t0 = _context3["catch"](15);
441
- console.error('[VenueBooking] 预加载 holder 表单失败', {
442
- formId: formId,
443
- error: _context3.t0
442
+ this.logMethodError('preloadHolderForms', _context3.t0, {
443
+ formId: formId
444
444
  });
445
445
  case 23:
446
446
  _context3.next = 6;
@@ -674,9 +674,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
674
674
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(core) {
675
675
  var _options$otherParams,
676
676
  _options$otherParams2,
677
- _this$otherParams,
678
- _this$otherParams2,
679
- _this$otherParams3,
677
+ _this$otherParams4,
678
+ _this$otherParams5,
680
679
  _this4 = this,
681
680
  _this$otherParams6,
682
681
  _this$otherParams7,
@@ -684,8 +683,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
684
683
  _this$otherParams9,
685
684
  _this$otherParams10;
686
685
  var options,
687
- _this$otherParams4,
688
- _this$otherParams5,
689
686
  baseModules,
690
687
  venueProductsModule,
691
688
  addonProductsModule,
@@ -706,6 +703,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
706
703
  while (1) switch (_context7.prev = _context7.next) {
707
704
  case 0:
708
705
  options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
706
+ this.core = core;
707
+ this.otherParams = options.otherParams || {};
708
+ this.cacheId = this.otherParams.cacheId;
709
709
  this.logMethodStart('initialize');
710
710
  this.store = _objectSpread(_objectSpread({}, this.store), options.store);
711
711
  this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
@@ -720,9 +720,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
720
720
  this.slotPriceMapCache.clear();
721
721
  this.baseSlotConfig = _objectSpread(_objectSpread({}, DEFAULT_SLOT_CONFIG), ((_options$otherParams2 = options.otherParams) === null || _options$otherParams2 === void 0 ? void 0 : _options$otherParams2.slotConfig) || {});
722
722
  this.store.slotConfig = _objectSpread({}, this.baseSlotConfig);
723
- this.otherParams = options.otherParams || {};
724
- this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
725
- this.itemRuleRuntimeConfig = ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.venueBookingItemRule) || ((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.itemRule) || {};
723
+ this.itemRuleRuntimeConfig = ((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.venueBookingItemRule) || ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.itemRule) || {};
726
724
  this.itemRuleConfigs = [];
727
725
  this.itemRuleConfigsPromise = null;
728
726
  this.itemRulePrefillApplied = false;
@@ -731,46 +729,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
731
729
  passed: null,
732
730
  failures: []
733
731
  };
734
- _context7.next = 25;
732
+ _context7.next = 26;
735
733
  return _get(_getPrototypeOf(VenueBookingImpl.prototype), "initialize", this).call(this, core, options);
736
- case 25:
737
- if (this.store.scanOrderLogger) {
738
- this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.loggerProvider) || 'feishu');
739
- this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.loggerConfig) || {
740
- feishu: {
741
- webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
742
- errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d'
743
- }
744
- });
745
- this.store.scanOrderLogger.setContext(this.getLoggerContext());
746
- }
747
- // 注册基础模块(order, salesSummary, products, logger)
748
- baseModules = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
734
+ case 26:
735
+ // 注册基础业务模块;日志统一使用 app 插件提供的宿主 logger。
736
+ baseModules = ['products', 'order', 'salesSummary'];
749
737
  baseModules.forEach(function (step) {
750
738
  var targetModule = createModule(step, _this4.name);
751
739
  if (targetModule) {
752
- var _this4$store$order, _this4$otherParams, _this4$otherParams2, _this4$otherParams3, _this4$otherParams4;
740
+ var _this4$store$order, _this4$otherParams, _this4$otherParams2;
753
741
  _this4.store[step] = targetModule;
754
742
  var initialState = step === 'salesSummary' ? {
755
743
  summary: ((_this4$store$order = _this4.store.order) === null || _this4$store$order === void 0 || (_this4$store$order = _this4$store$order.getTempOrder()) === null || _this4$store$order === void 0 ? void 0 : _this4$store$order.summary) || createEmptySummary()
756
744
  } : {};
757
- var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.loggerProvider) || 'feishu';
758
- var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.loggerConfig) || {
759
- // feishu: {
760
- // webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
761
- // errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d',
762
- // },
763
- };
764
745
  _this4.core.registerModule(targetModule, {
765
746
  initialState: initialState,
766
747
  otherParams: _objectSpread(_objectSpread({}, _this4.otherParams), {}, {
767
748
  fatherModule: _this4.name,
768
- openCache: (_this4$otherParams3 = _this4.otherParams) !== null && _this4$otherParams3 !== void 0 && _this4$otherParams3.cacheId ? true : false,
769
- cacheId: (_this4$otherParams4 = _this4.otherParams) === null || _this4$otherParams4 === void 0 ? void 0 : _this4$otherParams4.cacheId,
770
- salesSummaryModuleName: "".concat(_this4.name, "_salesSummary"),
771
- provider: loggerProvider,
772
- providerConfig: loggerConfig,
773
- context: _this4.getLoggerContext()
749
+ openCache: (_this4$otherParams = _this4.otherParams) !== null && _this4$otherParams !== void 0 && _this4$otherParams.cacheId ? true : false,
750
+ cacheId: (_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.cacheId,
751
+ salesSummaryModuleName: "".concat(_this4.name, "_salesSummary")
774
752
  })
775
753
  });
776
754
  } else {
@@ -891,19 +869,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
891
869
  this.logMethodSuccess('initialize', {
892
870
  status: this.store.status
893
871
  });
894
- _context7.next = 77;
872
+ _context7.next = 76;
895
873
  break;
896
874
  case 70:
897
875
  _context7.prev = 70;
898
876
  _context7.t0 = _context7["catch"](51);
899
877
  this.store.status = 'error';
900
878
  this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
901
- console.error('[VenueBooking] 初始化失败', _context7.t0);
902
879
  this.logMethodError('initialize', _context7.t0, {
903
880
  status: this.store.status
904
881
  });
905
882
  throw _context7.t0;
906
- case 77:
883
+ case 76:
907
884
  case "end":
908
885
  return _context7.stop();
909
886
  }
@@ -1061,13 +1038,43 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1061
1038
  }, {
1062
1039
  key: "buildSmartPricingContext",
1063
1040
  value: function buildSmartPricingContext() {
1064
- var _this$otherParams12, _this$store$order3, _this$store$order3$ge, _ref5, _ref6, _this$otherParams$ava, _this$otherParams13, _this$otherParams14, _this$core3, _this$store$schedule, _this$store$schedule$, _this$otherParams15, _this$otherParams16, _this$core4, _this$otherParams$cha, _this$otherParams17, _ref7, _this$otherParams$bus, _this$otherParams18, _this$otherParams19, _this$otherParams20;
1041
+ var _this$otherParams12,
1042
+ _this$store$order3,
1043
+ _this$store$order3$ge,
1044
+ _ref5,
1045
+ _ref6,
1046
+ _this$otherParams$ava,
1047
+ _this$otherParams13,
1048
+ _this$otherParams14,
1049
+ _this$core3,
1050
+ _this5 = this,
1051
+ _this$store$schedule,
1052
+ _this$store$schedule$,
1053
+ _this$otherParams15,
1054
+ _this$otherParams16,
1055
+ _this$core4,
1056
+ _this$otherParams$cha,
1057
+ _this$otherParams17,
1058
+ _ref7,
1059
+ _this$otherParams$bus,
1060
+ _this$otherParams18,
1061
+ _this$otherParams19,
1062
+ _this$otherParams20;
1065
1063
  var strategyContext = ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.strategy_context) || {};
1066
1064
  var orderWalletIds = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getAvailableWalletIds) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
1067
1065
  var fallbackWalletIds = (_ref5 = (_ref6 = (_this$otherParams$ava = (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.available_wallet_ids) !== null && _this$otherParams$ava !== void 0 ? _this$otherParams$ava : (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.availableWalletIds) !== null && _ref6 !== void 0 ? _ref6 : strategyContext.available_wallet_ids) !== null && _ref5 !== void 0 ? _ref5 : strategyContext.availableWalletIds;
1068
1066
  var walletIds = this.smartPricingCustomerId === null ? [] : orderWalletIds !== null && orderWalletIds !== void 0 && orderWalletIds.length ? orderWalletIds : fallbackWalletIds;
1069
1067
  return {
1070
1068
  evaluator: (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.dataVariantEvaluator,
1069
+ reportWarning: function reportWarning(title) {
1070
+ void _this5.addVenueBookingLog({
1071
+ level: 'warning',
1072
+ title: title,
1073
+ payload: {
1074
+ method: 'smartPricing'
1075
+ }
1076
+ });
1077
+ },
1071
1078
  scheduleList: ((_this$store$schedule = this.store.schedule) === null || _this$store$schedule === void 0 || (_this$store$schedule$ = _this$store$schedule.getScheduleList) === null || _this$store$schedule$ === void 0 ? void 0 : _this$store$schedule$.call(_this$store$schedule)) || [],
1072
1079
  menuList: ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.menuList) || ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 || (_this$otherParams16 = _this$otherParams16.openData) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.menuList) || ((_this$core4 = this.core) === null || _this$core4 === void 0 || (_this$core4 = _this$core4.context) === null || _this$core4 === void 0 ? void 0 : _this$core4.menuList) || [],
1073
1080
  customerId: this.resolveCustomerIdForSmartPricing(),
@@ -1175,7 +1182,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1175
1182
  key: "loadAllProducts",
1176
1183
  value: function () {
1177
1184
  var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1178
- var _this5 = this;
1185
+ var _this6 = this;
1179
1186
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1180
1187
  while (1) switch (_context12.prev = _context12.next) {
1181
1188
  case 0:
@@ -1186,7 +1193,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1186
1193
  return _context12.abrupt("return", this.loadAllProductsInFlight);
1187
1194
  case 2:
1188
1195
  this.loadAllProductsInFlight = this._doLoadAllProducts().finally(function () {
1189
- _this5.loadAllProductsInFlight = null;
1196
+ _this6.loadAllProductsInFlight = null;
1190
1197
  });
1191
1198
  return _context12.abrupt("return", this.loadAllProductsInFlight);
1192
1199
  case 4:
@@ -1204,7 +1211,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1204
1211
  key: "_doLoadAllProducts",
1205
1212
  value: function () {
1206
1213
  var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1207
- var _this6 = this;
1214
+ var _this7 = this;
1208
1215
  var _this$otherParams21, _this$store$venueProd2, associatedMenus, menuListIds, pricingContext, allProducts, loadedList, rawProducts, list, venueList, addonList, venueStore, _this$store$order4, _this$store$order4$ge, products;
1209
1216
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1210
1217
  while (1) switch (_context14.prev = _context14.next) {
@@ -1270,7 +1277,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1270
1277
  _context14.next = 25;
1271
1278
  return Promise.all(loadedList.map( /*#__PURE__*/function () {
1272
1279
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(product) {
1273
- var _ref9, _rawProducts$get, _this6$core$server, _this6$core$server$ge;
1280
+ var _ref9, _rawProducts$get, _this7$core$server, _this7$core$server$ge;
1274
1281
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1275
1282
  while (1) switch (_context13.prev = _context13.next) {
1276
1283
  case 0:
@@ -1283,7 +1290,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1283
1290
  break;
1284
1291
  case 4:
1285
1292
  _context13.next = 6;
1286
- return (_this6$core$server = _this6.core.server) === null || _this6$core$server === void 0 || (_this6$core$server$ge = _this6$core$server.getProducts) === null || _this6$core$server$ge === void 0 || (_this6$core$server$ge = _this6$core$server$ge.call(_this6$core$server)) === null || _this6$core$server$ge === void 0 ? void 0 : _this6$core$server$ge.getProductById(product.id);
1293
+ return (_this7$core$server = _this7.core.server) === null || _this7$core$server === void 0 || (_this7$core$server$ge = _this7$core$server.getProducts) === null || _this7$core$server$ge === void 0 || (_this7$core$server$ge = _this7$core$server$ge.call(_this7$core$server)) === null || _this7$core$server$ge === void 0 ? void 0 : _this7$core$server$ge.getProductById(product.id);
1287
1294
  case 6:
1288
1295
  _context13.t1 = _context13.sent;
1289
1296
  case 7:
@@ -1470,9 +1477,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1470
1477
  }, {
1471
1478
  key: "preloadQuotations",
1472
1479
  value: function preloadQuotations(params) {
1473
- var _this7 = this;
1480
+ var _this8 = this;
1474
1481
  void this.ensureQuotationsLoaded(params).catch(function (error) {
1475
- _this7.logMethodError('preloadQuotations', error, {
1482
+ _this8.logMethodError('preloadQuotations', error, {
1476
1483
  channel: params === null || params === void 0 ? void 0 : params.channel
1477
1484
  });
1478
1485
  });
@@ -1720,7 +1727,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1720
1727
  }, {
1721
1728
  key: "getDateRangeSummary",
1722
1729
  value: function getDateRangeSummary(params) {
1723
- var _this8 = this;
1730
+ var _this9 = this;
1724
1731
  return buildDateRangeSummary({
1725
1732
  startDate: params.startDate,
1726
1733
  endDate: params.endDate,
@@ -1728,10 +1735,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1728
1735
  rawResources: this.store.rawResourceData,
1729
1736
  resourceProductMap: this.resourceProductMap,
1730
1737
  resolveConfig: function resolveConfig(date) {
1731
- return _this8.resolveSlotConfigForDate(date);
1738
+ return _this9.resolveSlotConfigForDate(date);
1732
1739
  },
1733
1740
  buildSlotPriceMap: function buildSlotPriceMap(date, config, productIds) {
1734
- return _this8.buildSlotPriceMapForDate(date, config, productIds);
1741
+ return _this9.buildSlotPriceMapForDate(date, config, productIds);
1735
1742
  }
1736
1743
  });
1737
1744
  }
@@ -1915,7 +1922,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1915
1922
  }, {
1916
1923
  key: "isSlotDisabledBySelection",
1917
1924
  value: function isSlotDisabledBySelection(params) {
1918
- var _this9 = this;
1925
+ var _this10 = this;
1919
1926
  var resourceId = params.resourceId,
1920
1927
  productId = params.productId,
1921
1928
  startTime = params.startTime;
@@ -1937,7 +1944,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1937
1944
 
1938
1945
  // 组合资源字段缓存
1939
1946
  var getCombinedChildIds = function getCombinedChildIds(resId) {
1940
- var raw = _this9.store.rawResourceData.find(function (r) {
1947
+ var raw = _this10.store.rawResourceData.find(function (r) {
1941
1948
  return String(r.resourceId) === String(resId);
1942
1949
  });
1943
1950
  var combined = raw === null || raw === void 0 ? void 0 : raw.combined_resource;
@@ -2276,7 +2283,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2276
2283
  }, {
2277
2284
  key: "getCombinedChildRawResources",
2278
2285
  value: function getCombinedChildRawResources(rawResource) {
2279
- var _this10 = this;
2286
+ var _this11 = this;
2280
2287
  if (!rawResource) return undefined;
2281
2288
  var combined = rawResource.combined_resource;
2282
2289
  if (!combined || combined.status !== 1 || !Array.isArray(combined.resource_ids) || !combined.resource_ids.length) {
@@ -2288,7 +2295,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2288
2295
  try {
2289
2296
  var _loop3 = function _loop3() {
2290
2297
  var id = _step12.value;
2291
- var child = _this10.store.rawResourceData.find(function (r) {
2298
+ var child = _this11.store.rawResourceData.find(function (r) {
2292
2299
  return String(r.resourceId) === String(id);
2293
2300
  });
2294
2301
  if (child) children.push(child);
@@ -2364,10 +2371,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2364
2371
  }, {
2365
2372
  key: "injectScheduleResolverToQuotation",
2366
2373
  value: function injectScheduleResolverToQuotation() {
2367
- var _this11 = this;
2374
+ var _this12 = this;
2368
2375
  if (this.store.quotation && this.store.schedule) {
2369
2376
  this.store.quotation.setScheduleResolver(function (id) {
2370
- return _this11.store.schedule.getScheduleListByIds([id])[0];
2377
+ return _this12.store.schedule.getScheduleListByIds([id])[0];
2371
2378
  });
2372
2379
  }
2373
2380
  }
@@ -2468,7 +2475,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2468
2475
  key: "recalculateOrderPricesFromSmartPricing",
2469
2476
  value: function recalculateOrderPricesFromSmartPricing() {
2470
2477
  var _tempOrder$products,
2471
- _this12 = this;
2478
+ _this13 = this;
2472
2479
  if (!this.store.order) return;
2473
2480
  var tempOrder = this.store.order.getTempOrder();
2474
2481
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
@@ -2480,22 +2487,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2480
2487
  var _product$metadata2;
2481
2488
  var product = _step13.value;
2482
2489
  if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
2483
- var mappings = _this12.resourceProductMap.get(product.metadata.resource_id);
2490
+ var mappings = _this13.resourceProductMap.get(product.metadata.resource_id);
2484
2491
  if (!mappings || !mappings.length) return 0; // continue
2485
2492
  var mapping = mappings.find(function (m) {
2486
2493
  return Number(m.productId) === Number(product.product_id);
2487
2494
  }) || mappings[0];
2488
2495
  if (!mapping) return 0; // continue
2489
- var slots = expandMergedSlotToIndividual(product, _this12.store.slotConfig.slotDurationMinutes);
2496
+ var slots = expandMergedSlotToIndividual(product, _this13.store.slotConfig.slotDurationMinutes);
2490
2497
  var updatedSlots = slots.map(function (slot) {
2491
2498
  var slotStart = dayjs(slot.startTime);
2492
2499
  var date = slotStart.format('YYYY-MM-DD');
2493
2500
  var previousDate = slotStart.subtract(1, 'day').format('YYYY-MM-DD');
2494
- var previousConfig = _this12.resolveSlotConfigForDate(previousDate);
2501
+ var previousConfig = _this13.resolveSlotConfigForDate(previousDate);
2495
2502
  if (isBusinessHoursCrossDay(previousConfig) && slotStart.format('HH:mm') < previousConfig.businessStartTime) {
2496
2503
  date = previousDate;
2497
2504
  }
2498
- var slotPriceMap = _this12.buildSlotPriceMapForDate(date, _this12.resolveSlotConfigForDate(date), [mapping.productId]);
2505
+ var slotPriceMap = _this13.buildSlotPriceMapForDate(date, _this13.resolveSlotConfigForDate(date), [mapping.productId]);
2499
2506
  return _objectSpread(_objectSpread({}, slot), {}, {
2500
2507
  productId: mapping.productId,
2501
2508
  price: getSlotPriceFromMap({
@@ -2508,7 +2515,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2508
2515
  });
2509
2516
  var merged = mergeConsecutiveSlots(updatedSlots);
2510
2517
  if (merged.length === 1) {
2511
- _this12.resetProductPriceForSmartPricing(product, merged[0].totalPrice);
2518
+ _this13.resetProductPriceForSmartPricing(product, merged[0].totalPrice);
2512
2519
  product.metadata.price_breakdown = buildPriceBreakdown({
2513
2520
  group: merged[0],
2514
2521
  productId: mapping.productId
@@ -2517,14 +2524,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2517
2524
  } else if (product.product_id != null) {
2518
2525
  var _product$product_vari, _product$metadata$sou, _product$metadata3;
2519
2526
  var price = getPriceForProductAtDatetime({
2520
- products: _this12.smartPricingProductCatalog,
2521
- context: _this12.buildSmartPricingContext(),
2527
+ products: _this13.smartPricingProductCatalog,
2528
+ context: _this13.buildSmartPricingContext(),
2522
2529
  productId: product.product_id,
2523
2530
  variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
2524
2531
  datetime: now,
2525
2532
  fallbackPrice: (_product$metadata$sou = (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : product.original_price
2526
2533
  });
2527
- _this12.resetProductPriceForSmartPricing(product, price);
2534
+ _this13.resetProductPriceForSmartPricing(product, price);
2528
2535
  }
2529
2536
  },
2530
2537
  _ret;
@@ -3426,7 +3433,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3426
3433
  key: "ensureItemRuleConfigsLoaded",
3427
3434
  value: function () {
3428
3435
  var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3429
- var _this13 = this;
3436
+ var _this14 = this;
3430
3437
  return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3431
3438
  while (1) switch (_context39.prev = _context39.next) {
3432
3439
  case 0:
@@ -3447,19 +3454,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3447
3454
  return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3448
3455
  while (1) switch (_context38.prev = _context38.next) {
3449
3456
  case 0:
3450
- runtimeConfig = _this13.getItemRuleRuntimeConfig();
3457
+ runtimeConfig = _this14.getItemRuleRuntimeConfig();
3451
3458
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
3452
3459
  if (!(staticConfigs.length > 0)) {
3453
3460
  _context38.next = 6;
3454
3461
  break;
3455
3462
  }
3456
- _this13.itemRuleConfigs = staticConfigs;
3457
- _this13.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3458
- return _context38.abrupt("return", _this13.itemRuleConfigs);
3463
+ _this14.itemRuleConfigs = staticConfigs;
3464
+ _this14.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3465
+ return _context38.abrupt("return", _this14.itemRuleConfigs);
3459
3466
  case 6:
3460
- _this13.itemRuleConfigs = [];
3461
- _this13.itemRuleEvaluator.setStrategyConfigs([]);
3462
- return _context38.abrupt("return", _this13.itemRuleConfigs);
3467
+ _this14.itemRuleConfigs = [];
3468
+ _this14.itemRuleEvaluator.setStrategyConfigs([]);
3469
+ return _context38.abrupt("return", _this14.itemRuleConfigs);
3463
3470
  case 9:
3464
3471
  case "end":
3465
3472
  return _context38.stop();
@@ -3920,9 +3927,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3920
3927
  }, {
3921
3928
  key: "readUIStateBucket",
3922
3929
  value: function readUIStateBucket() {
3923
- var _this$window2;
3930
+ var _this$window3;
3924
3931
  var key = this.getUIStateBucketKey();
3925
- if (!key || !((_this$window2 = this.window) !== null && _this$window2 !== void 0 && _this$window2.sessionStorage)) return {};
3932
+ if (!key || !((_this$window3 = this.window) !== null && _this$window3 !== void 0 && _this$window3.sessionStorage)) return {};
3926
3933
  try {
3927
3934
  var raw = this.window.sessionStorage.getItem(key) || '{}';
3928
3935
  var parsed = JSON.parse(raw);
@@ -3934,9 +3941,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3934
3941
  }, {
3935
3942
  key: "writeUIStateBucket",
3936
3943
  value: function writeUIStateBucket(bucket) {
3937
- var _this$window3;
3944
+ var _this$window4;
3938
3945
  var key = this.getUIStateBucketKey();
3939
- if (!key || !((_this$window3 = this.window) !== null && _this$window3 !== void 0 && _this$window3.sessionStorage)) return;
3946
+ if (!key || !((_this$window4 = this.window) !== null && _this$window4 !== void 0 && _this$window4.sessionStorage)) return;
3940
3947
  this.window.sessionStorage.setItem(key, JSON.stringify(bucket));
3941
3948
  }
3942
3949
  }, {
@@ -133,6 +133,7 @@ export interface VenueBookingState {
133
133
  products?: ProductList;
134
134
  order?: OrderModule;
135
135
  salesSummary?: SalesSummaryModule;
136
+ /** @deprecated Retained for compatibility; solution logs use app.getApp().logger. */
136
137
  scanOrderLogger?: ScanOrderLoggerModule;
137
138
  venueProducts?: ProductList;
138
139
  addonProducts?: ProductList;
@@ -149,6 +150,7 @@ export interface VenueBookingState {
149
150
  };
150
151
  holder?: HolderModule;
151
152
  }
153
+ /** @deprecated Configure the host app logger; VenueBooking no longer selects a provider. */
152
154
  export interface VenueBookingLoggerRuntimeConfig {
153
155
  provider?: ScanOrderLoggerProviderType;
154
156
  providerConfig?: ScanOrderLoggerProviderConfig;
@@ -19,4 +19,6 @@ export var DEFAULT_SLOT_CONFIG = {
19
19
 
20
20
  // ─── 时段选择 & 合并 ───
21
21
 
22
- // ─── Store 状态 ───
22
+ // ─── Store 状态 ───
23
+
24
+ /** @deprecated Configure the host app logger; VenueBooking no longer selects a provider. */
@@ -16,6 +16,7 @@ export interface VenueBookingSmartPricingContext {
16
16
  orderType?: string;
17
17
  strategy_context?: Record<string, any>;
18
18
  strategyConfigs?: StrategyConfig[];
19
+ reportWarning?: (message: string) => void;
19
20
  }
20
21
  /** 从商品上读取展示/算价用的 price 字段 */
21
22
  export declare function extractProductPrice(product: DataVariantProduct): string | null;
@@ -46,7 +46,12 @@ export function buildDataVariantBusinessData(products, context, scheduleDateTime
46
46
  export function formatProductsWithDataVariant(products, context, scheduleDateTime) {
47
47
  var evaluator = context.evaluator;
48
48
  if (!evaluator || typeof evaluator.resolveProducts !== 'function') {
49
- console.warn('[VenueBooking][smartPricing] dataVariantEvaluator 未注入,跳过智能定价格式化');
49
+ var _message = '[VenueBooking][smartPricing] dataVariantEvaluator 未注入,跳过智能定价格式化';
50
+ try {
51
+ if (context.reportWarning) context.reportWarning(_message);else console.warn(_message);
52
+ } catch (_unused) {
53
+ console.warn(_message);
54
+ }
50
55
  return products;
51
56
  }
52
57