@pisell/pisellos 0.10.73 → 0.10.75

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.
@@ -1,6 +1,8 @@
1
1
  var _excluded = ["product_ids"],
2
- _excluded2 = ["product_id", "product_ids"],
3
- _excluded3 = ["date", "custom_page_id", "channel", "product_ids"];
2
+ _excluded2 = ["openData"],
3
+ _excluded3 = ["openData"],
4
+ _excluded4 = ["product_id", "product_ids"],
5
+ _excluded5 = ["date", "custom_page_id", "channel", "product_ids"];
4
6
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
5
7
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
8
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -48,6 +50,7 @@ import { AvailabilityError, createAvailabilityProjection, getProductTimeRanges a
48
50
  import { UnifiedBookingSalesHooks } from "./types";
49
51
  import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
50
52
  import { BusinessAvailabilityController } from "./businessAvailability";
53
+ import { createCatalogQueryBatchAdapter } from "./catalogQueryBatch";
51
54
  import { BookingTicket } from "../BookingTicket";
52
55
  import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
53
56
  import { isCustomerUserPlatform, isSelfServicePlatform, normalizeRuntimePlatform } from "../../utils/platform";
@@ -1331,6 +1334,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1331
1334
  _defineProperty(_assertThisInitialized(_this), "runtimeOpenDataModule", null);
1332
1335
  _defineProperty(_assertThisInitialized(_this), "runtimeOpenDataCore", void 0);
1333
1336
  _defineProperty(_assertThisInitialized(_this), "runtimeOpenDataGeneration", 0);
1337
+ _defineProperty(_assertThisInitialized(_this), "runtimeInitializationGeneration", 0);
1334
1338
  _defineProperty(_assertThisInitialized(_this), "runtimeOpenDataDestroyed", false);
1335
1339
  _defineProperty(_assertThisInitialized(_this), "unifiedProductCatalog", []);
1336
1340
  _defineProperty(_assertThisInitialized(_this), "availabilityRuntimeOffsetMinutes", null);
@@ -1357,30 +1361,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1357
1361
  value: function () {
1358
1362
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core) {
1359
1363
  var options,
1360
- openDataGeneration,
1364
+ initializationGeneration,
1365
+ initialization,
1366
+ scope,
1367
+ openDataModule,
1361
1368
  _args = arguments;
1362
1369
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1363
1370
  while (1) switch (_context.prev = _context.next) {
1364
1371
  case 0:
1365
1372
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
1373
+ initializationGeneration = ++this.runtimeInitializationGeneration;
1366
1374
  this.resetRuntimeOpenData();
1367
1375
  this.runtimeOpenDataDestroyed = false;
1368
- openDataGeneration = this.runtimeOpenDataGeneration;
1369
1376
  this.availabilityScheduleCatalog = null;
1370
1377
  this.availabilityRuntimeOffsetMinutes = captureRuntimeOffsetMinutes();
1371
1378
  this.clearAvailabilityRemoteResourceState();
1372
1379
  this.resetAllergyItemRuleState();
1373
- _context.next = 10;
1374
- return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "initialize", this).call(this, core, options);
1375
- case 10:
1376
- if (!(this.runtimeOpenDataDestroyed || openDataGeneration !== this.runtimeOpenDataGeneration)) {
1377
- _context.next = 12;
1380
+ // BaseSales synchronously installs this runtime before its first await. Cache
1381
+ // refreshes during that await are valid; they are not a new initialization.
1382
+ initialization = _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "initialize", this).call(this, core, options);
1383
+ scope = this.getRuntimeOpenDataScope();
1384
+ openDataModule = this.store.openData;
1385
+ _context.next = 13;
1386
+ return initialization;
1387
+ case 13:
1388
+ if (!(this.runtimeOpenDataDestroyed || initializationGeneration !== this.runtimeInitializationGeneration)) {
1389
+ _context.next = 15;
1390
+ break;
1391
+ }
1392
+ return _context.abrupt("return");
1393
+ case 15:
1394
+ if (!(core !== this.core || openDataModule !== this.store.openData || scope !== this.getRuntimeOpenDataScope())) {
1395
+ _context.next = 17;
1378
1396
  break;
1379
1397
  }
1380
1398
  throw new Error('Store settings changed. Please try again.');
1381
- case 12:
1399
+ case 17:
1382
1400
  this.captureAvailabilityScheduleCatalog();
1383
- case 13:
1401
+ case 18:
1384
1402
  case "end":
1385
1403
  return _context.stop();
1386
1404
  }
@@ -1555,7 +1573,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1555
1573
  key: "resolveAvailabilityPrepareDefaults",
1556
1574
  value: function () {
1557
1575
  var _resolveAvailabilityPrepareDefaults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
1558
- var _ref30, _this$otherParams$bus, _this$otherParams5, _this$otherParams6, _this$otherParams$cha2, _this$otherParams7, _this$otherParams8, _openData, _openData2, _openData3;
1576
+ var _ref30, _this$otherParams$bus, _this$otherParams5, _this$otherParams6, _this$otherParams$cha2, _this$otherParams7, _this$otherParams8, _openData2, _openData3, _openData4;
1559
1577
  var needsOperatingHours, needsTimeSlice, businessCode, channel, currentTarget, openData, operatingScheduleIds, configuredTimeSlice;
1560
1578
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1561
1579
  while (1) switch (_context2.prev = _context2.next) {
@@ -1603,8 +1621,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1603
1621
  case 19:
1604
1622
  console.warn('[UnifiedBookingSales] OpenData 时间切片配置加载失败,回退为默认值', _context2.t0);
1605
1623
  case 20:
1606
- operatingScheduleIds = this.normalizeAvailabilityIdList(Array.isArray((_openData = openData) === null || _openData === void 0 ? void 0 : _openData['availability.operating_hours']) ? (_openData2 = openData) === null || _openData2 === void 0 ? void 0 : _openData2['availability.operating_hours'] : undefined) || [];
1607
- configuredTimeSlice = needsTimeSlice ? normalizePositiveInteger((_openData3 = openData) === null || _openData3 === void 0 ? void 0 : _openData3['reservation.time_slice']) : undefined;
1624
+ operatingScheduleIds = this.normalizeAvailabilityIdList(Array.isArray((_openData2 = openData) === null || _openData2 === void 0 ? void 0 : _openData2['availability.operating_hours']) ? (_openData3 = openData) === null || _openData3 === void 0 ? void 0 : _openData3['availability.operating_hours'] : undefined) || [];
1625
+ configuredTimeSlice = needsTimeSlice ? normalizePositiveInteger((_openData4 = openData) === null || _openData4 === void 0 ? void 0 : _openData4['reservation.time_slice']) : undefined;
1608
1626
  return _context2.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, params), configuredTimeSlice ? {
1609
1627
  slotStepMinutes: configuredTimeSlice
1610
1628
  } : {}), {}, {
@@ -1737,17 +1755,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1737
1755
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1738
1756
  while (1) switch (_context4.prev = _context4.next) {
1739
1757
  case 0:
1758
+ this.runtimeInitializationGeneration += 1;
1740
1759
  this.runtimeOpenDataDestroyed = true;
1741
1760
  this.clearOpenDataCache();
1742
1761
  this.availabilityScheduleCatalog = null;
1743
1762
  this.availabilityRuntimeOffsetMinutes = null;
1744
- _context4.next = 6;
1763
+ _context4.next = 7;
1745
1764
  return this.resetAvailabilityProjectionState('destroy');
1746
- case 6:
1765
+ case 7:
1747
1766
  this.resetAllergyItemRuleState();
1748
- _context4.next = 9;
1767
+ _context4.next = 10;
1749
1768
  return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "destroy", this).call(this);
1750
- case 9:
1769
+ case 10:
1751
1770
  case "end":
1752
1771
  return _context4.stop();
1753
1772
  }
@@ -3222,17 +3241,137 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3222
3241
  key: "queryCatalogProductDetail",
3223
3242
  value: (function () {
3224
3243
  var _queryCatalogProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3225
- var _this$otherParams30, _this$core$server, _this$core$server$has, _this$otherParams31, _this$otherParams32, _this$otherParams$bus3, _this$otherParams33, _this$otherParams34, _this$core$getPlugin, _this$core3, _this$core$getPlugin$, _this$otherParams35, _response$data$item, _response$data2, _raw$id2, _this$store$products, _this$store$products$;
3226
- var _cloneDeep2, product_id, _ignoredIds, catalogParams, schedule_date, schedule_datetime, scopedParams, member, baseUrl, localPath, handledByOsServer, channelMap, channel, businessCode, strategy_context, customerId, queryPayload, response, raw, resolved, detail, _i2, _arr2, key;
3244
+ var _this10 = this;
3227
3245
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3228
3246
  while (1) switch (_context29.prev = _context29.next) {
3229
3247
  case 0:
3230
- _cloneDeep2 = cloneDeep(params), product_id = _cloneDeep2.product_id, _ignoredIds = _cloneDeep2.product_ids, catalogParams = _objectWithoutProperties(_cloneDeep2, _excluded2);
3248
+ return _context29.abrupt("return", this.loadCatalogProductDetail(params, function (query) {
3249
+ return _this10.queryCatalogSnapshot(query);
3250
+ }));
3251
+ case 1:
3252
+ case "end":
3253
+ return _context29.stop();
3254
+ }
3255
+ }, _callee29, this);
3256
+ }));
3257
+ function queryCatalogProductDetail(_x16) {
3258
+ return _queryCatalogProductDetail.apply(this, arguments);
3259
+ }
3260
+ return queryCatalogProductDetail;
3261
+ }()
3262
+ /**
3263
+ * Opt-in calendar/card preview batching. Results expire after sixty seconds or a
3264
+ * runtime change; the next read starts a fresh clock/cache. Selection and submit
3265
+ * must keep using the ordinary fresh query methods. Call dispose on owner cleanup.
3266
+ */
3267
+ )
3268
+ }, {
3269
+ key: "createCatalogQueryBatch",
3270
+ value: function createCatalogQueryBatch() {
3271
+ var _this11 = this;
3272
+ return createCatalogQueryBatchAdapter({
3273
+ runtime: function runtime() {
3274
+ var _this11$core$getPlugi, _this11$core, _this11$store$product, _this11$core$getModul, _this11$core2, _this11$core$getModul2, _this11$core3, _this11$core$context, _this11$core$getPlugi2, _this11$core4, _this11$core$getPlugi3, _this11$core5, _user$get, _getScheduleList, _ref42, _this11$core$context2, _this11$core$context3, _evaluator$getStrateg;
3275
+ if (_this11.runtimeOpenDataDestroyed) throw new Error('The booking service is closed.');
3276
+ var user = (_this11$core$getPlugi = (_this11$core = _this11.core).getPlugin) === null || _this11$core$getPlugi === void 0 ? void 0 : _this11$core$getPlugi.call(_this11$core, 'user');
3277
+ var productParams = ((_this11$store$product = _this11.store.products) === null || _this11$store$product === void 0 ? void 0 : _this11$store$product.otherParams) || _this11.otherParams || {};
3278
+ var fatherModule = String(productParams.fatherModule || '').trim();
3279
+ var schedule = (fatherModule ? (_this11$core$getModul = (_this11$core2 = _this11.core).getModule) === null || _this11$core$getModul === void 0 ? void 0 : _this11$core$getModul.call(_this11$core2, "".concat(fatherModule, "_schedule")) : null) || ((_this11$core$getModul2 = (_this11$core3 = _this11.core).getModule) === null || _this11$core$getModul2 === void 0 ? void 0 : _this11$core$getModul2.call(_this11$core3, 'schedule'));
3280
+ var evaluator = (_this11$core$context = _this11.core.context) === null || _this11$core$context === void 0 ? void 0 : _this11$core$context.dataVariantEvaluator;
3281
+ // OpenData hydration is not a catalog input. Its temporary null/reload cycle
3282
+ // must not expire a batch while a parallel preview reads sales settings.
3283
+ var _ref41 = _this11.otherParams || {},
3284
+ _openData = _ref41.openData,
3285
+ otherParams = _objectWithoutProperties(_ref41, _excluded2);
3286
+ var _productOpenData = productParams.openData,
3287
+ productOtherParams = _objectWithoutProperties(productParams, _excluded3);
3288
+ return {
3289
+ references: [_this11.core, _this11.request, _this11.store.products, _this11.core.server, user, _this11.appPlugin, (_this11$core$getPlugi2 = (_this11$core4 = _this11.core).getPlugin) === null || _this11$core$getPlugi2 === void 0 ? void 0 : _this11$core$getPlugi2.call(_this11$core4, 'request'), (_this11$core$getPlugi3 = (_this11$core5 = _this11.core).getPlugin) === null || _this11$core$getPlugi3 === void 0 ? void 0 : _this11$core$getPlugi3.call(_this11$core5, 'app'), schedule, evaluator],
3290
+ values: {
3291
+ initialization: _this11.runtimeInitializationGeneration,
3292
+ scope: _this11.getRuntimeOpenDataScope(),
3293
+ requestBaseUrl: _this11.request.baseUrl,
3294
+ customerId: user === null || user === void 0 || (_user$get = user.get) === null || _user$get === void 0 || (_user$get = _user$get.call(user)) === null || _user$get === void 0 ? void 0 : _user$get.id,
3295
+ otherParams: otherParams,
3296
+ productOtherParams: productOtherParams
3297
+ },
3298
+ refreshValues: {
3299
+ scheduleList: schedule === null || schedule === void 0 || (_getScheduleList = (_ref42 = schedule).getScheduleList) === null || _getScheduleList === void 0 ? void 0 : _getScheduleList.call(_ref42),
3300
+ contextScheduleList: (_this11$core$context2 = _this11.core.context) === null || _this11$core$context2 === void 0 ? void 0 : _this11$core$context2.scheduleList,
3301
+ contextMenuList: (_this11$core$context3 = _this11.core.context) === null || _this11$core$context3 === void 0 ? void 0 : _this11$core$context3.menuList,
3302
+ strategyConfigs: evaluator === null || evaluator === void 0 || (_evaluator$getStrateg = evaluator.getStrategyConfigs) === null || _evaluator$getStrateg === void 0 ? void 0 : _evaluator$getStrateg.call(evaluator)
3303
+ }
3304
+ };
3305
+ },
3306
+ normalize: function normalize(params, now) {
3307
+ var _this11$core$getPlugi4, _this11$core6, _user$get2, _this11$store$product2, _productParams$busine, _params$with_count, _params$with_schedule, _params$status;
3308
+ var date = params.schedule_date || dayjs(now).format('YYYY-MM-DD');
3309
+ var user = (_this11$core$getPlugi4 = (_this11$core6 = _this11.core).getPlugin) === null || _this11$core$getPlugi4 === void 0 ? void 0 : _this11$core$getPlugi4.call(_this11$core6, 'user');
3310
+ var explicitCustomer = params.customer_id;
3311
+ if (explicitCustomer != null && (!Number.isSafeInteger(Number(explicitCustomer)) || Number(explicitCustomer) <= 0)) {
3312
+ throw new Error('Catalog query customer_id must be a positive integer.');
3313
+ }
3314
+ var fallbackCustomer = user === null || user === void 0 || (_user$get2 = user.get) === null || _user$get2 === void 0 || (_user$get2 = _user$get2.call(user)) === null || _user$get2 === void 0 ? void 0 : _user$get2.id;
3315
+ var customer = explicitCustomer !== null && explicitCustomer !== void 0 ? explicitCustomer : Number.isSafeInteger(Number(fallbackCustomer)) && Number(fallbackCustomer) > 0 ? Number(fallbackCustomer) : undefined;
3316
+ var productParams = ((_this11$store$product2 = _this11.store.products) === null || _this11$store$product2 === void 0 ? void 0 : _this11$store$product2.otherParams) || _this11.otherParams || {};
3317
+ var channelMap = {
3318
+ online_store: 'online-store',
3319
+ scan_to_order: 'online-store',
3320
+ 'scan-to-order': 'online-store',
3321
+ scan_to_order_2: 'online-store',
3322
+ scan_to_order_3: 'scantoorder3'
3323
+ };
3324
+ var channel = channelMap[productParams.channel] || productParams.channel;
3325
+ var businessCode = (_productParams$busine = productParams.businessCode) !== null && _productParams$busine !== void 0 ? _productParams$busine : productParams.business_code;
3326
+ var sorted = function sorted(items) {
3327
+ return _toConsumableArray(new Set(items)).sort(function (a, b) {
3328
+ return String(a).localeCompare(String(b));
3329
+ });
3330
+ };
3331
+ return _objectSpread(_objectSpread({}, params), {}, {
3332
+ menu_list_ids: Array.isArray(params.menu_list_ids) ? sorted(params.menu_list_ids) : params.menu_list_ids,
3333
+ category_ids: sorted(params.category_ids || []),
3334
+ collection: Array.isArray(params.collection) ? sorted(params.collection) : params.collection,
3335
+ extension_type: params.extension_type ? sorted(params.extension_type) : undefined,
3336
+ with_count: sorted((_params$with_count = params.with_count) !== null && _params$with_count !== void 0 ? _params$with_count : ['bundleGroup', 'optionGroup']),
3337
+ with_schedule: (_params$with_schedule = params.with_schedule) !== null && _params$with_schedule !== void 0 ? _params$with_schedule : 1,
3338
+ status: (_params$status = params.status) !== null && _params$status !== void 0 ? _params$status : 'published',
3339
+ schedule_date: date,
3340
+ schedule_datetime: params.schedule_datetime || "".concat(date, " ").concat(dayjs(now).format('HH:mm:ss')),
3341
+ customer_id: customer == null ? undefined : Number(customer),
3342
+ strategy_context: _objectSpread(_objectSpread(_objectSpread({}, channel ? {
3343
+ channel: channel
3344
+ } : {}), businessCode ? {
3345
+ business_code: businessCode
3346
+ } : {}), params.strategy_context || {})
3347
+ });
3348
+ },
3349
+ key: function key(params) {
3350
+ return JSON.stringify(stableValue(params));
3351
+ },
3352
+ snapshot: function snapshot(params) {
3353
+ return _this11.queryCatalogSnapshot(params);
3354
+ },
3355
+ detail: function detail(params, snapshot) {
3356
+ return _this11.loadCatalogProductDetail(params, snapshot);
3357
+ }
3358
+ });
3359
+ }
3360
+ }, {
3361
+ key: "loadCatalogProductDetail",
3362
+ value: function () {
3363
+ var _loadCatalogProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params, loadSnapshot) {
3364
+ var _this$otherParams30, _this$core$server, _this$core$server$has, _this$otherParams31, _this$otherParams32, _this$otherParams$bus3, _this$otherParams33, _this$otherParams34, _this$core$getPlugin, _this$core3, _this$core$getPlugin$, _this$otherParams35, _response$data$item, _response$data2, _raw$id2, _this$store$products, _this$store$products$;
3365
+ var _cloneDeep2, product_id, _ignoredIds, catalogParams, schedule_date, schedule_datetime, scopedParams, member, baseUrl, localPath, handledByOsServer, channelMap, channel, businessCode, strategy_context, customerId, queryPayload, response, raw, resolved, detail, _i2, _arr2, key;
3366
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3367
+ while (1) switch (_context30.prev = _context30.next) {
3368
+ case 0:
3369
+ _cloneDeep2 = cloneDeep(params), product_id = _cloneDeep2.product_id, _ignoredIds = _cloneDeep2.product_ids, catalogParams = _objectWithoutProperties(_cloneDeep2, _excluded4);
3231
3370
  if (!(!Number.isInteger(product_id) || product_id <= 0)) {
3232
- _context29.next = 3;
3371
+ _context30.next = 3;
3233
3372
  break;
3234
3373
  }
3235
- return _context29.abrupt("return", undefined);
3374
+ return _context30.abrupt("return", undefined);
3236
3375
  case 3:
3237
3376
  schedule_date = catalogParams.schedule_date || dayjs().format('YYYY-MM-DD');
3238
3377
  schedule_datetime = catalogParams.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
@@ -3240,17 +3379,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3240
3379
  schedule_date: schedule_date,
3241
3380
  schedule_datetime: schedule_datetime
3242
3381
  });
3243
- _context29.next = 8;
3244
- return this.queryCatalogSnapshot(scopedParams);
3382
+ _context30.next = 8;
3383
+ return loadSnapshot(scopedParams);
3245
3384
  case 8:
3246
- member = _context29.sent.find(function (item) {
3385
+ member = _context30.sent.find(function (item) {
3247
3386
  return Number(item.id) === product_id;
3248
3387
  });
3249
3388
  if (member) {
3250
- _context29.next = 11;
3389
+ _context30.next = 11;
3251
3390
  break;
3252
3391
  }
3253
- return _context29.abrupt("return", undefined);
3392
+ return _context30.abrupt("return", undefined);
3254
3393
  case 11:
3255
3394
  baseUrl = String(this.request.baseUrl || (isCustomerUserPlatform((_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform) ? '/h5' : '/shop')).replace(/\/+$/, '');
3256
3395
  localPath = "/product/query/".concat(product_id);
@@ -3282,32 +3421,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3282
3421
  }, isCustomerUserPlatform((_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.platform) ? {} : {
3283
3422
  open_quotation: 1
3284
3423
  });
3285
- _context29.next = 23;
3424
+ _context30.next = 23;
3286
3425
  return this.request.get(baseUrl === '/shop' ? localPath : "/product/show/".concat(product_id), queryPayload, {
3287
3426
  osServer: true,
3288
3427
  useCache: false,
3289
3428
  customToast: function customToast() {}
3290
3429
  });
3291
3430
  case 23:
3292
- response = _context29.sent;
3431
+ response = _context30.sent;
3293
3432
  if (!((response === null || response === void 0 ? void 0 : response.status) === false || Number(response === null || response === void 0 ? void 0 : response.code) >= 400)) {
3294
- _context29.next = 26;
3433
+ _context30.next = 26;
3295
3434
  break;
3296
3435
  }
3297
3436
  throw new Error('[UnifiedBookingSales] Product detail query failed');
3298
3437
  case 26:
3299
3438
  raw = (_response$data$item = response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.item) !== null && _response$data$item !== void 0 ? _response$data$item : response === null || response === void 0 ? void 0 : response.data;
3300
3439
  if (!(!raw || Number((_raw$id2 = raw.id) !== null && _raw$id2 !== void 0 ? _raw$id2 : raw.product_id) !== product_id)) {
3301
- _context29.next = 29;
3440
+ _context30.next = 29;
3302
3441
  break;
3303
3442
  }
3304
- return _context29.abrupt("return", undefined);
3443
+ return _context30.abrupt("return", undefined);
3305
3444
  case 29:
3306
3445
  if (!(raw.status && raw.status !== 'published')) {
3307
- _context29.next = 31;
3446
+ _context30.next = 31;
3308
3447
  break;
3309
3448
  }
3310
- return _context29.abrupt("return", undefined);
3449
+ return _context30.abrupt("return", undefined);
3311
3450
  case 31:
3312
3451
  if (!handledByOsServer) (_this$store$products = this.store.products) === null || _this$store$products === void 0 || (_this$store$products$ = _this$store$products.rememberRawProductQueryResult) === null || _this$store$products$ === void 0 || _this$store$products$.call(_this$store$products, [cloneDeep(raw)]);
3313
3452
  resolved = resolveClientDataVariants({
@@ -3318,10 +3457,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3318
3457
  handledByOsServer: handledByOsServer
3319
3458
  })[0]; // Detail owns relation arrays. Never synthesize empty groups from list counts.
3320
3459
  if (resolved) {
3321
- _context29.next = 35;
3460
+ _context30.next = 35;
3322
3461
  break;
3323
3462
  }
3324
- return _context29.abrupt("return", undefined);
3463
+ return _context30.abrupt("return", undefined);
3325
3464
  case 35:
3326
3465
  detail = _objectSpread(_objectSpread(_objectSpread({}, member), resolved), {}, {
3327
3466
  metadata: _objectSpread(_objectSpread({}, member.metadata || {}), resolved.metadata || {})
@@ -3330,36 +3469,36 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3330
3469
  key = _arr2[_i2];
3331
3470
  if (!Object.prototype.hasOwnProperty.call(resolved, key)) delete detail[key];
3332
3471
  }
3333
- return _context29.abrupt("return", cloneDeep(detail));
3472
+ return _context30.abrupt("return", cloneDeep(detail));
3334
3473
  case 38:
3335
3474
  case "end":
3336
- return _context29.stop();
3475
+ return _context30.stop();
3337
3476
  }
3338
- }, _callee29, this);
3477
+ }, _callee30, this);
3339
3478
  }));
3340
- function queryCatalogProductDetail(_x16) {
3341
- return _queryCatalogProductDetail.apply(this, arguments);
3479
+ function loadCatalogProductDetail(_x17, _x18) {
3480
+ return _loadCatalogProductDetail.apply(this, arguments);
3342
3481
  }
3343
- return queryCatalogProductDetail;
3344
- }())
3482
+ return loadCatalogProductDetail;
3483
+ }()
3345
3484
  }, {
3346
3485
  key: "loadCatalogProducts",
3347
3486
  value: function () {
3348
- var _loadCatalogProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
3487
+ var _loadCatalogProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
3349
3488
  var params,
3350
3489
  options,
3351
3490
  catalogScope,
3352
3491
  schedule_date,
3353
3492
  schedule_datetime,
3354
3493
  result,
3355
- _args30 = arguments;
3356
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3357
- while (1) switch (_context30.prev = _context30.next) {
3494
+ _args31 = arguments;
3495
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3496
+ while (1) switch (_context31.prev = _context31.next) {
3358
3497
  case 0:
3359
- params = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
3360
- options = _args30.length > 1 ? _args30[1] : undefined;
3498
+ params = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {};
3499
+ options = _args31.length > 1 ? _args31[1] : undefined;
3361
3500
  if (this.store.products) {
3362
- _context30.next = 4;
3501
+ _context31.next = 4;
3363
3502
  break;
3364
3503
  }
3365
3504
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
@@ -3367,7 +3506,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3367
3506
  catalogScope = this.otherParams.catalogScopeKey;
3368
3507
  schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
3369
3508
  schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
3370
- _context30.next = 9;
3509
+ _context31.next = 9;
3371
3510
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
3372
3511
  with_count: ['bundleGroup', 'optionGroup'],
3373
3512
  with_schedule: 1
@@ -3377,21 +3516,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3377
3516
  cacheId: this.cacheId
3378
3517
  }), options);
3379
3518
  case 9:
3380
- result = _context30.sent;
3519
+ result = _context31.sent;
3381
3520
  if (!(catalogScope !== this.otherParams.catalogScopeKey)) {
3382
- _context30.next = 12;
3521
+ _context31.next = 12;
3383
3522
  break;
3384
3523
  }
3385
3524
  throw Object.assign(new Error('Product scope changed'), {
3386
3525
  name: 'AbortError'
3387
3526
  });
3388
3527
  case 12:
3389
- return _context30.abrupt("return", result);
3528
+ return _context31.abrupt("return", result);
3390
3529
  case 13:
3391
3530
  case "end":
3392
- return _context30.stop();
3531
+ return _context31.stop();
3393
3532
  }
3394
- }, _callee30, this);
3533
+ }, _callee31, this);
3395
3534
  }));
3396
3535
  function loadCatalogProducts() {
3397
3536
  return _loadCatalogProducts.apply(this, arguments);
@@ -3401,25 +3540,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3401
3540
  }, {
3402
3541
  key: "queryProducts",
3403
3542
  value: function () {
3404
- var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
3543
+ var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
3405
3544
  var params,
3406
- _args31 = arguments;
3407
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3408
- while (1) switch (_context31.prev = _context31.next) {
3545
+ _args32 = arguments;
3546
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3547
+ while (1) switch (_context32.prev = _context32.next) {
3409
3548
  case 0:
3410
- params = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {};
3549
+ params = _args32.length > 0 && _args32[0] !== undefined ? _args32[0] : {};
3411
3550
  if (this.store.products) {
3412
- _context31.next = 3;
3551
+ _context32.next = 3;
3413
3552
  break;
3414
3553
  }
3415
3554
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
3416
3555
  case 3:
3417
- return _context31.abrupt("return", this.store.products.queryProducts(params));
3556
+ return _context32.abrupt("return", this.store.products.queryProducts(params));
3418
3557
  case 4:
3419
3558
  case "end":
3420
- return _context31.stop();
3559
+ return _context32.stop();
3421
3560
  }
3422
- }, _callee31, this);
3561
+ }, _callee32, this);
3423
3562
  }));
3424
3563
  function queryProducts() {
3425
3564
  return _queryProducts.apply(this, arguments);
@@ -3429,24 +3568,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3429
3568
  }, {
3430
3569
  key: "loadScheduleAvailableDate",
3431
3570
  value: (function () {
3432
- var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3433
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3434
- while (1) switch (_context32.prev = _context32.next) {
3571
+ var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3572
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3573
+ while (1) switch (_context33.prev = _context33.next) {
3435
3574
  case 0:
3436
3575
  if (this.store.schedule) {
3437
- _context32.next = 2;
3576
+ _context33.next = 2;
3438
3577
  break;
3439
3578
  }
3440
3579
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
3441
3580
  case 2:
3442
- return _context32.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
3581
+ return _context33.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
3443
3582
  case 3:
3444
3583
  case "end":
3445
- return _context32.stop();
3584
+ return _context33.stop();
3446
3585
  }
3447
- }, _callee32, this);
3586
+ }, _callee33, this);
3448
3587
  }));
3449
- function loadScheduleAvailableDate(_x17) {
3588
+ function loadScheduleAvailableDate(_x19) {
3450
3589
  return _loadScheduleAvailableDate.apply(this, arguments);
3451
3590
  }
3452
3591
  return loadScheduleAvailableDate;
@@ -3460,15 +3599,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3460
3599
  }, {
3461
3600
  key: "loadProductsByScheduleDate",
3462
3601
  value: (function () {
3463
- var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3602
+ var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
3464
3603
  var _this$store$schedule$, _this$store$schedule, _this$store$schedule$2, _this$store$schedule2, _this$store$schedule$3, _this$store$schedule3, _this$store$schedule$4, _this$store$schedule4;
3465
3604
  var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
3466
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3467
- while (1) switch (_context33.prev = _context33.next) {
3605
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3606
+ while (1) switch (_context34.prev = _context34.next) {
3468
3607
  case 0:
3469
- date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded3);
3608
+ date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded5);
3470
3609
  if (this.store.schedule) {
3471
- _context33.next = 3;
3610
+ _context34.next = 3;
3472
3611
  break;
3473
3612
  }
3474
3613
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
@@ -3479,10 +3618,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3479
3618
  });
3480
3619
  hasOtherProducts = (((_this$store$schedule$2 = (_this$store$schedule2 = this.store.schedule).getOtherProductsIds) === null || _this$store$schedule$2 === void 0 ? void 0 : _this$store$schedule$2.call(_this$store$schedule2)) || []).length > 0;
3481
3620
  if (!(!hasCachedDate && !hasOtherProducts)) {
3482
- _context33.next = 9;
3621
+ _context34.next = 9;
3483
3622
  break;
3484
3623
  }
3485
- _context33.next = 9;
3624
+ _context34.next = 9;
3486
3625
  return this.loadScheduleAvailableDate({
3487
3626
  startDate: date,
3488
3627
  endDate: date,
@@ -3502,45 +3641,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3502
3641
  return !productIdFilter || productIdFilter.has(String(id));
3503
3642
  });
3504
3643
  if (availableProductIds.length) {
3505
- _context33.next = 17;
3644
+ _context34.next = 17;
3506
3645
  break;
3507
3646
  }
3508
3647
  this.unifiedProductCatalog = [];
3509
- _context33.next = 16;
3648
+ _context34.next = 16;
3510
3649
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
3511
3650
  case 16:
3512
- return _context33.abrupt("return", []);
3651
+ return _context34.abrupt("return", []);
3513
3652
  case 17:
3514
- _context33.next = 19;
3653
+ _context34.next = 19;
3515
3654
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
3516
3655
  product_ids: availableProductIds,
3517
3656
  schedule_date: date
3518
3657
  }));
3519
3658
  case 19:
3520
- products = _context33.sent;
3659
+ products = _context34.sent;
3521
3660
  if (!(products.length || availableProductIds.length <= 1)) {
3522
- _context33.next = 22;
3661
+ _context34.next = 22;
3523
3662
  break;
3524
3663
  }
3525
- return _context33.abrupt("return", products);
3664
+ return _context34.abrupt("return", products);
3526
3665
  case 22:
3527
3666
  fallbackProducts = [];
3528
3667
  _iterator = _createForOfIteratorHelper(availableProductIds);
3529
- _context33.prev = 24;
3668
+ _context34.prev = 24;
3530
3669
  _iterator.s();
3531
3670
  case 26:
3532
3671
  if ((_step = _iterator.n()).done) {
3533
- _context33.next = 34;
3672
+ _context34.next = 34;
3534
3673
  break;
3535
3674
  }
3536
3675
  productId = _step.value;
3537
- _context33.next = 30;
3676
+ _context34.next = 30;
3538
3677
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
3539
3678
  product_ids: [productId],
3540
3679
  schedule_date: date
3541
3680
  }));
3542
3681
  case 30:
3543
- result = _context33.sent;
3682
+ result = _context34.sent;
3544
3683
  result.forEach(function (product) {
3545
3684
  var _id;
3546
3685
  var id = (_id = product === null || product === void 0 ? void 0 : product.id) !== null && _id !== void 0 ? _id : product === null || product === void 0 ? void 0 : product.product_id;
@@ -3552,32 +3691,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3552
3691
  }
3553
3692
  });
3554
3693
  case 32:
3555
- _context33.next = 26;
3694
+ _context34.next = 26;
3556
3695
  break;
3557
3696
  case 34:
3558
- _context33.next = 39;
3697
+ _context34.next = 39;
3559
3698
  break;
3560
3699
  case 36:
3561
- _context33.prev = 36;
3562
- _context33.t0 = _context33["catch"](24);
3563
- _iterator.e(_context33.t0);
3700
+ _context34.prev = 36;
3701
+ _context34.t0 = _context34["catch"](24);
3702
+ _iterator.e(_context34.t0);
3564
3703
  case 39:
3565
- _context33.prev = 39;
3704
+ _context34.prev = 39;
3566
3705
  _iterator.f();
3567
- return _context33.finish(39);
3706
+ return _context34.finish(39);
3568
3707
  case 42:
3569
3708
  this.unifiedProductCatalog = [].concat(fallbackProducts);
3570
- _context33.next = 45;
3709
+ _context34.next = 45;
3571
3710
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
3572
3711
  case 45:
3573
- return _context33.abrupt("return", fallbackProducts);
3712
+ return _context34.abrupt("return", fallbackProducts);
3574
3713
  case 46:
3575
3714
  case "end":
3576
- return _context33.stop();
3715
+ return _context34.stop();
3577
3716
  }
3578
- }, _callee33, this, [[24, 36, 39, 42]]);
3717
+ }, _callee34, this, [[24, 36, 39, 42]]);
3579
3718
  }));
3580
- function loadProductsByScheduleDate(_x18) {
3719
+ function loadProductsByScheduleDate(_x20) {
3581
3720
  return _loadProductsByScheduleDate.apply(this, arguments);
3582
3721
  }
3583
3722
  return loadProductsByScheduleDate;
@@ -3630,7 +3769,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3630
3769
  }, {
3631
3770
  key: "applyPlannerDiscounts",
3632
3771
  value: (function () {
3633
- var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
3772
+ var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
3634
3773
  var _params$customerId;
3635
3774
  var params,
3636
3775
  tempOrder,
@@ -3647,24 +3786,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3647
3786
  discount,
3648
3787
  discountId,
3649
3788
  nextTempOrder,
3650
- _args34 = arguments;
3651
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3652
- while (1) switch (_context34.prev = _context34.next) {
3789
+ _args35 = arguments;
3790
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3791
+ while (1) switch (_context35.prev = _context35.next) {
3653
3792
  case 0:
3654
- params = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {};
3793
+ params = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
3655
3794
  tempOrder = this.getTempOrder();
3656
3795
  requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
3657
3796
  parsedCustomerId = Number(requestedCustomerId);
3658
3797
  customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
3659
- _context34.next = 7;
3798
+ _context35.next = 7;
3660
3799
  return this.getSummary();
3661
3800
  case 7:
3662
- summaryBefore = _context34.sent;
3801
+ summaryBefore = _context35.sent;
3663
3802
  if (customerId) {
3664
- _context34.next = 10;
3803
+ _context35.next = 10;
3665
3804
  break;
3666
3805
  }
3667
- return _context34.abrupt("return", buildPlannerDiscountResult({
3806
+ return _context35.abrupt("return", buildPlannerDiscountResult({
3668
3807
  customerId: null,
3669
3808
  discountList: this.getDiscountList(),
3670
3809
  products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
@@ -3673,7 +3812,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3673
3812
  status: 'no_customer'
3674
3813
  }));
3675
3814
  case 10:
3676
- _context34.next = 12;
3815
+ _context35.next = 12;
3677
3816
  return this.loadDiscountConfig({
3678
3817
  customerId: customerId,
3679
3818
  action: 'create'
@@ -3685,7 +3824,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3685
3824
  return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
3686
3825
  });
3687
3826
  if (!preferredDiscount) {
3688
- _context34.next = 40;
3827
+ _context35.next = 40;
3689
3828
  break;
3690
3829
  }
3691
3830
  // A requested card is an explicit UI choice, not a best-effort preference. Clear prior
@@ -3697,98 +3836,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3697
3836
  return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
3698
3837
  });
3699
3838
  _iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
3700
- _context34.prev = 18;
3839
+ _context35.prev = 18;
3701
3840
  _iterator2.s();
3702
3841
  case 20:
3703
3842
  if ((_step2 = _iterator2.n()).done) {
3704
- _context34.next = 28;
3843
+ _context35.next = 28;
3705
3844
  break;
3706
3845
  }
3707
3846
  discount = _step2.value;
3708
3847
  discountId = Number(resolvePlannerDiscountId(discount));
3709
3848
  if (!Number.isFinite(discountId)) {
3710
- _context34.next = 26;
3849
+ _context35.next = 26;
3711
3850
  break;
3712
3851
  }
3713
- _context34.next = 26;
3852
+ _context35.next = 26;
3714
3853
  return this.setDiscountSelected({
3715
3854
  discountId: discountId,
3716
3855
  isSelected: false
3717
3856
  });
3718
3857
  case 26:
3719
- _context34.next = 20;
3858
+ _context35.next = 20;
3720
3859
  break;
3721
3860
  case 28:
3722
- _context34.next = 33;
3861
+ _context35.next = 33;
3723
3862
  break;
3724
3863
  case 30:
3725
- _context34.prev = 30;
3726
- _context34.t0 = _context34["catch"](18);
3727
- _iterator2.e(_context34.t0);
3864
+ _context35.prev = 30;
3865
+ _context35.t0 = _context35["catch"](18);
3866
+ _iterator2.e(_context35.t0);
3728
3867
  case 33:
3729
- _context34.prev = 33;
3868
+ _context35.prev = 33;
3730
3869
  _iterator2.f();
3731
- return _context34.finish(33);
3870
+ return _context35.finish(33);
3732
3871
  case 36:
3733
- _context34.next = 38;
3872
+ _context35.next = 38;
3734
3873
  return this.setDiscountSelected({
3735
3874
  discountId: Number(preferredId),
3736
3875
  isSelected: true
3737
3876
  });
3738
3877
  case 38:
3739
- _context34.next = 49;
3878
+ _context35.next = 49;
3740
3879
  break;
3741
3880
  case 40:
3742
3881
  if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
3743
- _context34.next = 46;
3882
+ _context35.next = 46;
3744
3883
  break;
3745
3884
  }
3746
3885
  if (!(params.applyBestDiscount !== false)) {
3747
- _context34.next = 44;
3886
+ _context35.next = 44;
3748
3887
  break;
3749
3888
  }
3750
- _context34.next = 44;
3889
+ _context35.next = 44;
3751
3890
  return this.bestDiscount();
3752
3891
  case 44:
3753
- _context34.next = 49;
3892
+ _context35.next = 49;
3754
3893
  break;
3755
3894
  case 46:
3756
3895
  if (!(params.applyBestDiscount !== false)) {
3757
- _context34.next = 49;
3896
+ _context35.next = 49;
3758
3897
  break;
3759
3898
  }
3760
- _context34.next = 49;
3899
+ _context35.next = 49;
3761
3900
  return this.bestDiscount();
3762
3901
  case 49:
3763
3902
  nextTempOrder = this.getTempOrder();
3764
- _context34.t1 = buildPlannerDiscountResult;
3765
- _context34.t2 = customerId;
3766
- _context34.t3 = this.getDiscountList();
3767
- _context34.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
3768
- _context34.t5 = summaryBefore;
3769
- _context34.next = 57;
3903
+ _context35.t1 = buildPlannerDiscountResult;
3904
+ _context35.t2 = customerId;
3905
+ _context35.t3 = this.getDiscountList();
3906
+ _context35.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
3907
+ _context35.t5 = summaryBefore;
3908
+ _context35.next = 57;
3770
3909
  return this.getSummary();
3771
3910
  case 57:
3772
- _context34.t6 = _context34.sent;
3773
- _context34.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
3774
- _context34.t8 = preferredDiscountId;
3775
- _context34.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
3776
- _context34.t10 = {
3777
- customerId: _context34.t2,
3778
- discountList: _context34.t3,
3779
- products: _context34.t4,
3780
- summaryBefore: _context34.t5,
3781
- summaryAfter: _context34.t6,
3782
- status: _context34.t7,
3783
- preferredDiscountId: _context34.t8,
3784
- preferredDiscountFound: _context34.t9
3911
+ _context35.t6 = _context35.sent;
3912
+ _context35.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
3913
+ _context35.t8 = preferredDiscountId;
3914
+ _context35.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
3915
+ _context35.t10 = {
3916
+ customerId: _context35.t2,
3917
+ discountList: _context35.t3,
3918
+ products: _context35.t4,
3919
+ summaryBefore: _context35.t5,
3920
+ summaryAfter: _context35.t6,
3921
+ status: _context35.t7,
3922
+ preferredDiscountId: _context35.t8,
3923
+ preferredDiscountFound: _context35.t9
3785
3924
  };
3786
- return _context34.abrupt("return", (0, _context34.t1)(_context34.t10));
3925
+ return _context35.abrupt("return", (0, _context35.t1)(_context35.t10));
3787
3926
  case 63:
3788
3927
  case "end":
3789
- return _context34.stop();
3928
+ return _context35.stop();
3790
3929
  }
3791
- }, _callee34, this, [[18, 30, 33, 36]]);
3930
+ }, _callee35, this, [[18, 30, 33, 36]]);
3792
3931
  }));
3793
3932
  function applyPlannerDiscounts() {
3794
3933
  return _applyPlannerDiscounts.apply(this, arguments);
@@ -3798,16 +3937,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3798
3937
  }, {
3799
3938
  key: "buildUnifiedOrderProduct",
3800
3939
  value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
3801
- var _ref41, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref42, _sourceProduct$produc, _ref43, _ref44, _sourceProduct$quanti, _sourceProduct$price, _ref45, _ref46, _sourceProduct$sellin;
3940
+ var _ref43, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref44, _sourceProduct$produc, _ref45, _ref46, _sourceProduct$quanti, _sourceProduct$price, _ref47, _ref48, _sourceProduct$sellin;
3802
3941
  var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
3803
- var quotationShelfId = (_ref41 = (_sourceProduct$_exten = (_sourceProduct$_exten2 = sourceProduct._extend) === null || _sourceProduct$_exten2 === void 0 ? void 0 : _sourceProduct$_exten2.quotation_shelf_id) !== null && _sourceProduct$_exten !== void 0 ? _sourceProduct$_exten : sourceProduct.quotation_shelf_id) !== null && _ref41 !== void 0 ? _ref41 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
3942
+ var quotationShelfId = (_ref43 = (_sourceProduct$_exten = (_sourceProduct$_exten2 = sourceProduct._extend) === null || _sourceProduct$_exten2 === void 0 ? void 0 : _sourceProduct$_exten2.quotation_shelf_id) !== null && _sourceProduct$_exten !== void 0 ? _sourceProduct$_exten : sourceProduct.quotation_shelf_id) !== null && _ref43 !== void 0 ? _ref43 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
3804
3943
  var orderProduct = this.transformBaseProductToOrderProduct({
3805
3944
  payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
3806
3945
  id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
3807
- product_id: (_ref42 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref42 !== void 0 ? _ref42 : product === null || product === void 0 ? void 0 : product.id,
3808
- quantity: (_ref43 = (_ref44 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref44 !== void 0 ? _ref44 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref43 !== void 0 ? _ref43 : 1,
3946
+ product_id: (_ref44 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref44 !== void 0 ? _ref44 : product === null || product === void 0 ? void 0 : product.id,
3947
+ quantity: (_ref45 = (_ref46 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref46 !== void 0 ? _ref46 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref45 !== void 0 ? _ref45 : 1,
3809
3948
  price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
3810
- selling_price: (_ref45 = (_ref46 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref46 !== void 0 ? _ref46 : normalizedProductRaw.selling_price) !== null && _ref45 !== void 0 ? _ref45 : normalizedProductRaw.price,
3949
+ selling_price: (_ref47 = (_ref48 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref48 !== void 0 ? _ref48 : normalizedProductRaw.selling_price) !== null && _ref47 !== void 0 ? _ref47 : normalizedProductRaw.price,
3811
3950
  metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
3812
3951
  }),
3813
3952
  sourceProduct: sourceProduct
@@ -3832,29 +3971,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3832
3971
  }, {
3833
3972
  key: "removeExistingStagedLines",
3834
3973
  value: (function () {
3835
- var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(ownershipKey) {
3974
+ var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(ownershipKey) {
3836
3975
  var _this$getTempOrder2;
3837
3976
  var existingLines;
3838
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3839
- while (1) switch (_context35.prev = _context35.next) {
3977
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3978
+ while (1) switch (_context36.prev = _context36.next) {
3840
3979
  case 0:
3841
3980
  existingLines = (((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.products) || []).filter(function (product) {
3842
3981
  var _product$metadata5;
3843
3982
  return (product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5[ownershipKey]) === true;
3844
3983
  });
3845
3984
  if (!(existingLines.length > 0)) {
3846
- _context35.next = 4;
3985
+ _context36.next = 4;
3847
3986
  break;
3848
3987
  }
3849
- _context35.next = 4;
3988
+ _context36.next = 4;
3850
3989
  return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
3851
3990
  case 4:
3852
3991
  case "end":
3853
- return _context35.stop();
3992
+ return _context36.stop();
3854
3993
  }
3855
- }, _callee35, this);
3994
+ }, _callee36, this);
3856
3995
  }));
3857
- function removeExistingStagedLines(_x19) {
3996
+ function removeExistingStagedLines(_x21) {
3858
3997
  return _removeExistingStagedLines.apply(this, arguments);
3859
3998
  }
3860
3999
  return removeExistingStagedLines;
@@ -3862,25 +4001,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3862
4001
  }, {
3863
4002
  key: "stageProducts",
3864
4003
  value: function () {
3865
- var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params, ownershipKey) {
4004
+ var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params, ownershipKey) {
3866
4005
  var _params$rawProducts;
3867
4006
  var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i3, _arr3, sourceProduct, productInput;
3868
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3869
- while (1) switch (_context36.prev = _context36.next) {
4007
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4008
+ while (1) switch (_context37.prev = _context37.next) {
3870
4009
  case 0:
3871
4010
  productIds = params.productIds || [];
3872
4011
  if (productIds.length) {
3873
- _context36.next = 3;
4012
+ _context37.next = 3;
3874
4013
  break;
3875
4014
  }
3876
- return _context36.abrupt("return", this.getTempOrder());
4015
+ return _context37.abrupt("return", this.getTempOrder());
3877
4016
  case 3:
3878
4017
  if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
3879
- _context36.next = 7;
4018
+ _context37.next = 7;
3880
4019
  break;
3881
4020
  }
3882
4021
  this.unifiedProductCatalog = params.rawProducts;
3883
- _context36.next = 12;
4022
+ _context37.next = 12;
3884
4023
  break;
3885
4024
  case 7:
3886
4025
  existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
@@ -3891,15 +4030,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3891
4030
  return !existingIds.has(String(id));
3892
4031
  });
3893
4032
  if (!(missingIds.length || params.productLoadParams)) {
3894
- _context36.next = 12;
4033
+ _context37.next = 12;
3895
4034
  break;
3896
4035
  }
3897
- _context36.next = 12;
4036
+ _context37.next = 12;
3898
4037
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
3899
4038
  product_ids: productIds.map(Number).filter(Number.isFinite)
3900
4039
  }));
3901
4040
  case 12:
3902
- _context36.next = 14;
4041
+ _context37.next = 14;
3903
4042
  return this.removeExistingStagedLines(ownershipKey);
3904
4043
  case 14:
3905
4044
  productIdSet = new Set(productIds.map(function (id) {
@@ -3912,30 +4051,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3912
4051
  _i3 = 0, _arr3 = selectedProducts;
3913
4052
  case 17:
3914
4053
  if (!(_i3 < _arr3.length)) {
3915
- _context36.next = 26;
4054
+ _context37.next = 26;
3916
4055
  break;
3917
4056
  }
3918
4057
  sourceProduct = _arr3[_i3];
3919
4058
  productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
3920
4059
  if (!productInput) {
3921
- _context36.next = 23;
4060
+ _context37.next = 23;
3922
4061
  break;
3923
4062
  }
3924
- _context36.next = 23;
4063
+ _context37.next = 23;
3925
4064
  return this.addProductToOrder(productInput);
3926
4065
  case 23:
3927
4066
  _i3++;
3928
- _context36.next = 17;
4067
+ _context37.next = 17;
3929
4068
  break;
3930
4069
  case 26:
3931
- return _context36.abrupt("return", this.getTempOrder());
4070
+ return _context37.abrupt("return", this.getTempOrder());
3932
4071
  case 27:
3933
4072
  case "end":
3934
- return _context36.stop();
4073
+ return _context37.stop();
3935
4074
  }
3936
- }, _callee36, this);
4075
+ }, _callee37, this);
3937
4076
  }));
3938
- function stageProducts(_x20, _x21) {
4077
+ function stageProducts(_x22, _x23) {
3939
4078
  return _stageProducts.apply(this, arguments);
3940
4079
  }
3941
4080
  return stageProducts;
@@ -3947,51 +4086,57 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3947
4086
  }, {
3948
4087
  key: "stageRetailProducts",
3949
4088
  value: (function () {
3950
- var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
3951
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3952
- while (1) switch (_context37.prev = _context37.next) {
4089
+ var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4090
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4091
+ while (1) switch (_context38.prev = _context38.next) {
3953
4092
  case 0:
3954
- return _context37.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
4093
+ return _context38.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
3955
4094
  case 1:
3956
4095
  case "end":
3957
- return _context37.stop();
4096
+ return _context38.stop();
3958
4097
  }
3959
- }, _callee37, this);
4098
+ }, _callee38, this);
3960
4099
  }));
3961
- function stageRetailProducts(_x22) {
4100
+ function stageRetailProducts(_x24) {
3962
4101
  return _stageRetailProducts.apply(this, arguments);
3963
4102
  }
3964
4103
  return stageRetailProducts;
3965
- }()
4104
+ }() /** Explicit capability: order-scoped Tickets extras use guarded writes without implicit SKU merging. */)
4105
+ }, {
4106
+ key: "supportsVenueTicketExtras",
4107
+ value: function supportsVenueTicketExtras() {
4108
+ return true;
4109
+ }
4110
+
3966
4111
  /**
3967
4112
  * Adds one retail line without replacing the cart's existing retail selection.
3968
4113
  * This is intentionally separate from stageRetailProducts(), whose contract is
3969
4114
  * "replace the staged selection" for demo and wizard-like callers.
3970
4115
  */
3971
- )
3972
4116
  }, {
3973
4117
  key: "addRetailProduct",
3974
4118
  value: (function () {
3975
- var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4119
+ var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
3976
4120
  var _params$quantity,
3977
- _ref47,
4121
+ _ref49,
3978
4122
  _params$productId,
3979
4123
  _params$product,
3980
4124
  _params$product2,
3981
4125
  _metadata2,
3982
- _this10 = this;
3983
- var quantity, productId, sourceProduct, products, orderProduct, order, meta, parentUid, scopeKey, service, identity, isCurrentOrder, guard;
3984
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3985
- while (1) switch (_context38.prev = _context38.next) {
4126
+ _this12 = this,
4127
+ _metadata3;
4128
+ var quantity, productId, sourceProduct, products, orderProduct, order, meta, scopeKey, purchaseDatetime, identity, isCurrentOrder, guard, _order, _meta, parentUid, _scopeKey, _purchaseDatetime, normalizedPurchaseDatetime, _identity, _isCurrentOrder, _guard;
4129
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4130
+ while (1) switch (_context39.prev = _context39.next) {
3986
4131
  case 0:
3987
4132
  quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
3988
4133
  if (!(!Number.isFinite(quantity) || quantity <= 0)) {
3989
- _context38.next = 3;
4134
+ _context39.next = 3;
3990
4135
  break;
3991
4136
  }
3992
4137
  throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
3993
4138
  case 3:
3994
- productId = (_ref47 = (_params$productId = params.productId) !== null && _params$productId !== void 0 ? _params$productId : (_params$product = params.product) === null || _params$product === void 0 ? void 0 : _params$product.id) !== null && _ref47 !== void 0 ? _ref47 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
4139
+ productId = (_ref49 = (_params$productId = params.productId) !== null && _params$productId !== void 0 ? _params$productId : (_params$product = params.product) === null || _params$product === void 0 ? void 0 : _params$product.id) !== null && _ref49 !== void 0 ? _ref49 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
3995
4140
  sourceProduct = params.product;
3996
4141
  if (!sourceProduct && productId !== undefined && productId !== null) {
3997
4142
  sourceProduct = this.unifiedProductCatalog.find(function (product) {
@@ -4000,22 +4145,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4000
4145
  });
4001
4146
  }
4002
4147
  if (!(!sourceProduct && productId !== undefined && productId !== null)) {
4003
- _context38.next = 11;
4148
+ _context39.next = 11;
4004
4149
  break;
4005
4150
  }
4006
- _context38.next = 9;
4151
+ _context39.next = 9;
4007
4152
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
4008
4153
  product_ids: [Number(productId)].filter(Number.isFinite)
4009
4154
  }));
4010
4155
  case 9:
4011
- products = _context38.sent;
4156
+ products = _context39.sent;
4012
4157
  sourceProduct = products.find(function (product) {
4013
4158
  var _product$id4;
4014
4159
  return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
4015
4160
  });
4016
4161
  case 11:
4017
4162
  if (sourceProduct) {
4018
- _context38.next = 13;
4163
+ _context39.next = 13;
4019
4164
  break;
4020
4165
  }
4021
4166
  throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
@@ -4024,55 +4169,106 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4024
4169
  quantity: quantity
4025
4170
  }), 'unified_booking_sales_retail');
4026
4171
  if (orderProduct) {
4027
- _context38.next = 16;
4172
+ _context39.next = 16;
4028
4173
  break;
4029
4174
  }
4030
4175
  throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
4031
4176
  case 16:
4032
- if (!(((_metadata2 = orderProduct.metadata) === null || _metadata2 === void 0 ? void 0 : _metadata2.venue_booking_role) === 'party_extra')) {
4033
- _context38.next = 29;
4177
+ if (!(((_metadata2 = orderProduct.metadata) === null || _metadata2 === void 0 ? void 0 : _metadata2.venue_booking_role) === 'tickets_extra')) {
4178
+ _context39.next = 31;
4034
4179
  break;
4035
4180
  }
4036
4181
  order = this.getTempOrder();
4037
4182
  meta = orderProduct.metadata;
4038
- parentUid = String(meta.venue_booking_parent_uid || '');
4039
4183
  scopeKey = String(meta.venue_booking_scope_key || '');
4040
- service = String(meta.venue_booking_service_datetime || '');
4041
- identity = [order === null || order === void 0 ? void 0 : order.order_id, order === null || order === void 0 ? void 0 : order.external_sale_number];
4184
+ purchaseDatetime = String(meta.venue_booking_service_datetime || '');
4185
+ identity = [order === null || order === void 0 ? void 0 : order.order_id, order === null || order === void 0 ? void 0 : order.external_sale_number, order === null || order === void 0 ? void 0 : order.customer_id];
4042
4186
  isCurrentOrder = function isCurrentOrder() {
4043
- return _this10.getTempOrder() === order && (order === null || order === void 0 ? void 0 : order.order_id) === identity[0] && (order === null || order === void 0 ? void 0 : order.external_sale_number) === identity[1];
4187
+ return _this12.getTempOrder() === order && (order === null || order === void 0 ? void 0 : order.order_id) === identity[0] && (order === null || order === void 0 ? void 0 : order.external_sale_number) === identity[1] && (order === null || order === void 0 ? void 0 : order.customer_id) === identity[2];
4044
4188
  };
4045
4189
  guard = function guard() {
4046
- var _params$availabilityC, _parent$metadata, _parent$metadata2, _parent$metadata3;
4190
+ var _params$availabilityC;
4047
4191
  (_params$availabilityC = params.availabilityCommitGuard) === null || _params$availabilityC === void 0 || _params$availabilityC.call(params);
4048
- var parent = ((order === null || order === void 0 ? void 0 : order.products) || []).find(function (line) {
4049
- return getProductLineUid(line) === parentUid;
4050
- });
4051
- var parentService = String((parent === null || parent === void 0 || (_parent$metadata = parent.metadata) === null || _parent$metadata === void 0 ? void 0 : _parent$metadata.venue_booking_service_datetime) || '');
4052
- if (!isCurrentOrder() || !order || order.order_id || !parentUid || !scopeKey || (parent === null || parent === void 0 || (_parent$metadata2 = parent.metadata) === null || _parent$metadata2 === void 0 ? void 0 : _parent$metadata2.venue_booking_role) !== 'party_main' || (parent === null || parent === void 0 || (_parent$metadata3 = parent.metadata) === null || _parent$metadata3 === void 0 ? void 0 : _parent$metadata3.venue_booking_scope_key) !== scopeKey || !service || !parentService || !dayjs(service).isValid() || !dayjs(parentService).isValid() || dayjs(service).format('YYYY-MM-DD HH:mm:ss') !== dayjs(parentService).format('YYYY-MM-DD HH:mm:ss')) throw _this10.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'Party 主商品或服务时间已变化,请重新确认附加商品');
4192
+ if (!isCurrentOrder() || !order || order.order_id || !scopeKey || meta.venue_booking_parent_uid || orderProduct.booking_uid || meta.booking_uid || !/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?$/.test(purchaseDatetime) || !dayjs(purchaseDatetime).isValid() || !(order.products || []).some(function (line) {
4193
+ var _line$metadata, _line$metadata2;
4194
+ return ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata.venue_booking_role) === 'tickets' && ((_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.venue_booking_scope_key) === scopeKey;
4195
+ })) {
4196
+ throw _this12.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '门票订单或购买时间已变化,请重新确认附加商品');
4197
+ }
4053
4198
  };
4054
4199
  guard();
4200
+ // Retail extras are order-owned, with their own UID and no Holder/booking.
4055
4201
  delete orderProduct.unique_identification_number;
4056
- delete orderProduct.metadata.unique_identification_number;
4057
- return _context38.abrupt("return", this.addProductToOrder(orderProduct, undefined, {
4202
+ delete meta.unique_identification_number;
4203
+ delete meta.venue_booking_parent_uid;
4204
+ orderProduct.holder_config = {
4205
+ status: 'disable',
4206
+ required: 0
4207
+ };
4208
+ meta.holder_config = {
4209
+ status: 'disable',
4210
+ required: 0
4211
+ };
4212
+ return _context39.abrupt("return", this.addProductToOrder(orderProduct, undefined, {
4058
4213
  disableMerge: true,
4059
4214
  availabilityCommitGuard: guard,
4060
4215
  availabilityCommitTargetGuard: isCurrentOrder,
4061
4216
  salesNotes: params.salesNotes
4062
4217
  }));
4063
- case 29:
4064
- return _context38.abrupt("return", this.addProductToOrder(orderProduct, undefined, _objectSpread(_objectSpread({}, params.availabilityCommitGuard ? {
4218
+ case 31:
4219
+ if (!(((_metadata3 = orderProduct.metadata) === null || _metadata3 === void 0 ? void 0 : _metadata3.venue_booking_role) === 'party_extra')) {
4220
+ _context39.next = 47;
4221
+ break;
4222
+ }
4223
+ _order = this.getTempOrder();
4224
+ _meta = orderProduct.metadata;
4225
+ parentUid = String(_meta.venue_booking_parent_uid || '');
4226
+ _scopeKey = String(_meta.venue_booking_scope_key || ''); // The persisted legacy key holds this retail extra's venue-local purchase quote time.
4227
+ // Its parent UID owns the extra; the parent's appointment time does not price it.
4228
+ _purchaseDatetime = String(_meta.venue_booking_service_datetime || '');
4229
+ normalizedPurchaseDatetime = _purchaseDatetime.length === 16 ? "".concat(_purchaseDatetime, ":00") : _purchaseDatetime;
4230
+ _identity = [_order === null || _order === void 0 ? void 0 : _order.order_id, _order === null || _order === void 0 ? void 0 : _order.external_sale_number];
4231
+ _isCurrentOrder = function _isCurrentOrder() {
4232
+ return _this12.getTempOrder() === _order && (_order === null || _order === void 0 ? void 0 : _order.order_id) === _identity[0] && (_order === null || _order === void 0 ? void 0 : _order.external_sale_number) === _identity[1];
4233
+ };
4234
+ _guard = function _guard() {
4235
+ var _params$availabilityC2, _parent$metadata, _parent$metadata2;
4236
+ (_params$availabilityC2 = params.availabilityCommitGuard) === null || _params$availabilityC2 === void 0 || _params$availabilityC2.call(params);
4237
+ var parent = ((_order === null || _order === void 0 ? void 0 : _order.products) || []).find(function (line) {
4238
+ return getProductLineUid(line) === parentUid;
4239
+ });
4240
+ if (!_isCurrentOrder() || !_order || _order.order_id || !parentUid || !_scopeKey || (parent === null || parent === void 0 || (_parent$metadata = parent.metadata) === null || _parent$metadata === void 0 ? void 0 : _parent$metadata.venue_booking_role) !== 'party_main' || (parent === null || parent === void 0 || (_parent$metadata2 = parent.metadata) === null || _parent$metadata2 === void 0 ? void 0 : _parent$metadata2.venue_booking_scope_key) !== _scopeKey || !/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?$/.test(_purchaseDatetime) || !dayjs(_purchaseDatetime).isValid() || dayjs(_purchaseDatetime).format('YYYY-MM-DD HH:mm:ss') !== normalizedPurchaseDatetime) throw _this12.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'Party 主商品或附加商品报价上下文已变化,请重新确认附加商品');
4241
+ };
4242
+ _guard();
4243
+ delete orderProduct.unique_identification_number;
4244
+ delete orderProduct.metadata.unique_identification_number;
4245
+ orderProduct.holder_config = {
4246
+ status: 'disable',
4247
+ required: 0
4248
+ };
4249
+ orderProduct.metadata.holder_config = {
4250
+ status: 'disable',
4251
+ required: 0
4252
+ };
4253
+ return _context39.abrupt("return", this.addProductToOrder(orderProduct, undefined, {
4254
+ disableMerge: true,
4255
+ availabilityCommitGuard: _guard,
4256
+ availabilityCommitTargetGuard: _isCurrentOrder,
4257
+ salesNotes: params.salesNotes
4258
+ }));
4259
+ case 47:
4260
+ return _context39.abrupt("return", this.addProductToOrder(orderProduct, undefined, _objectSpread(_objectSpread({}, params.availabilityCommitGuard ? {
4065
4261
  availabilityCommitGuard: params.availabilityCommitGuard
4066
4262
  } : {}), params.salesNotes ? {
4067
4263
  salesNotes: params.salesNotes
4068
4264
  } : {})));
4069
- case 30:
4265
+ case 48:
4070
4266
  case "end":
4071
- return _context38.stop();
4267
+ return _context39.stop();
4072
4268
  }
4073
- }, _callee38, this);
4269
+ }, _callee39, this);
4074
4270
  }));
4075
- function addRetailProduct(_x23) {
4271
+ function addRetailProduct(_x25) {
4076
4272
  return _addRetailProduct.apply(this, arguments);
4077
4273
  }
4078
4274
  return addRetailProduct;
@@ -4172,7 +4368,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4172
4368
  }, {
4173
4369
  key: "buildAvailabilityOperatingHoursSnapshot",
4174
4370
  value: function buildAvailabilityOperatingHoursSnapshot(params) {
4175
- var _this11 = this;
4371
+ var _this13 = this;
4176
4372
  var descriptor = params.prepare._availabilityOperatingHours || {
4177
4373
  source: params.prepare.businessHours ? 'prepare_business_hours' : 'default_business_hours',
4178
4374
  scheduleIds: []
@@ -4182,7 +4378,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4182
4378
  var range = normalizeAvailabilityLocalDateTimeRange({
4183
4379
  startAt: "".concat(date, "T").concat(params.businessHours.startTime, ":00"),
4184
4380
  endAt: "".concat(date, "T").concat(params.businessHours.endTime, ":00"),
4185
- fixedOffsetMinutes: _this11.getAvailabilityRuntimeOffsetMinutes(),
4381
+ fixedOffsetMinutes: _this13.getAvailabilityRuntimeOffsetMinutes(),
4186
4382
  rollOverEnd: true
4187
4383
  });
4188
4384
  return range ? [{
@@ -4217,7 +4413,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4217
4413
  var range = normalizeAvailabilityLocalDateTimeRange({
4218
4414
  startAt: slot.start_at,
4219
4415
  endAt: slot.end_at,
4220
- fixedOffsetMinutes: _this11.getAvailabilityRuntimeOffsetMinutes(),
4416
+ fixedOffsetMinutes: _this13.getAvailabilityRuntimeOffsetMinutes(),
4221
4417
  rollOverEnd: true
4222
4418
  });
4223
4419
  return range ? [{
@@ -4233,7 +4429,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4233
4429
  var range = normalizeAvailabilityLocalDateTimeRange({
4234
4430
  startAt: slot.start_at,
4235
4431
  endAt: slot.end_at,
4236
- fixedOffsetMinutes: _this11.getAvailabilityRuntimeOffsetMinutes(),
4432
+ fixedOffsetMinutes: _this13.getAvailabilityRuntimeOffsetMinutes(),
4237
4433
  rollOverEnd: true
4238
4434
  });
4239
4435
  return range ? [{
@@ -4260,51 +4456,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4260
4456
  }, {
4261
4457
  key: "loadAvailabilityProducts",
4262
4458
  value: function () {
4263
- var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
4264
- var _this12 = this,
4459
+ var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
4460
+ var _this14 = this,
4265
4461
  _prepare$catalogScope3,
4266
4462
  _prepare$catalogScope4,
4267
4463
  _prepare$resourceIds;
4268
4464
  var prepare, dateRange, explicitProductIds, publishCatalog, loadProducts, rawProducts, _prepare$catalogScope2, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
4269
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4270
- while (1) switch (_context39.prev = _context39.next) {
4465
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4466
+ while (1) switch (_context40.prev = _context40.next) {
4271
4467
  case 0:
4272
4468
  prepare = params.prepare, dateRange = params.dateRange;
4273
4469
  explicitProductIds = prepare.productIds || [];
4274
4470
  publishCatalog = prepare.publishCatalog !== false;
4275
4471
  loadProducts = function loadProducts(query) {
4276
4472
  var _prepare$catalogScope;
4277
- return publishCatalog ? _this12.loadProducts(query) : ((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'productList' ? _this12.queryCatalogSnapshot(query) : _this12.loadCatalogProducts(query);
4473
+ return publishCatalog ? _this14.loadProducts(query) : ((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'productList' ? _this14.queryCatalogSnapshot(query) : _this14.loadCatalogProducts(query);
4278
4474
  };
4279
4475
  rawProducts = [];
4280
4476
  if (!Array.isArray(prepare.rawProducts)) {
4281
- _context39.next = 10;
4477
+ _context40.next = 10;
4282
4478
  break;
4283
4479
  }
4284
4480
  rawProducts = prepare.rawProducts;
4285
4481
  if (publishCatalog) this.unifiedProductCatalog = _toConsumableArray(rawProducts);
4286
- _context39.next = 36;
4482
+ _context40.next = 36;
4287
4483
  break;
4288
4484
  case 10:
4289
4485
  if (!(explicitProductIds.length > 0)) {
4290
- _context39.next = 16;
4486
+ _context40.next = 16;
4291
4487
  break;
4292
4488
  }
4293
- _context39.next = 13;
4489
+ _context40.next = 13;
4294
4490
  return loadProducts(_objectSpread(_objectSpread({}, !publishCatalog && ((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList' ? prepare.catalogScope.params : {}), {}, {
4295
4491
  product_ids: explicitProductIds,
4296
4492
  schedule_date: dateRange.startDate
4297
4493
  }));
4298
4494
  case 13:
4299
- rawProducts = _context39.sent;
4300
- _context39.next = 36;
4495
+ rawProducts = _context40.sent;
4496
+ _context40.next = 36;
4301
4497
  break;
4302
4498
  case 16:
4303
4499
  if (!(((_prepare$catalogScope3 = prepare.catalogScope) === null || _prepare$catalogScope3 === void 0 ? void 0 : _prepare$catalogScope3.type) === 'schedule')) {
4304
- _context39.next = 32;
4500
+ _context40.next = 32;
4305
4501
  break;
4306
4502
  }
4307
- _context39.next = 19;
4503
+ _context40.next = 19;
4308
4504
  return this.loadScheduleAvailableDate({
4309
4505
  startDate: dateRange.startDate,
4310
4506
  endDate: dateRange.endDate,
@@ -4320,44 +4516,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4320
4516
  });
4321
4517
  productIds = uniqueAvailabilityIds([].concat(_toConsumableArray(scheduleProductIds), _toConsumableArray(((_this$store$schedule$7 = (_this$store$schedule7 = this.store.schedule).getOtherProductsIds) === null || _this$store$schedule$7 === void 0 ? void 0 : _this$store$schedule$7.call(_this$store$schedule7)) || [])));
4322
4518
  if (!(productIds.length > 0)) {
4323
- _context39.next = 29;
4519
+ _context40.next = 29;
4324
4520
  break;
4325
4521
  }
4326
4522
  assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
4327
- _context39.next = 26;
4523
+ _context40.next = 26;
4328
4524
  return loadProducts({
4329
4525
  product_ids: productIds,
4330
4526
  schedule_date: dateRange.startDate
4331
4527
  });
4332
4528
  case 26:
4333
- rawProducts = _context39.sent;
4334
- _context39.next = 30;
4529
+ rawProducts = _context40.sent;
4530
+ _context40.next = 30;
4335
4531
  break;
4336
4532
  case 29:
4337
4533
  if (publishCatalog) this.unifiedProductCatalog = [];
4338
4534
  case 30:
4339
- _context39.next = 36;
4535
+ _context40.next = 36;
4340
4536
  break;
4341
4537
  case 32:
4342
4538
  if (!(((_prepare$catalogScope4 = prepare.catalogScope) === null || _prepare$catalogScope4 === void 0 ? void 0 : _prepare$catalogScope4.type) === 'productList')) {
4343
- _context39.next = 36;
4539
+ _context40.next = 36;
4344
4540
  break;
4345
4541
  }
4346
- _context39.next = 35;
4542
+ _context40.next = 35;
4347
4543
  return loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
4348
4544
  schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
4349
4545
  }));
4350
4546
  case 35:
4351
- rawProducts = _context39.sent;
4547
+ rawProducts = _context40.sent;
4352
4548
  case 36:
4353
4549
  normalized = rawProducts.map(function (product) {
4354
- return normalizeProductForAvailability(product, params.scheduleList, _this12.getAvailabilityRuntimeOffsetMinutes());
4550
+ return normalizeProductForAvailability(product, params.scheduleList, _this14.getAvailabilityRuntimeOffsetMinutes());
4355
4551
  });
4356
4552
  if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
4357
- _context39.next = 39;
4553
+ _context40.next = 39;
4358
4554
  break;
4359
4555
  }
4360
- return _context39.abrupt("return", normalized.filter(function (product) {
4556
+ return _context40.abrupt("return", normalized.filter(function (product) {
4361
4557
  var _product$requirementG2;
4362
4558
  return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
4363
4559
  var _group$resourceIds3;
@@ -4370,16 +4566,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4370
4566
  }));
4371
4567
  case 39:
4372
4568
  productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
4373
- return _context39.abrupt("return", productIdSet ? normalized.filter(function (product) {
4569
+ return _context40.abrupt("return", productIdSet ? normalized.filter(function (product) {
4374
4570
  return productIdSet.has(String(product.id));
4375
4571
  }) : normalized);
4376
4572
  case 41:
4377
4573
  case "end":
4378
- return _context39.stop();
4574
+ return _context40.stop();
4379
4575
  }
4380
- }, _callee39, this);
4576
+ }, _callee40, this);
4381
4577
  }));
4382
- function loadAvailabilityProducts(_x24) {
4578
+ function loadAvailabilityProducts(_x26) {
4383
4579
  return _loadAvailabilityProducts.apply(this, arguments);
4384
4580
  }
4385
4581
  return loadAvailabilityProducts;
@@ -4392,12 +4588,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4392
4588
  }, {
4393
4589
  key: "fetchAvailabilityResourcesV2",
4394
4590
  value: (function () {
4395
- var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
4396
- var response, data;
4397
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4398
- while (1) switch (_context40.prev = _context40.next) {
4591
+ var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
4592
+ var response, data, message;
4593
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4594
+ while (1) switch (_context41.prev = _context41.next) {
4399
4595
  case 0:
4400
- _context40.next = 2;
4596
+ _context41.next = 2;
4401
4597
  return this.request.get('/schedule/resource/list/v2', {
4402
4598
  start_date: params.dateRange.startDate,
4403
4599
  end_date: params.dateRange.endDate,
@@ -4407,46 +4603,144 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4407
4603
  useCache: false
4408
4604
  });
4409
4605
  case 2:
4410
- response = _context40.sent;
4606
+ response = _context41.sent;
4411
4607
  data = response === null || response === void 0 ? void 0 : response.data;
4608
+ if (!(params.strictResponse && (response === null || response === void 0 ? void 0 : response.status) === false)) {
4609
+ _context41.next = 7;
4610
+ break;
4611
+ }
4612
+ message = response === null || response === void 0 ? void 0 : response.message;
4613
+ throw Object.assign(new Error(typeof message === 'string' && message.trim() ? message : 'Unable to load booking resource details.'), {
4614
+ code: response === null || response === void 0 ? void 0 : response.code
4615
+ });
4616
+ case 7:
4412
4617
  if (!Array.isArray(data)) {
4413
- _context40.next = 6;
4618
+ _context41.next = 9;
4414
4619
  break;
4415
4620
  }
4416
- return _context40.abrupt("return", data);
4417
- case 6:
4621
+ return _context41.abrupt("return", data);
4622
+ case 9:
4418
4623
  if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
4419
- _context40.next = 8;
4624
+ _context41.next = 11;
4420
4625
  break;
4421
4626
  }
4422
- return _context40.abrupt("return", data.list);
4423
- case 8:
4424
- return _context40.abrupt("return", []);
4425
- case 9:
4627
+ return _context41.abrupt("return", data.list);
4628
+ case 11:
4629
+ if (!params.strictResponse) {
4630
+ _context41.next = 13;
4631
+ break;
4632
+ }
4633
+ throw new Error('Booking resource details returned an invalid response.');
4634
+ case 13:
4635
+ return _context41.abrupt("return", []);
4636
+ case 14:
4426
4637
  case "end":
4427
- return _context40.stop();
4638
+ return _context41.stop();
4428
4639
  }
4429
- }, _callee40, this);
4640
+ }, _callee41, this);
4430
4641
  }));
4431
- function fetchAvailabilityResourcesV2(_x25) {
4642
+ function fetchAvailabilityResourcesV2(_x27) {
4432
4643
  return _fetchAvailabilityResourcesV.apply(this, arguments);
4433
4644
  }
4434
4645
  return fetchAvailabilityResourcesV2;
4646
+ }() /** Fresh read-only metadata for confirmation forms/policies; does not create a projection or mutate BookingContext. */)
4647
+ }, {
4648
+ key: "queryBookingResourceDetails",
4649
+ value: (function () {
4650
+ var _queryBookingResourceDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
4651
+ var _this15 = this;
4652
+ var date, resourceIds, core, request, generation, scope, assertCurrent, resources, byId;
4653
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4654
+ while (1) switch (_context42.prev = _context42.next) {
4655
+ case 0:
4656
+ date = params === null || params === void 0 ? void 0 : params.date;
4657
+ _context42.prev = 1;
4658
+ if (!(typeof date !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(date))) {
4659
+ _context42.next = 4;
4660
+ break;
4661
+ }
4662
+ throw new Error('date');
4663
+ case 4:
4664
+ parseLocalDate(date);
4665
+ _context42.next = 10;
4666
+ break;
4667
+ case 7:
4668
+ _context42.prev = 7;
4669
+ _context42.t0 = _context42["catch"](1);
4670
+ throw this.createAvailabilityFacadeError('INVALID_DATE_RANGE', 'A valid booking date is required to load resource details.');
4671
+ case 10:
4672
+ if (!(!Array.isArray(params === null || params === void 0 ? void 0 : params.resourceIds) || !params.resourceIds.length || params.resourceIds.some(function (id) {
4673
+ return !['number', 'string'].includes(_typeof(id)) || !/^\d+$/.test(String(id)) || !Number.isSafeInteger(Number(id)) || Number(id) <= 0;
4674
+ }))) {
4675
+ _context42.next = 12;
4676
+ break;
4677
+ }
4678
+ throw this.createAvailabilityFacadeError('INVALID_TARGET_FILTER', 'Selected resource IDs are required to load resource details.');
4679
+ case 12:
4680
+ resourceIds = _toConsumableArray(new Set(params.resourceIds.map(function (id) {
4681
+ return String(Number(id));
4682
+ })));
4683
+ core = this.core;
4684
+ request = this.request;
4685
+ generation = this.runtimeInitializationGeneration;
4686
+ scope = this.getRuntimeOpenDataScope();
4687
+ assertCurrent = function assertCurrent() {
4688
+ if (_this15.runtimeOpenDataDestroyed || !request || core !== _this15.core || request !== _this15.request || generation !== _this15.runtimeInitializationGeneration || scope !== _this15.getRuntimeOpenDataScope()) {
4689
+ throw _this15.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'Booking settings changed. Please reload the resource details.');
4690
+ }
4691
+ };
4692
+ assertCurrent();
4693
+ _context42.next = 21;
4694
+ return this.fetchAvailabilityResourcesV2({
4695
+ dateRange: {
4696
+ startDate: date,
4697
+ endDate: date
4698
+ },
4699
+ resourceIds: resourceIds,
4700
+ strictResponse: true
4701
+ });
4702
+ case 21:
4703
+ resources = _context42.sent;
4704
+ assertCurrent();
4705
+ byId = new Map(resources.filter(isRecord).map(function (resource) {
4706
+ return [String(resource.id), resource];
4707
+ }));
4708
+ if (!resourceIds.some(function (id) {
4709
+ return !byId.has(id);
4710
+ })) {
4711
+ _context42.next = 26;
4712
+ break;
4713
+ }
4714
+ throw this.createAvailabilityFacadeError('INVALID_TARGET_FILTER', 'A selected booking resource is no longer available.');
4715
+ case 26:
4716
+ return _context42.abrupt("return", cloneDeep(resourceIds.map(function (id) {
4717
+ return byId.get(id);
4718
+ })));
4719
+ case 27:
4720
+ case "end":
4721
+ return _context42.stop();
4722
+ }
4723
+ }, _callee42, this, [[1, 7]]);
4724
+ }));
4725
+ function queryBookingResourceDetails(_x28) {
4726
+ return _queryBookingResourceDetails.apply(this, arguments);
4727
+ }
4728
+ return queryBookingResourceDetails;
4435
4729
  }())
4436
4730
  }, {
4437
4731
  key: "fetchAndPublishAvailabilityResourcesV2",
4438
4732
  value: function () {
4439
- var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
4733
+ var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
4440
4734
  var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
4441
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4442
- while (1) switch (_context41.prev = _context41.next) {
4735
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4736
+ while (1) switch (_context43.prev = _context43.next) {
4443
4737
  case 0:
4444
4738
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
4445
4739
  if (!(normalizedResourceIds.length === 0)) {
4446
- _context41.next = 3;
4740
+ _context43.next = 3;
4447
4741
  break;
4448
4742
  }
4449
- return _context41.abrupt("return", []);
4743
+ return _context43.abrupt("return", []);
4450
4744
  case 3:
4451
4745
  scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
4452
4746
  cacheParams = {
@@ -4456,7 +4750,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4456
4750
  };
4457
4751
  cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
4458
4752
  if (!cachedRawResources) {
4459
- _context41.next = 9;
4753
+ _context43.next = 9;
4460
4754
  break;
4461
4755
  }
4462
4756
  if (params.useCacheOnHit) {
@@ -4468,23 +4762,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4468
4762
  console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
4469
4763
  });
4470
4764
  }
4471
- return _context41.abrupt("return", cachedRawResources);
4765
+ return _context43.abrupt("return", cachedRawResources);
4472
4766
  case 9:
4473
- _context41.next = 11;
4767
+ _context43.next = 11;
4474
4768
  return this.refreshAvailabilityRemoteResourceQuery({
4475
4769
  timezone: params.timezone,
4476
4770
  dateRange: params.dateRange,
4477
4771
  resourceIds: normalizedResourceIds
4478
4772
  });
4479
4773
  case 11:
4480
- return _context41.abrupt("return", _context41.sent);
4774
+ return _context43.abrupt("return", _context43.sent);
4481
4775
  case 12:
4482
4776
  case "end":
4483
- return _context41.stop();
4777
+ return _context43.stop();
4484
4778
  }
4485
- }, _callee41, this);
4779
+ }, _callee43, this);
4486
4780
  }));
4487
- function fetchAndPublishAvailabilityResourcesV2(_x26) {
4781
+ function fetchAndPublishAvailabilityResourcesV2(_x29) {
4488
4782
  return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
4489
4783
  }
4490
4784
  return fetchAndPublishAvailabilityResourcesV2;
@@ -4492,17 +4786,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4492
4786
  }, {
4493
4787
  key: "refreshAvailabilityRemoteResourceQuery",
4494
4788
  value: function () {
4495
- var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
4789
+ var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
4496
4790
  var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
4497
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4498
- while (1) switch (_context42.prev = _context42.next) {
4791
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4792
+ while (1) switch (_context44.prev = _context44.next) {
4499
4793
  case 0:
4500
4794
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
4501
4795
  if (!(normalizedResourceIds.length === 0)) {
4502
- _context42.next = 3;
4796
+ _context44.next = 3;
4503
4797
  break;
4504
4798
  }
4505
- return _context42.abrupt("return", []);
4799
+ return _context44.abrupt("return", []);
4506
4800
  case 3:
4507
4801
  queryKey = this.buildAvailabilityRemoteResourceQueryKey({
4508
4802
  timezone: params.timezone,
@@ -4512,13 +4806,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4512
4806
  epoch = this.availabilityRemoteResourceEpoch;
4513
4807
  existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
4514
4808
  if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
4515
- _context42.next = 10;
4809
+ _context44.next = 10;
4516
4810
  break;
4517
4811
  }
4518
- _context42.next = 9;
4812
+ _context44.next = 9;
4519
4813
  return existing.promise;
4520
4814
  case 9:
4521
- return _context42.abrupt("return", _context42.sent);
4815
+ return _context44.abrupt("return", _context44.sent);
4522
4816
  case 10:
4523
4817
  this.availabilityRemoteResourceQuerySequence += 1;
4524
4818
  writeVersion = this.availabilityRemoteResourceQuerySequence;
@@ -4530,11 +4824,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4530
4824
  epoch: epoch,
4531
4825
  promise: promise
4532
4826
  });
4533
- _context42.prev = 14;
4534
- _context42.next = 17;
4827
+ _context44.prev = 14;
4828
+ _context44.next = 17;
4535
4829
  return promise;
4536
4830
  case 17:
4537
- rawResources = _context42.sent;
4831
+ rawResources = _context44.sent;
4538
4832
  if (epoch === this.availabilityRemoteResourceEpoch) {
4539
4833
  this.availabilityRemoteOccupancyCache.publish({
4540
4834
  scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
@@ -4545,21 +4839,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4545
4839
  version: writeVersion
4546
4840
  });
4547
4841
  }
4548
- return _context42.abrupt("return", rawResources);
4842
+ return _context44.abrupt("return", rawResources);
4549
4843
  case 20:
4550
- _context42.prev = 20;
4844
+ _context44.prev = 20;
4551
4845
  current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
4552
4846
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
4553
4847
  this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
4554
4848
  }
4555
- return _context42.finish(20);
4849
+ return _context44.finish(20);
4556
4850
  case 24:
4557
4851
  case "end":
4558
- return _context42.stop();
4852
+ return _context44.stop();
4559
4853
  }
4560
- }, _callee42, this, [[14,, 20, 24]]);
4854
+ }, _callee44, this, [[14,, 20, 24]]);
4561
4855
  }));
4562
- function refreshAvailabilityRemoteResourceQuery(_x27) {
4856
+ function refreshAvailabilityRemoteResourceQuery(_x30) {
4563
4857
  return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
4564
4858
  }
4565
4859
  return refreshAvailabilityRemoteResourceQuery;
@@ -4567,26 +4861,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4567
4861
  }, {
4568
4862
  key: "loadAvailabilityResources",
4569
4863
  value: function () {
4570
- var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
4864
+ var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
4571
4865
  var resourceIds, cachedRawResources, remoteQuery, rawResources;
4572
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4573
- while (1) switch (_context43.prev = _context43.next) {
4866
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4867
+ while (1) switch (_context45.prev = _context45.next) {
4574
4868
  case 0:
4575
4869
  resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
4576
4870
  if (!(resourceIds.length === 0)) {
4577
- _context43.next = 3;
4871
+ _context45.next = 3;
4578
4872
  break;
4579
4873
  }
4580
- return _context43.abrupt("return", {
4874
+ return _context45.abrupt("return", {
4581
4875
  resources: [],
4582
4876
  resourceOccupancies: []
4583
4877
  });
4584
4878
  case 3:
4585
4879
  if (!(Array.isArray(params.rawResources) && params.fetchPolicy !== 'refresh')) {
4586
- _context43.next = 5;
4880
+ _context45.next = 5;
4587
4881
  break;
4588
4882
  }
4589
- return _context43.abrupt("return", buildAvailabilityResourcesFromV2({
4883
+ return _context45.abrupt("return", buildAvailabilityResourcesFromV2({
4590
4884
  rawResources: params.rawResources,
4591
4885
  scheduleList: params.scheduleList,
4592
4886
  dateRange: params.dateRange,
@@ -4594,7 +4888,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4594
4888
  }));
4595
4889
  case 5:
4596
4890
  if (!(params.fetchPolicy === 'cache_only')) {
4597
- _context43.next = 10;
4891
+ _context45.next = 10;
4598
4892
  break;
4599
4893
  }
4600
4894
  cachedRawResources = this.availabilityRemoteOccupancyCache.read({
@@ -4603,17 +4897,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4603
4897
  dateRange: params.dateRange
4604
4898
  });
4605
4899
  if (!cachedRawResources) {
4606
- _context43.next = 9;
4900
+ _context45.next = 9;
4607
4901
  break;
4608
4902
  }
4609
- return _context43.abrupt("return", buildAvailabilityResourcesFromV2({
4903
+ return _context45.abrupt("return", buildAvailabilityResourcesFromV2({
4610
4904
  rawResources: cachedRawResources,
4611
4905
  scheduleList: params.scheduleList,
4612
4906
  dateRange: params.dateRange,
4613
4907
  fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
4614
4908
  }));
4615
4909
  case 9:
4616
- return _context43.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
4910
+ return _context45.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
4617
4911
  resources: [],
4618
4912
  resourceOccupancies: []
4619
4913
  });
@@ -4624,25 +4918,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4624
4918
  resourceIds: resourceIds
4625
4919
  };
4626
4920
  if (!(params.fetchPolicy === 'refresh')) {
4627
- _context43.next = 17;
4921
+ _context45.next = 17;
4628
4922
  break;
4629
4923
  }
4630
- _context43.next = 14;
4924
+ _context45.next = 14;
4631
4925
  return this.refreshAvailabilityRemoteResourceQuery(remoteQuery);
4632
4926
  case 14:
4633
- _context43.t0 = _context43.sent;
4634
- _context43.next = 20;
4927
+ _context45.t0 = _context45.sent;
4928
+ _context45.next = 20;
4635
4929
  break;
4636
4930
  case 17:
4637
- _context43.next = 19;
4931
+ _context45.next = 19;
4638
4932
  return this.fetchAndPublishAvailabilityResourcesV2(_objectSpread(_objectSpread({}, remoteQuery), {}, {
4639
4933
  useCacheOnHit: true
4640
4934
  }));
4641
4935
  case 19:
4642
- _context43.t0 = _context43.sent;
4936
+ _context45.t0 = _context45.sent;
4643
4937
  case 20:
4644
- rawResources = _context43.t0;
4645
- return _context43.abrupt("return", buildAvailabilityResourcesFromV2({
4938
+ rawResources = _context45.t0;
4939
+ return _context45.abrupt("return", buildAvailabilityResourcesFromV2({
4646
4940
  rawResources: rawResources,
4647
4941
  scheduleList: params.scheduleList,
4648
4942
  dateRange: params.dateRange,
@@ -4650,11 +4944,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4650
4944
  }));
4651
4945
  case 22:
4652
4946
  case "end":
4653
- return _context43.stop();
4947
+ return _context45.stop();
4654
4948
  }
4655
- }, _callee43, this);
4949
+ }, _callee45, this);
4656
4950
  }));
4657
- function loadAvailabilityResources(_x28) {
4951
+ function loadAvailabilityResources(_x31) {
4658
4952
  return _loadAvailabilityResources.apply(this, arguments);
4659
4953
  }
4660
4954
  return loadAvailabilityResources;
@@ -4674,7 +4968,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4674
4968
  var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
4675
4969
  var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
4676
4970
  productLineUids.forEach(function (requestedUid) {
4677
- var _ref48, _product$booking_uid2, _product$metadata6;
4971
+ var _ref50, _product$booking_uid2, _product$metadata6;
4678
4972
  var product = products.find(function (line) {
4679
4973
  return getProductLineUid(line) === String(requestedUid);
4680
4974
  });
@@ -4684,7 +4978,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4684
4978
  });
4685
4979
  }
4686
4980
  var productUid = getProductLineUid(product);
4687
- var linkedBookingUid = String((_ref48 = (_product$booking_uid2 = product.booking_uid) !== null && _product$booking_uid2 !== void 0 ? _product$booking_uid2 : (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid) !== null && _ref48 !== void 0 ? _ref48 : '');
4981
+ var linkedBookingUid = String((_ref50 = (_product$booking_uid2 = product.booking_uid) !== null && _product$booking_uid2 !== void 0 ? _product$booking_uid2 : (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid) !== null && _ref50 !== void 0 ? _ref50 : '');
4688
4982
  var linkedBookings = bookings.filter(function (booking) {
4689
4983
  var _booking$product_uid;
4690
4984
  return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
@@ -4727,24 +5021,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4727
5021
  }, {
4728
5022
  key: "collectCartResourceOccupancies",
4729
5023
  value: function collectCartResourceOccupancies(tempOrder, exclusions) {
4730
- var _this13 = this;
5024
+ var _this16 = this;
4731
5025
  var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
4732
5026
  return bookings.flatMap(function (booking) {
4733
- var _ref49, _booking$product_uid2, _booking$metadata2;
5027
+ var _ref51, _booking$product_uid2, _booking$metadata2;
4734
5028
  var bookingUid = getBookingUid(booking);
4735
- var productUid = String((_ref49 = (_booking$product_uid2 = booking.product_uid) !== null && _booking$product_uid2 !== void 0 ? _booking$product_uid2 : (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid) !== null && _ref49 !== void 0 ? _ref49 : '');
5029
+ var productUid = String((_ref51 = (_booking$product_uid2 = booking.product_uid) !== null && _booking$product_uid2 !== void 0 ? _booking$product_uid2 : (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid) !== null && _ref51 !== void 0 ? _ref51 : '');
4736
5030
  var scheduleEventId = toNumberId(booking.schedule_event_id);
4737
5031
  var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
4738
5032
  var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
4739
5033
  var resources = Array.isArray(booking.resources) ? booking.resources : [];
4740
5034
  return resources.flatMap(function (resource) {
4741
- var _ref50, _resource$resource_id, _ref51, _resource$capacity;
4742
- var resourceId = (_ref50 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref50 !== void 0 ? _ref50 : resource.id;
5035
+ var _ref52, _resource$resource_id, _ref53, _resource$capacity;
5036
+ var resourceId = (_ref52 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref52 !== void 0 ? _ref52 : resource.id;
4743
5037
  if (resourceId == null || !startAt || !endAt) return [];
4744
5038
  var range = normalizeAvailabilityLocalDateTimeRange({
4745
5039
  startAt: startAt,
4746
5040
  endAt: endAt,
4747
- fixedOffsetMinutes: _this13.getAvailabilityRuntimeOffsetMinutes(),
5041
+ fixedOffsetMinutes: _this16.getAvailabilityRuntimeOffsetMinutes(),
4748
5042
  rollOverEnd: false
4749
5043
  });
4750
5044
  if (!range) return [];
@@ -4752,7 +5046,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4752
5046
  resourceId: resourceId,
4753
5047
  startAt: range.startAt,
4754
5048
  endAt: range.endAt,
4755
- pax: Math.max(1, Number((_ref51 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref51 !== void 0 ? _ref51 : 1) || 1),
5049
+ pax: Math.max(1, Number((_ref53 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref53 !== void 0 ? _ref53 : 1) || 1),
4756
5050
  source: 'cart',
4757
5051
  scheduleEventId: scheduleEventId,
4758
5052
  bookingUid: bookingUid || undefined,
@@ -4762,7 +5056,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4762
5056
  resource: resource
4763
5057
  }
4764
5058
  };
4765
- return _this13.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
5059
+ return _this16.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
4766
5060
  });
4767
5061
  });
4768
5062
  }
@@ -4829,16 +5123,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4829
5123
  }, {
4830
5124
  key: "assertContextualQueryFreshness",
4831
5125
  value: function assertContextualQueryFreshness(context, request) {
4832
- var _this14 = this;
5126
+ var _this17 = this;
4833
5127
  if (request.target === 'time') {
4834
5128
  request.candidates.forEach(function (candidate) {
4835
- _this14.assertAvailabilityCandidateFreshness(context, candidate);
5129
+ _this17.assertAvailabilityCandidateFreshness(context, candidate);
4836
5130
  });
4837
5131
  return;
4838
5132
  }
4839
5133
  if (request.target === 'resource') {
4840
5134
  request.selectedRanges.forEach(function (candidate) {
4841
- _this14.assertAvailabilityCandidateFreshness(context, candidate);
5135
+ _this17.assertAvailabilityCandidateFreshness(context, candidate);
4842
5136
  });
4843
5137
  }
4844
5138
  }
@@ -4885,8 +5179,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4885
5179
  }, {
4886
5180
  key: "buildAvailabilityProjectionSnapshot",
4887
5181
  value: function () {
4888
- var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
4889
- var _this15 = this;
5182
+ var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
5183
+ var _this18 = this;
4890
5184
  var options,
4891
5185
  normalizedPrepareParams,
4892
5186
  timezoneLabel,
@@ -4907,11 +5201,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4907
5201
  durationCandidateAnchorAt,
4908
5202
  orderRevision,
4909
5203
  projection,
4910
- _args44 = arguments;
4911
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4912
- while (1) switch (_context44.prev = _context44.next) {
5204
+ _args46 = arguments;
5205
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5206
+ while (1) switch (_context46.prev = _context46.next) {
4913
5207
  case 0:
4914
- options = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {};
5208
+ options = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {};
4915
5209
  normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
4916
5210
  timezoneLabel = String(normalizedPrepareParams.timezone);
4917
5211
  dateRange = normalizedPrepareParams.dateRange;
@@ -4925,15 +5219,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4925
5219
  scheduleList: scheduleList,
4926
5220
  businessHours: businessHours
4927
5221
  });
4928
- _context44.next = 11;
5222
+ _context46.next = 11;
4929
5223
  return this.loadAvailabilityProducts({
4930
5224
  prepare: normalizedPrepareParams,
4931
5225
  dateRange: dateRange,
4932
5226
  scheduleList: scheduleList
4933
5227
  });
4934
5228
  case 11:
4935
- products = _context44.sent;
4936
- _context44.next = 14;
5229
+ products = _context46.sent;
5230
+ _context46.next = 14;
4937
5231
  return this.loadAvailabilityResources({
4938
5232
  timezone: timezoneLabel,
4939
5233
  dateRange: dateRange,
@@ -4946,14 +5240,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4946
5240
  fallbackResources: options.fallbackResources
4947
5241
  });
4948
5242
  case 14:
4949
- loadedResources = _context44.sent;
5243
+ loadedResources = _context46.sent;
4950
5244
  tempOrder = this.getTempOrder();
4951
5245
  exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
4952
5246
  injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
4953
5247
  var range = normalizeAvailabilityLocalDateTimeRange({
4954
5248
  startAt: occupancy.startAt,
4955
5249
  endAt: occupancy.endAt,
4956
- fixedOffsetMinutes: _this15.getAvailabilityRuntimeOffsetMinutes(),
5250
+ fixedOffsetMinutes: _this18.getAvailabilityRuntimeOffsetMinutes(),
4957
5251
  rollOverEnd: false
4958
5252
  });
4959
5253
  if (!range) return [];
@@ -4963,7 +5257,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4963
5257
  })];
4964
5258
  });
4965
5259
  remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
4966
- return !_this15.occupancyIsExcluded(occupancy, exclusions);
5260
+ return !_this18.occupancyIsExcluded(occupancy, exclusions);
4967
5261
  });
4968
5262
  cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
4969
5263
  preparedAt = this.getAvailabilityRuntimeDateTime();
@@ -4992,18 +5286,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4992
5286
  prepareParams: normalizedPrepareParams,
4993
5287
  durationCandidateAnchorAt: durationCandidateAnchorAt
4994
5288
  });
4995
- return _context44.abrupt("return", {
5289
+ return _context46.abrupt("return", {
4996
5290
  projection: projection,
4997
5291
  prepareParams: normalizedPrepareParams,
4998
5292
  orderRevision: orderRevision
4999
5293
  });
5000
5294
  case 26:
5001
5295
  case "end":
5002
- return _context44.stop();
5296
+ return _context46.stop();
5003
5297
  }
5004
- }, _callee44, this);
5298
+ }, _callee46, this);
5005
5299
  }));
5006
- function buildAvailabilityProjectionSnapshot(_x29) {
5300
+ function buildAvailabilityProjectionSnapshot(_x32) {
5007
5301
  return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
5008
5302
  }
5009
5303
  return buildAvailabilityProjectionSnapshot;
@@ -5011,10 +5305,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5011
5305
  }, {
5012
5306
  key: "getSharedPreparedAvailabilitySnapshot",
5013
5307
  value: function () {
5014
- var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
5308
+ var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
5015
5309
  var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
5016
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5017
- while (1) switch (_context45.prev = _context45.next) {
5310
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5311
+ while (1) switch (_context47.prev = _context47.next) {
5018
5312
  case 0:
5019
5313
  lifecycleGeneration = this.availabilityLifecycleGeneration;
5020
5314
  normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
@@ -5033,15 +5327,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5033
5327
  }
5034
5328
  })) : this.buildAvailabilityPrepareKey(normalizedParams);
5035
5329
  if (!hasRawInputs) {
5036
- _context45.next = 11;
5330
+ _context47.next = 11;
5037
5331
  break;
5038
5332
  }
5039
- _context45.next = 7;
5333
+ _context47.next = 7;
5040
5334
  return this.buildAvailabilityProjectionSnapshot(normalizedParams);
5041
5335
  case 7:
5042
- snapshot = _context45.sent;
5336
+ snapshot = _context47.sent;
5043
5337
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
5044
- _context45.next = 10;
5338
+ _context47.next = 10;
5045
5339
  break;
5046
5340
  }
5047
5341
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -5050,7 +5344,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5050
5344
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
5051
5345
  });
5052
5346
  case 10:
5053
- return _context45.abrupt("return", {
5347
+ return _context47.abrupt("return", {
5054
5348
  prepareKey: prepareKey,
5055
5349
  snapshot: snapshot
5056
5350
  });
@@ -5064,13 +5358,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5064
5358
  promise: promise
5065
5359
  });
5066
5360
  }
5067
- _context45.prev = 14;
5068
- _context45.next = 17;
5361
+ _context47.prev = 14;
5362
+ _context47.next = 17;
5069
5363
  return promise;
5070
5364
  case 17:
5071
- _snapshot = _context45.sent;
5365
+ _snapshot = _context47.sent;
5072
5366
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
5073
- _context45.next = 20;
5367
+ _context47.next = 20;
5074
5368
  break;
5075
5369
  }
5076
5370
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -5079,24 +5373,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5079
5373
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
5080
5374
  });
5081
5375
  case 20:
5082
- return _context45.abrupt("return", {
5376
+ return _context47.abrupt("return", {
5083
5377
  prepareKey: prepareKey,
5084
5378
  snapshot: _snapshot
5085
5379
  });
5086
5380
  case 21:
5087
- _context45.prev = 21;
5381
+ _context47.prev = 21;
5088
5382
  current = this.availabilityPrepareInFlight.get(prepareKey);
5089
5383
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
5090
5384
  this.availabilityPrepareInFlight.delete(prepareKey);
5091
5385
  }
5092
- return _context45.finish(21);
5386
+ return _context47.finish(21);
5093
5387
  case 25:
5094
5388
  case "end":
5095
- return _context45.stop();
5389
+ return _context47.stop();
5096
5390
  }
5097
- }, _callee45, this, [[14,, 21, 25]]);
5391
+ }, _callee47, this, [[14,, 21, 25]]);
5098
5392
  }));
5099
- function getSharedPreparedAvailabilitySnapshot(_x30) {
5393
+ function getSharedPreparedAvailabilitySnapshot(_x33) {
5100
5394
  return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
5101
5395
  }
5102
5396
  return getSharedPreparedAvailabilitySnapshot;
@@ -5104,51 +5398,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5104
5398
  }, {
5105
5399
  key: "refreshAvailabilityContextProjection",
5106
5400
  value: function () {
5107
- var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
5108
- var _this16 = this;
5401
+ var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
5402
+ var _this19 = this;
5109
5403
  var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
5110
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5111
- while (1) switch (_context47.prev = _context47.next) {
5404
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5405
+ while (1) switch (_context49.prev = _context49.next) {
5112
5406
  case 0:
5113
5407
  existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
5114
5408
  if (!existingInFlight) {
5115
- _context47.next = 5;
5409
+ _context49.next = 5;
5116
5410
  break;
5117
5411
  }
5118
- _context47.next = 4;
5412
+ _context49.next = 4;
5119
5413
  return existingInFlight;
5120
5414
  case 4:
5121
- return _context47.abrupt("return", _context47.sent);
5415
+ return _context49.abrupt("return", _context49.sent);
5122
5416
  case 5:
5123
5417
  context = this.getAvailabilityContextEntry(params.contextId);
5124
5418
  expectedVersion = context.activeVersion;
5125
5419
  expectedRefreshNonce = context.refreshNonce;
5126
5420
  expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
5127
- refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
5421
+ refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
5128
5422
  var snapshot, currentContext, projectionEntry;
5129
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5130
- while (1) switch (_context46.prev = _context46.next) {
5423
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5424
+ while (1) switch (_context48.prev = _context48.next) {
5131
5425
  case 0:
5132
- _context46.next = 2;
5133
- return _this16.buildAvailabilityProjectionSnapshot(_this16.cloneAvailabilityPrepareParams(context.prepareParams), {
5426
+ _context48.next = 2;
5427
+ return _this19.buildAvailabilityProjectionSnapshot(_this19.cloneAvailabilityPrepareParams(context.prepareParams), {
5134
5428
  durationCandidateAnchorAt: context.durationCandidateAnchorAt
5135
5429
  });
5136
5430
  case 2:
5137
- snapshot = _context46.sent;
5138
- currentContext = _this16.availabilityContextRegistry.get(params.contextId);
5431
+ snapshot = _context48.sent;
5432
+ currentContext = _this19.availabilityContextRegistry.get(params.contextId);
5139
5433
  if (currentContext) {
5140
- _context46.next = 6;
5434
+ _context48.next = 6;
5141
5435
  break;
5142
5436
  }
5143
- return _context46.abrupt("return", null);
5437
+ return _context48.abrupt("return", null);
5144
5438
  case 6:
5145
- if (!(expectedLifecycleGeneration !== _this16.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
5146
- _context46.next = 8;
5439
+ if (!(expectedLifecycleGeneration !== _this19.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
5440
+ _context48.next = 8;
5147
5441
  break;
5148
5442
  }
5149
- return _context46.abrupt("return", null);
5443
+ return _context48.abrupt("return", null);
5150
5444
  case 8:
5151
- projectionEntry = _this16.storeAvailabilityProjectionEntry({
5445
+ projectionEntry = _this19.storeAvailabilityProjectionEntry({
5152
5446
  contextId: currentContext.contextId,
5153
5447
  prepareParams: snapshot.prepareParams,
5154
5448
  prepareKey: currentContext.prepareKey,
@@ -5156,8 +5450,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5156
5450
  orderRevision: snapshot.orderRevision,
5157
5451
  incrementVersion: true
5158
5452
  });
5159
- _context46.next = 11;
5160
- return _this16.emitAvailabilityDiagnostic({
5453
+ _context48.next = 11;
5454
+ return _this19.emitAvailabilityDiagnostic({
5161
5455
  action: 'refresh',
5162
5456
  contextId: currentContext.contextId,
5163
5457
  contextVersion: projectionEntry.contextVersion,
@@ -5168,33 +5462,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5168
5462
  reason: params.reason
5169
5463
  });
5170
5464
  case 11:
5171
- return _context46.abrupt("return", projectionEntry);
5465
+ return _context48.abrupt("return", projectionEntry);
5172
5466
  case 12:
5173
5467
  case "end":
5174
- return _context46.stop();
5468
+ return _context48.stop();
5175
5469
  }
5176
- }, _callee46);
5470
+ }, _callee48);
5177
5471
  }))();
5178
5472
  this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
5179
- _context47.prev = 11;
5180
- _context47.next = 14;
5473
+ _context49.prev = 11;
5474
+ _context49.next = 14;
5181
5475
  return refreshPromise;
5182
5476
  case 14:
5183
- return _context47.abrupt("return", _context47.sent);
5477
+ return _context49.abrupt("return", _context49.sent);
5184
5478
  case 15:
5185
- _context47.prev = 15;
5479
+ _context49.prev = 15;
5186
5480
  current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
5187
5481
  if (current === refreshPromise) {
5188
5482
  this.availabilityProjectionRefreshInFlight.delete(params.contextId);
5189
5483
  }
5190
- return _context47.finish(15);
5484
+ return _context49.finish(15);
5191
5485
  case 19:
5192
5486
  case "end":
5193
- return _context47.stop();
5487
+ return _context49.stop();
5194
5488
  }
5195
- }, _callee47, this, [[11,, 15, 19]]);
5489
+ }, _callee49, this, [[11,, 15, 19]]);
5196
5490
  }));
5197
- function refreshAvailabilityContextProjection(_x31) {
5491
+ function refreshAvailabilityContextProjection(_x34) {
5198
5492
  return _refreshAvailabilityContextProjection.apply(this, arguments);
5199
5493
  }
5200
5494
  return refreshAvailabilityContextProjection;
@@ -5202,53 +5496,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5202
5496
  }, {
5203
5497
  key: "ensureAvailabilityContextProjection",
5204
5498
  value: function () {
5205
- var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId, reason) {
5499
+ var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(contextId, reason) {
5206
5500
  var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
5207
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5208
- while (1) switch (_context48.prev = _context48.next) {
5501
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5502
+ while (1) switch (_context50.prev = _context50.next) {
5209
5503
  case 0:
5210
5504
  retries = 0;
5211
5505
  case 1:
5212
5506
  if (!(retries < 3)) {
5213
- _context48.next = 19;
5507
+ _context50.next = 19;
5214
5508
  break;
5215
5509
  }
5216
5510
  context = this.getAvailabilityContextEntry(contextId);
5217
5511
  currentOrderRevision = this.getCurrentOrderRevision();
5218
5512
  projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
5219
5513
  if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
5220
- _context48.next = 7;
5514
+ _context50.next = 7;
5221
5515
  break;
5222
5516
  }
5223
- return _context48.abrupt("return", {
5517
+ return _context50.abrupt("return", {
5224
5518
  context: context,
5225
5519
  projectionEntry: projectionEntry,
5226
5520
  refreshed: false
5227
5521
  });
5228
5522
  case 7:
5229
- _context48.next = 9;
5523
+ _context50.next = 9;
5230
5524
  return this.refreshAvailabilityContextProjection({
5231
5525
  contextId: contextId,
5232
5526
  reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
5233
5527
  previousOrderRevision: context.lastKnownOrderRevision
5234
5528
  });
5235
5529
  case 9:
5236
- refreshedProjectionEntry = _context48.sent;
5530
+ refreshedProjectionEntry = _context50.sent;
5237
5531
  if (refreshedProjectionEntry) {
5238
- _context48.next = 13;
5532
+ _context50.next = 13;
5239
5533
  break;
5240
5534
  }
5241
5535
  retries += 1;
5242
- return _context48.abrupt("continue", 1);
5536
+ return _context50.abrupt("continue", 1);
5243
5537
  case 13:
5244
5538
  if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
5245
- _context48.next = 16;
5539
+ _context50.next = 16;
5246
5540
  break;
5247
5541
  }
5248
5542
  retries += 1;
5249
- return _context48.abrupt("continue", 1);
5543
+ return _context50.abrupt("continue", 1);
5250
5544
  case 16:
5251
- return _context48.abrupt("return", {
5545
+ return _context50.abrupt("return", {
5252
5546
  context: this.getAvailabilityContextEntry(contextId),
5253
5547
  projectionEntry: refreshedProjectionEntry,
5254
5548
  refreshed: true
@@ -5260,11 +5554,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5260
5554
  });
5261
5555
  case 20:
5262
5556
  case "end":
5263
- return _context48.stop();
5557
+ return _context50.stop();
5264
5558
  }
5265
- }, _callee48, this);
5559
+ }, _callee50, this);
5266
5560
  }));
5267
- function ensureAvailabilityContextProjection(_x32, _x33) {
5561
+ function ensureAvailabilityContextProjection(_x35, _x36) {
5268
5562
  return _ensureAvailabilityContextProjection.apply(this, arguments);
5269
5563
  }
5270
5564
  return ensureAvailabilityContextProjection;
@@ -5272,18 +5566,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5272
5566
  }, {
5273
5567
  key: "tryAcquireAvailabilityCommitLock",
5274
5568
  value: function () {
5275
- var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(contextId) {
5569
+ var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(contextId) {
5276
5570
  var _currentContext$activ;
5277
5571
  var _waitingContext$activ, waitingContext, currentContext;
5278
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5279
- while (1) switch (_context49.prev = _context49.next) {
5572
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5573
+ while (1) switch (_context51.prev = _context51.next) {
5280
5574
  case 0:
5281
5575
  if (!this.availabilityCommitLocks.has(contextId)) {
5282
- _context49.next = 5;
5576
+ _context51.next = 5;
5283
5577
  break;
5284
5578
  }
5285
5579
  waitingContext = this.availabilityContextRegistry.get(contextId);
5286
- _context49.next = 4;
5580
+ _context51.next = 4;
5287
5581
  return this.emitAvailabilityDiagnostic({
5288
5582
  action: 'commit_lock_wait',
5289
5583
  contextId: contextId,
@@ -5300,7 +5594,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5300
5594
  case 5:
5301
5595
  this.availabilityCommitLocks.add(contextId);
5302
5596
  currentContext = this.availabilityContextRegistry.get(contextId);
5303
- _context49.next = 9;
5597
+ _context51.next = 9;
5304
5598
  return this.emitAvailabilityDiagnostic({
5305
5599
  action: 'commit_lock_acquired',
5306
5600
  contextId: contextId,
@@ -5312,11 +5606,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5312
5606
  });
5313
5607
  case 9:
5314
5608
  case "end":
5315
- return _context49.stop();
5609
+ return _context51.stop();
5316
5610
  }
5317
- }, _callee49, this);
5611
+ }, _callee51, this);
5318
5612
  }));
5319
- function tryAcquireAvailabilityCommitLock(_x34) {
5613
+ function tryAcquireAvailabilityCommitLock(_x37) {
5320
5614
  return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
5321
5615
  }
5322
5616
  return tryAcquireAvailabilityCommitLock;
@@ -5324,15 +5618,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5324
5618
  }, {
5325
5619
  key: "releaseAvailabilityCommitLock",
5326
5620
  value: function () {
5327
- var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(contextId) {
5621
+ var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(contextId) {
5328
5622
  var _releasedContext$acti;
5329
5623
  var releasedContext;
5330
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5331
- while (1) switch (_context50.prev = _context50.next) {
5624
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5625
+ while (1) switch (_context52.prev = _context52.next) {
5332
5626
  case 0:
5333
5627
  this.availabilityCommitLocks.delete(contextId);
5334
5628
  releasedContext = this.availabilityContextRegistry.get(contextId);
5335
- _context50.next = 4;
5629
+ _context52.next = 4;
5336
5630
  return this.emitAvailabilityDiagnostic({
5337
5631
  action: 'commit_lock_released',
5338
5632
  contextId: contextId,
@@ -5344,11 +5638,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5344
5638
  });
5345
5639
  case 4:
5346
5640
  case "end":
5347
- return _context50.stop();
5641
+ return _context52.stop();
5348
5642
  }
5349
- }, _callee50, this);
5643
+ }, _callee52, this);
5350
5644
  }));
5351
- function releaseAvailabilityCommitLock(_x35) {
5645
+ function releaseAvailabilityCommitLock(_x38) {
5352
5646
  return _releaseAvailabilityCommitLock.apply(this, arguments);
5353
5647
  }
5354
5648
  return releaseAvailabilityCommitLock;
@@ -5356,20 +5650,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5356
5650
  }, {
5357
5651
  key: "prepareAvailabilityProjection",
5358
5652
  value: (function () {
5359
- var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
5653
+ var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(params) {
5360
5654
  var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
5361
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5362
- while (1) switch (_context51.prev = _context51.next) {
5655
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5656
+ while (1) switch (_context53.prev = _context53.next) {
5363
5657
  case 0:
5364
5658
  this.assertAvailabilityPrepareParams(params);
5365
- _context51.next = 3;
5659
+ _context53.next = 3;
5366
5660
  return this.resolveAvailabilityPrepareDefaults(params);
5367
5661
  case 3:
5368
- paramsWithDefaults = _context51.sent;
5369
- _context51.next = 6;
5662
+ paramsWithDefaults = _context53.sent;
5663
+ _context53.next = 6;
5370
5664
  return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
5371
5665
  case 6:
5372
- _yield$this$getShared = _context51.sent;
5666
+ _yield$this$getShared = _context53.sent;
5373
5667
  prepareKey = _yield$this$getShared.prepareKey;
5374
5668
  snapshot = _yield$this$getShared.snapshot;
5375
5669
  contextId = this.createAvailabilityContextId();
@@ -5390,7 +5684,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5390
5684
  refreshed: false,
5391
5685
  reason: 'prepare'
5392
5686
  };
5393
- _context51.next = 16;
5687
+ _context53.next = 16;
5394
5688
  return this.emitAvailabilityDiagnostic({
5395
5689
  action: 'prepare',
5396
5690
  contextId: contextId,
@@ -5401,17 +5695,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5401
5695
  reason: 'prepare'
5402
5696
  });
5403
5697
  case 16:
5404
- _context51.next = 18;
5698
+ _context53.next = 18;
5405
5699
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
5406
5700
  case 18:
5407
- return _context51.abrupt("return", handle);
5701
+ return _context53.abrupt("return", handle);
5408
5702
  case 19:
5409
5703
  case "end":
5410
- return _context51.stop();
5704
+ return _context53.stop();
5411
5705
  }
5412
- }, _callee51, this);
5706
+ }, _callee53, this);
5413
5707
  }));
5414
- function prepareAvailabilityProjection(_x36) {
5708
+ function prepareAvailabilityProjection(_x39) {
5415
5709
  return _prepareAvailabilityProjection.apply(this, arguments);
5416
5710
  }
5417
5711
  return prepareAvailabilityProjection;
@@ -5419,10 +5713,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5419
5713
  }, {
5420
5714
  key: "getProductTimeRanges",
5421
5715
  value: (function () {
5422
- var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(contextId) {
5716
+ var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(contextId) {
5423
5717
  var _this$otherParams$pla,
5424
5718
  _this$otherParams36,
5425
- _this17 = this;
5719
+ _this20 = this;
5426
5720
  var request,
5427
5721
  _yield$this$ensureAva,
5428
5722
  context,
@@ -5431,15 +5725,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5431
5725
  strictAvailability,
5432
5726
  isPosAvailabilityRequest,
5433
5727
  allowOutsideOperatingHoursForRequestedStartTimes,
5434
- _args52 = arguments;
5435
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5436
- while (1) switch (_context52.prev = _context52.next) {
5728
+ _args54 = arguments;
5729
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5730
+ while (1) switch (_context54.prev = _context54.next) {
5437
5731
  case 0:
5438
- request = _args52.length > 1 && _args52[1] !== undefined ? _args52[1] : {};
5439
- _context52.next = 3;
5732
+ request = _args54.length > 1 && _args54[1] !== undefined ? _args54[1] : {};
5733
+ _context54.next = 3;
5440
5734
  return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
5441
5735
  case 3:
5442
- _yield$this$ensureAva = _context52.sent;
5736
+ _yield$this$ensureAva = _context54.sent;
5443
5737
  context = _yield$this$ensureAva.context;
5444
5738
  projectionEntry = _yield$this$ensureAva.projectionEntry;
5445
5739
  contextVersion = context.activeVersion;
@@ -5448,7 +5742,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5448
5742
  allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && !strictAvailability && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
5449
5743
  return Array.isArray(startTimes) && startTimes.length > 0;
5450
5744
  });
5451
- return _context52.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
5745
+ return _context54.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
5452
5746
  allowOutsideOperatingHoursForRequestedStartTimes: true
5453
5747
  } : {}), strictAvailability ? {
5454
5748
  allowOutsideOperatingHoursForRequestedStartTimes: false
@@ -5460,17 +5754,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5460
5754
  }).map(function (group) {
5461
5755
  return _objectSpread(_objectSpread({}, group), {}, {
5462
5756
  ranges: group.ranges.map(function (candidate) {
5463
- return _this17.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
5757
+ return _this20.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
5464
5758
  })
5465
5759
  });
5466
5760
  }));
5467
5761
  case 11:
5468
5762
  case "end":
5469
- return _context52.stop();
5763
+ return _context54.stop();
5470
5764
  }
5471
- }, _callee52, this);
5765
+ }, _callee54, this);
5472
5766
  }));
5473
- function getProductTimeRanges(_x37) {
5767
+ function getProductTimeRanges(_x40) {
5474
5768
  return _getProductTimeRanges.apply(this, arguments);
5475
5769
  }
5476
5770
  return getProductTimeRanges;
@@ -5478,16 +5772,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5478
5772
  }, {
5479
5773
  key: "queryBookingAvailability",
5480
5774
  value: (function () {
5481
- var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(contextId, request) {
5775
+ var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(contextId, request) {
5482
5776
  var _this$otherParams$pla2, _this$otherParams37;
5483
5777
  var _yield$this$ensureAva2, context, projectionEntry, refreshed, strictAvailability, isPosAvailabilityRequest, result, contextVersion, contextualResult;
5484
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5485
- while (1) switch (_context53.prev = _context53.next) {
5778
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5779
+ while (1) switch (_context55.prev = _context55.next) {
5486
5780
  case 0:
5487
- _context53.next = 2;
5781
+ _context55.next = 2;
5488
5782
  return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
5489
5783
  case 2:
5490
- _yield$this$ensureAva2 = _context53.sent;
5784
+ _yield$this$ensureAva2 = _context55.sent;
5491
5785
  context = _yield$this$ensureAva2.context;
5492
5786
  projectionEntry = _yield$this$ensureAva2.projectionEntry;
5493
5787
  refreshed = _yield$this$ensureAva2.refreshed;
@@ -5524,18 +5818,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5524
5818
  });
5525
5819
  })
5526
5820
  }) : result;
5527
- return _context53.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
5821
+ return _context55.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
5528
5822
  contextId: context.contextId,
5529
5823
  contextVersion: contextVersion,
5530
5824
  refreshed: refreshed
5531
5825
  }));
5532
5826
  case 13:
5533
5827
  case "end":
5534
- return _context53.stop();
5828
+ return _context55.stop();
5535
5829
  }
5536
- }, _callee53, this);
5830
+ }, _callee55, this);
5537
5831
  }));
5538
- function queryBookingAvailability(_x38, _x39) {
5832
+ function queryBookingAvailability(_x41, _x42) {
5539
5833
  return _queryBookingAvailability.apply(this, arguments);
5540
5834
  }
5541
5835
  return queryBookingAvailability;
@@ -5606,9 +5900,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5606
5900
  }, {
5607
5901
  key: "findLinkedBooking",
5608
5902
  value: function findLinkedBooking(product) {
5609
- var _ref53, _product$booking_uid3, _product$metadata7, _this$getTempOrder4;
5903
+ var _ref55, _product$booking_uid3, _product$metadata7, _this$getTempOrder4;
5610
5904
  var productUid = getProductLineUid(product);
5611
- var bookingUid = String((_ref53 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.booking_uid) !== null && _ref53 !== void 0 ? _ref53 : '');
5905
+ var bookingUid = String((_ref55 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.booking_uid) !== null && _ref55 !== void 0 ? _ref55 : '');
5612
5906
  return (((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.bookings) || []).find(function (booking) {
5613
5907
  var _booking$product_uid3;
5614
5908
  return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
@@ -5619,19 +5913,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5619
5913
  }, {
5620
5914
  key: "commitAvailabilitySelection",
5621
5915
  value: (function () {
5622
- var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(contextId, params) {
5916
+ var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(contextId, params) {
5623
5917
  var _this$availabilityCon,
5624
- _params$availabilityC2,
5918
+ _params$availabilityC3,
5625
5919
  _this$store$order11,
5626
5920
  _this$store$order11$e,
5627
- _this18 = this;
5628
- var normalizedContextId, isEditingSelection, isPartyReplacement, strictAvailability, hasCommitGuard, guardedOrder, getGuardedCommitIdentity, guardedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref54, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla3, _this$otherParams38, _params$orderProduct$3, _params$orderProduct6, _existingBooking$hold, _existingBooking$meta, _ref55, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$meta3, _existingBooking$hold2, _transformed$metadata, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, relatedRetailProducts, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref56, _transformed$product_4, update, _this$getTempOrder5, _this$getTempOrder6, _params$salesNotes, _params$salesNotes2, _ref57, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
5629
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5630
- while (1) switch (_context54.prev = _context54.next) {
5921
+ _this21 = this;
5922
+ var normalizedContextId, isEditingSelection, isPartyReplacement, strictAvailability, hasCommitGuard, guardedOrder, getGuardedCommitIdentity, guardedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref56, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla3, _this$otherParams38, _params$orderProduct$3, _params$orderProduct6, _existingBooking$hold, _existingBooking$meta, _ref57, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$meta3, _existingBooking$hold2, _transformed$metadata, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, relatedRetailProducts, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref58, _transformed$product_4, update, _this$getTempOrder5, _this$getTempOrder6, _params$salesNotes, _params$salesNotes2, _ref59, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
5923
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5924
+ while (1) switch (_context56.prev = _context56.next) {
5631
5925
  case 0:
5632
5926
  normalizedContextId = String(contextId || '').trim();
5633
5927
  if (normalizedContextId) {
5634
- _context54.next = 3;
5928
+ _context56.next = 3;
5635
5929
  break;
5636
5930
  }
5637
5931
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
@@ -5641,39 +5935,39 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5641
5935
  isEditingSelection = params.mode === 'edit' || params.mode === 'replace';
5642
5936
  isPartyReplacement = params.mode === 'replace' || params.relatedRetailProducts !== undefined;
5643
5937
  if (!(isPartyReplacement && (!isEditingSelection || !Array.isArray(params.relatedRetailProducts)))) {
5644
- _context54.next = 7;
5938
+ _context56.next = 7;
5645
5939
  break;
5646
5940
  }
5647
5941
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'Party replacement requires edit/replace mode and the confirmed complete extras array');
5648
5942
  case 7:
5649
5943
  strictAvailability = ((_this$availabilityCon = this.availabilityContextRegistry.get(normalizedContextId)) === null || _this$availabilityCon === void 0 ? void 0 : _this$availabilityCon.prepareParams.strictAvailability) === true;
5650
5944
  hasCommitGuard = strictAvailability || isPartyReplacement || Boolean(params.availabilityCommitGuard);
5651
- (_params$availabilityC2 = params.availabilityCommitGuard) === null || _params$availabilityC2 === void 0 || _params$availabilityC2.call(params);
5945
+ (_params$availabilityC3 = params.availabilityCommitGuard) === null || _params$availabilityC3 === void 0 || _params$availabilityC3.call(params);
5652
5946
  // Stabilize the locally generated sale identity before taking the guard snapshot.
5653
5947
  if (hasCommitGuard) (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$e = _this$store$order11.ensureTempOrder) === null || _this$store$order11$e === void 0 || _this$store$order11$e.call(_this$store$order11);
5654
5948
  guardedOrder = hasCommitGuard ? this.getTempOrder() : null;
5655
5949
  getGuardedCommitIdentity = function getGuardedCommitIdentity() {
5656
- var _this18$otherParams$s, _this18$otherParams, _this18$otherParams2, _this18$core, _this18$getTempOrder, _this18$getTempOrder2;
5950
+ var _this21$otherParams$s, _this21$otherParams, _this21$otherParams2, _this21$core, _this21$getTempOrder, _this21$getTempOrder2;
5657
5951
  return JSON.stringify(stableValue({
5658
- scope: _this18.getAvailabilityScopeDescriptor(),
5659
- shopId: (_this18$otherParams$s = (_this18$otherParams = _this18.otherParams) === null || _this18$otherParams === void 0 ? void 0 : _this18$otherParams.shop_id) !== null && _this18$otherParams$s !== void 0 ? _this18$otherParams$s : (_this18$otherParams2 = _this18.otherParams) === null || _this18$otherParams2 === void 0 ? void 0 : _this18$otherParams2.shopId,
5660
- contextShopId: (_this18$core = _this18.core) === null || _this18$core === void 0 || (_this18$core = _this18$core.context) === null || _this18$core === void 0 ? void 0 : _this18$core.shop_id,
5661
- orderId: (_this18$getTempOrder = _this18.getTempOrder()) === null || _this18$getTempOrder === void 0 ? void 0 : _this18$getTempOrder.order_id,
5662
- externalSaleNumber: (_this18$getTempOrder2 = _this18.getTempOrder()) === null || _this18$getTempOrder2 === void 0 ? void 0 : _this18$getTempOrder2.external_sale_number
5952
+ scope: _this21.getAvailabilityScopeDescriptor(),
5953
+ shopId: (_this21$otherParams$s = (_this21$otherParams = _this21.otherParams) === null || _this21$otherParams === void 0 ? void 0 : _this21$otherParams.shop_id) !== null && _this21$otherParams$s !== void 0 ? _this21$otherParams$s : (_this21$otherParams2 = _this21.otherParams) === null || _this21$otherParams2 === void 0 ? void 0 : _this21$otherParams2.shopId,
5954
+ contextShopId: (_this21$core = _this21.core) === null || _this21$core === void 0 || (_this21$core = _this21$core.context) === null || _this21$core === void 0 ? void 0 : _this21$core.shop_id,
5955
+ orderId: (_this21$getTempOrder = _this21.getTempOrder()) === null || _this21$getTempOrder === void 0 ? void 0 : _this21$getTempOrder.order_id,
5956
+ externalSaleNumber: (_this21$getTempOrder2 = _this21.getTempOrder()) === null || _this21$getTempOrder2 === void 0 ? void 0 : _this21$getTempOrder2.external_sale_number
5663
5957
  }));
5664
5958
  };
5665
5959
  guardedCommitIdentity = hasCommitGuard ? getGuardedCommitIdentity() : '';
5666
5960
  availabilityCommitTargetGuard = function availabilityCommitTargetGuard() {
5667
- return _this18.getTempOrder() === guardedOrder && getGuardedCommitIdentity() === guardedCommitIdentity;
5961
+ return _this21.getTempOrder() === guardedOrder && getGuardedCommitIdentity() === guardedCommitIdentity;
5668
5962
  };
5669
5963
  guardedCommitPublished = false;
5670
- _context54.next = 18;
5964
+ _context56.next = 18;
5671
5965
  return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
5672
5966
  case 18:
5673
- _context54.prev = 18;
5967
+ _context56.prev = 18;
5674
5968
  bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
5675
5969
  if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
5676
- _context54.next = 22;
5970
+ _context56.next = 22;
5677
5971
  break;
5678
5972
  }
5679
5973
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
@@ -5681,16 +5975,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5681
5975
  });
5682
5976
  case 22:
5683
5977
  if (!(isEditingSelection && bookingCount !== 1)) {
5684
- _context54.next = 24;
5978
+ _context56.next = 24;
5685
5979
  break;
5686
5980
  }
5687
5981
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
5688
5982
  bookingCount: bookingCount
5689
5983
  });
5690
5984
  case 24:
5691
- orderProductQuantity = (_ref54 = (_params$orderProduct$ = (_params$orderProduct = params.orderProduct) === null || _params$orderProduct === void 0 ? void 0 : _params$orderProduct.num) !== null && _params$orderProduct$ !== void 0 ? _params$orderProduct$ : (_params$orderProduct2 = params.orderProduct) === null || _params$orderProduct2 === void 0 ? void 0 : _params$orderProduct2.quantity) !== null && _ref54 !== void 0 ? _ref54 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
5985
+ orderProductQuantity = (_ref56 = (_params$orderProduct$ = (_params$orderProduct = params.orderProduct) === null || _params$orderProduct === void 0 ? void 0 : _params$orderProduct.num) !== null && _params$orderProduct$ !== void 0 ? _params$orderProduct$ : (_params$orderProduct2 = params.orderProduct) === null || _params$orderProduct2 === void 0 ? void 0 : _params$orderProduct2.quantity) !== null && _ref56 !== void 0 ? _ref56 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
5692
5986
  if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
5693
- _context54.next = 27;
5987
+ _context56.next = 27;
5694
5988
  break;
5695
5989
  }
5696
5990
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
@@ -5700,22 +5994,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5700
5994
  case 27:
5701
5995
  partySize = Number(params.partySize);
5702
5996
  if (!(!Number.isInteger(partySize) || partySize <= 0)) {
5703
- _context54.next = 30;
5997
+ _context56.next = 30;
5704
5998
  break;
5705
5999
  }
5706
6000
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
5707
6001
  partySize: params.partySize
5708
6002
  });
5709
6003
  case 30:
5710
- _context54.next = 32;
6004
+ _context56.next = 32;
5711
6005
  return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
5712
6006
  case 32:
5713
- _yield$this$ensureAva3 = _context54.sent;
6007
+ _yield$this$ensureAva3 = _context56.sent;
5714
6008
  context = _yield$this$ensureAva3.context;
5715
6009
  projectionEntry = _yield$this$ensureAva3.projectionEntry;
5716
6010
  refreshed = _yield$this$ensureAva3.refreshed;
5717
6011
  if (!refreshed) {
5718
- _context54.next = 38;
6012
+ _context56.next = 38;
5719
6013
  break;
5720
6014
  }
5721
6015
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -5726,11 +6020,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5726
6020
  case 38:
5727
6021
  boundEditingUids = context.prepareParams.editingProductLineUids || [];
5728
6022
  if (!isEditingSelection) {
5729
- _context54.next = 44;
6023
+ _context56.next = 44;
5730
6024
  break;
5731
6025
  }
5732
6026
  if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
5733
- _context54.next = 42;
6027
+ _context56.next = 42;
5734
6028
  break;
5735
6029
  }
5736
6030
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
@@ -5739,11 +6033,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5739
6033
  editingProductLineUids: boundEditingUids
5740
6034
  });
5741
6035
  case 42:
5742
- _context54.next = 46;
6036
+ _context56.next = 46;
5743
6037
  break;
5744
6038
  case 44:
5745
6039
  if (!(boundEditingUids.length > 0)) {
5746
- _context54.next = 46;
6040
+ _context56.next = 46;
5747
6041
  break;
5748
6042
  }
5749
6043
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
@@ -5752,7 +6046,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5752
6046
  });
5753
6047
  case 46:
5754
6048
  if (!(projectionEntry.contextVersion !== context.activeVersion)) {
5755
- _context54.next = 48;
6049
+ _context56.next = 48;
5756
6050
  break;
5757
6051
  }
5758
6052
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -5762,7 +6056,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5762
6056
  });
5763
6057
  case 48:
5764
6058
  if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
5765
- _context54.next = 50;
6059
+ _context56.next = 50;
5766
6060
  break;
5767
6061
  }
5768
6062
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
@@ -5773,7 +6067,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5773
6067
  });
5774
6068
  case 50:
5775
6069
  if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
5776
- _context54.next = 52;
6070
+ _context56.next = 52;
5777
6071
  break;
5778
6072
  }
5779
6073
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
@@ -5785,7 +6079,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5785
6079
  this.assertAvailabilityCandidateFreshness(context, params.candidate);
5786
6080
  orderProductId = (_params$orderProduct$2 = (_params$orderProduct4 = params.orderProduct) === null || _params$orderProduct4 === void 0 ? void 0 : _params$orderProduct4.product_id) !== null && _params$orderProduct$2 !== void 0 ? _params$orderProduct$2 : (_params$orderProduct5 = params.orderProduct) === null || _params$orderProduct5 === void 0 ? void 0 : _params$orderProduct5.id;
5787
6081
  if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
5788
- _context54.next = 56;
6082
+ _context56.next = 56;
5789
6083
  break;
5790
6084
  }
5791
6085
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
@@ -5794,14 +6088,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5794
6088
  });
5795
6089
  case 56:
5796
6090
  if (!(isEditingSelection && !params.productLineUid)) {
5797
- _context54.next = 58;
6091
+ _context56.next = 58;
5798
6092
  break;
5799
6093
  }
5800
6094
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
5801
6095
  case 58:
5802
6096
  editingLine = isEditingSelection ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
5803
6097
  if (!(isEditingSelection && !editingLine)) {
5804
- _context54.next = 61;
6098
+ _context56.next = 61;
5805
6099
  break;
5806
6100
  }
5807
6101
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
@@ -5809,7 +6103,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5809
6103
  });
5810
6104
  case 61:
5811
6105
  if (!(editingLine && params.mode !== 'replace' && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
5812
- _context54.next = 63;
6106
+ _context56.next = 63;
5813
6107
  break;
5814
6108
  }
5815
6109
  throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
@@ -5819,7 +6113,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5819
6113
  });
5820
6114
  case 63:
5821
6115
  if (Array.isArray(params.requirementSelections)) {
5822
- _context54.next = 65;
6116
+ _context56.next = 65;
5823
6117
  break;
5824
6118
  }
5825
6119
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
@@ -5836,7 +6130,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5836
6130
  };
5837
6131
  prepareParams = baseProjection.meta.prepareParams;
5838
6132
  if (prepareParams) {
5839
- _context54.next = 70;
6133
+ _context56.next = 70;
5840
6134
  break;
5841
6135
  }
5842
6136
  throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
@@ -5848,7 +6142,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5848
6142
  })),
5849
6143
  includesInjectedRawOccupancies: true
5850
6144
  };
5851
- _context54.next = 73;
6145
+ _context56.next = 73;
5852
6146
  return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
5853
6147
  editingProductLineUids: isEditingSelection && params.productLineUid ? [params.productLineUid] : []
5854
6148
  }), {
@@ -5857,13 +6151,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5857
6151
  durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
5858
6152
  });
5859
6153
  case 73:
5860
- commitSnapshot = _context54.sent;
6154
+ commitSnapshot = _context56.sent;
5861
6155
  refreshedProjection = commitSnapshot.projection;
5862
6156
  if (!(String((_refreshedProjection$ = refreshedProjection.meta.orderRevision) !== null && _refreshedProjection$ !== void 0 ? _refreshedProjection$ : '') !== String((_baseProjection$meta$2 = baseProjection.meta.orderRevision) !== null && _baseProjection$meta$2 !== void 0 ? _baseProjection$meta$2 : ''))) {
5863
- _context54.next = 80;
6157
+ _context56.next = 80;
5864
6158
  break;
5865
6159
  }
5866
- _context54.next = 78;
6160
+ _context56.next = 78;
5867
6161
  return this.refreshAvailabilityContextProjection({
5868
6162
  contextId: normalizedContextId,
5869
6163
  reason: 'commit_order_revision_changed',
@@ -5910,7 +6204,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5910
6204
  return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
5911
6205
  });
5912
6206
  if (refreshedCandidateBase) {
5913
- _context54.next = 88;
6207
+ _context56.next = 88;
5914
6208
  break;
5915
6209
  }
5916
6210
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
@@ -5923,7 +6217,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5923
6217
  return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
5924
6218
  });
5925
6219
  if (product) {
5926
- _context54.next = 91;
6220
+ _context56.next = 91;
5927
6221
  break;
5928
6222
  }
5929
6223
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
@@ -5960,7 +6254,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5960
6254
  });
5961
6255
  }
5962
6256
  if (validation.ok) {
5963
- _context54.next = 96;
6257
+ _context56.next = 96;
5964
6258
  break;
5965
6259
  }
5966
6260
  capacityConflict = validation.conflicts.find(function (conflict) {
@@ -5983,7 +6277,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5983
6277
  incrementVersion: true
5984
6278
  });
5985
6279
  revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
5986
- _context54.next = 100;
6280
+ _context56.next = 100;
5987
6281
  return this.emitAvailabilityDiagnostic({
5988
6282
  action: 'refresh',
5989
6283
  contextId: normalizedContextId,
@@ -6005,11 +6299,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6005
6299
  refreshedCandidate = this.decorateAvailabilityCandidate(normalizedContextId, revalidatedContext.activeVersion, refreshedCandidateBase); // Order may await line/runtime setup. Its guarded transaction invokes this
6006
6300
  // again immediately before publishing, while the live cart is unchanged.
6007
6301
  availabilityCommitGuard = hasCommitGuard ? function () {
6008
- var _params$availabilityC3;
6009
- (_params$availabilityC3 = params.availabilityCommitGuard) === null || _params$availabilityC3 === void 0 || _params$availabilityC3.call(params);
6010
- _this18.assertAvailabilityCommitWriteCAS(commitWriteGuard);
6302
+ var _params$availabilityC4;
6303
+ (_params$availabilityC4 = params.availabilityCommitGuard) === null || _params$availabilityC4 === void 0 || _params$availabilityC4.call(params);
6304
+ _this21.assertAvailabilityCommitWriteCAS(commitWriteGuard);
6011
6305
  if (!availabilityCommitTargetGuard()) {
6012
- throw _this18.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '预约加购期间订单或业务已变化');
6306
+ throw _this21.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '预约加购期间订单或业务已变化');
6013
6307
  }
6014
6308
  if (!strictAvailability) return;
6015
6309
  var currentValidation = validateAvailabilitySelection(refreshedProjection, {
@@ -6027,7 +6321,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6027
6321
  existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
6028
6322
  existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
6029
6323
  if (!(isEditingSelection && !existingBookingUid)) {
6030
- _context54.next = 107;
6324
+ _context56.next = 107;
6031
6325
  break;
6032
6326
  }
6033
6327
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
@@ -6042,7 +6336,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6042
6336
  resources: refreshedProjection.resources,
6043
6337
  bookingUid: existingBookingUid || undefined,
6044
6338
  holder: (_params$orderProduct$3 = (_params$orderProduct6 = params.orderProduct) === null || _params$orderProduct6 === void 0 || (_params$orderProduct6 = _params$orderProduct6._extend) === null || _params$orderProduct6 === void 0 ? void 0 : _params$orderProduct6.holder) !== null && _params$orderProduct$3 !== void 0 ? _params$orderProduct$3 : params.mode === 'replace' ? undefined : (_existingBooking$hold = existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _existingBooking$hold !== void 0 ? _existingBooking$hold : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
6045
- holderIds: (_ref55 = (_params$orderProduct$4 = (_params$orderProduct7 = params.orderProduct) === null || _params$orderProduct7 === void 0 || (_params$orderProduct7 = _params$orderProduct7._extend) === null || _params$orderProduct7 === void 0 ? void 0 : _params$orderProduct7.holder_id) !== null && _params$orderProduct$4 !== void 0 ? _params$orderProduct$4 : (_params$orderProduct8 = params.orderProduct) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8._extend) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8.holder) === null || _params$orderProduct8 === void 0 ? void 0 : _params$orderProduct8.form_record) !== null && _ref55 !== void 0 ? _ref55 : params.mode === 'replace' ? undefined : (_existingBooking$meta2 = existingBooking === null || existingBooking === void 0 || (_existingBooking$meta3 = existingBooking.metadata) === null || _existingBooking$meta3 === void 0 ? void 0 : _existingBooking$meta3.holder_id) !== null && _existingBooking$meta2 !== void 0 ? _existingBooking$meta2 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold2 = existingBooking.holder) === null || _existingBooking$hold2 === void 0 ? void 0 : _existingBooking$hold2.form_record
6339
+ holderIds: (_ref57 = (_params$orderProduct$4 = (_params$orderProduct7 = params.orderProduct) === null || _params$orderProduct7 === void 0 || (_params$orderProduct7 = _params$orderProduct7._extend) === null || _params$orderProduct7 === void 0 ? void 0 : _params$orderProduct7.holder_id) !== null && _params$orderProduct$4 !== void 0 ? _params$orderProduct$4 : (_params$orderProduct8 = params.orderProduct) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8._extend) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8.holder) === null || _params$orderProduct8 === void 0 ? void 0 : _params$orderProduct8.form_record) !== null && _ref57 !== void 0 ? _ref57 : params.mode === 'replace' ? undefined : (_existingBooking$meta2 = existingBooking === null || existingBooking === void 0 || (_existingBooking$meta3 = existingBooking.metadata) === null || _existingBooking$meta3 === void 0 ? void 0 : _existingBooking$meta3.holder_id) !== null && _existingBooking$meta2 !== void 0 ? _existingBooking$meta2 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold2 = existingBooking.holder) === null || _existingBooking$hold2 === void 0 ? void 0 : _existingBooking$hold2.form_record
6046
6340
  });
6047
6341
  if (params.mode === 'replace') {
6048
6342
  // A different product must not inherit the previous product/resource's completed forms.
@@ -6054,7 +6348,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6054
6348
  quantity: bookingCount
6055
6349
  }), 'unified_booking_sales', product);
6056
6350
  if (transformed) {
6057
- _context54.next = 113;
6351
+ _context56.next = 113;
6058
6352
  break;
6059
6353
  }
6060
6354
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
@@ -6075,12 +6369,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6075
6369
  productLineUids = [];
6076
6370
  bookingUids = [];
6077
6371
  if (!(isPartyReplacement && editingLine && params.productLineUid)) {
6078
- _context54.next = 130;
6372
+ _context56.next = 130;
6079
6373
  break;
6080
6374
  }
6081
6375
  relatedRetailProducts = params.relatedRetailProducts.map(function (source) {
6082
- var line = _this18.buildUnifiedOrderProduct(source, 'unified_booking_sales_retail');
6376
+ var _line$metadata3;
6377
+ var line = _this21.buildUnifiedOrderProduct(source, 'unified_booking_sales_retail');
6083
6378
  if (!line) throw new AvailabilityError('INVALID_TARGET_FILTER', '无法生成附加商品订单行');
6379
+ if (((_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.venue_booking_role) === 'party_extra') {
6380
+ line.holder_config = {
6381
+ status: 'disable',
6382
+ required: 0
6383
+ };
6384
+ line.metadata.holder_config = {
6385
+ status: 'disable',
6386
+ required: 0
6387
+ };
6388
+ }
6084
6389
  // This is the only replacement-specific UID restore. Order checks ownership/collisions.
6085
6390
  var sourceUid = getProductLineUid(source);
6086
6391
  if (sourceUid) {
@@ -6090,7 +6395,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6090
6395
  }
6091
6396
  return line;
6092
6397
  });
6093
- _context54.next = 123;
6398
+ _context56.next = 123;
6094
6399
  return this.store.order.replaceBookingProductWithRelatedRetail({
6095
6400
  productLineUid: params.productLineUid,
6096
6401
  product: transformed,
@@ -6105,11 +6410,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6105
6410
  bookingUid = existingBookingUid;
6106
6411
  productLineUids = [productLineUid];
6107
6412
  bookingUids = [bookingUid];
6108
- _context54.next = 164;
6413
+ _context56.next = 164;
6109
6414
  break;
6110
6415
  case 130:
6111
6416
  if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
6112
- _context54.next = 150;
6417
+ _context56.next = 150;
6113
6418
  break;
6114
6419
  }
6115
6420
  transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
@@ -6121,7 +6426,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6121
6426
  });
6122
6427
  update = _objectSpread(_objectSpread({
6123
6428
  product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
6124
- product_variant_id: (_ref56 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref56 !== void 0 ? _ref56 : 0,
6429
+ product_variant_id: (_ref58 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref58 !== void 0 ? _ref58 : 0,
6125
6430
  unique_identification_number: params.productLineUid,
6126
6431
  updates: transformed,
6127
6432
  booking: booking
@@ -6131,27 +6436,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6131
6436
  allow_booking_discount_reapply: params.allowBookingDiscountReapply
6132
6437
  } : {});
6133
6438
  if (!availabilityCommitGuard) {
6134
- _context54.next = 142;
6439
+ _context56.next = 142;
6135
6440
  break;
6136
6441
  }
6137
- _context54.next = 139;
6442
+ _context56.next = 139;
6138
6443
  return this.updateOrderProducts([update], {
6139
6444
  beforeApply: availabilityCommitGuard,
6140
6445
  isCurrentOrder: availabilityCommitTargetGuard
6141
6446
  });
6142
6447
  case 139:
6143
6448
  guardedCommitPublished = true;
6144
- _context54.next = 144;
6449
+ _context56.next = 144;
6145
6450
  break;
6146
6451
  case 142:
6147
- _context54.next = 144;
6452
+ _context56.next = 144;
6148
6453
  return this.updateOrderProduct(update);
6149
6454
  case 144:
6150
6455
  productLineUid = params.productLineUid;
6151
6456
  bookingUid = existingBookingUid;
6152
6457
  productLineUids = [productLineUid];
6153
6458
  bookingUids = [bookingUid];
6154
- _context54.next = 164;
6459
+ _context56.next = 164;
6155
6460
  break;
6156
6461
  case 150:
6157
6462
  beforeProductLineUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || []).map(function (line) {
@@ -6161,7 +6466,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6161
6466
  return getBookingUid(item);
6162
6467
  }).filter(Boolean));
6163
6468
  availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
6164
- _context54.next = 155;
6469
+ _context56.next = 155;
6165
6470
  return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length || availabilityCommitGuard ? _objectSpread(_objectSpread({}, (_params$salesNotes2 = params.salesNotes) !== null && _params$salesNotes2 !== void 0 && _params$salesNotes2.length ? {
6166
6471
  salesNotes: params.salesNotes
6167
6472
  } : {}), availabilityCommitGuard ? {
@@ -6169,16 +6474,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6169
6474
  availabilityCommitTargetGuard: availabilityCommitTargetGuard
6170
6475
  } : {}) : undefined);
6171
6476
  case 155:
6172
- products = _context54.sent;
6477
+ products = _context56.sent;
6173
6478
  guardedCommitPublished = hasCommitGuard;
6174
6479
  addedLines = products.filter(function (line) {
6175
- var _line$product_id, _line$metadata;
6176
- return sameAvailabilityId((_line$product_id = line.product_id) !== null && _line$product_id !== void 0 ? _line$product_id : line.id, refreshedCandidate.productId) && ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeProductLineUids.has(getProductLineUid(line));
6480
+ var _line$product_id, _line$metadata4;
6481
+ return sameAvailabilityId((_line$product_id = line.product_id) !== null && _line$product_id !== void 0 ? _line$product_id : line.id, refreshedCandidate.productId) && ((_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.availability_candidate_key) === refreshedCandidate.key && !beforeProductLineUids.has(getProductLineUid(line));
6177
6482
  });
6178
6483
  productLineUids = addedLines.map(function (line) {
6179
6484
  return getProductLineUid(line);
6180
6485
  }).filter(Boolean);
6181
- addedBookings = (((_ref57 = hasCommitGuard ? guardedOrder : this.getTempOrder()) === null || _ref57 === void 0 ? void 0 : _ref57.bookings) || []).filter(function (item) {
6486
+ addedBookings = (((_ref59 = hasCommitGuard ? guardedOrder : this.getTempOrder()) === null || _ref59 === void 0 ? void 0 : _ref59.bookings) || []).filter(function (item) {
6182
6487
  var _item$metadata;
6183
6488
  return ((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeBookingUids.has(getBookingUid(item));
6184
6489
  });
@@ -6187,8 +6492,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6187
6492
  }).filter(Boolean);
6188
6493
  if (bookingUids.length === 0) {
6189
6494
  bookingUids = addedLines.map(function (line) {
6190
- var _ref58, _line$booking_uid, _line$metadata2;
6191
- return String((_ref58 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.booking_uid) !== null && _ref58 !== void 0 ? _ref58 : '');
6495
+ var _ref60, _line$booking_uid, _line$metadata5;
6496
+ return String((_ref60 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata5 = line.metadata) === null || _line$metadata5 === void 0 ? void 0 : _line$metadata5.booking_uid) !== null && _ref60 !== void 0 ? _ref60 : '');
6192
6497
  }).filter(Boolean);
6193
6498
  }
6194
6499
  productLineUid = productLineUids[productLineUids.length - 1] || '';
@@ -6209,60 +6514,60 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
6209
6514
  bookingUids: bookingUids
6210
6515
  };
6211
6516
  if (!targetStillCurrent) {
6212
- _context54.next = 182;
6517
+ _context56.next = 182;
6213
6518
  break;
6214
6519
  }
6215
6520
  // A notification failure after publication must not invite a duplicate add.
6216
6521
  emit = function emit() {
6217
- return _this18.core.effects.emit("".concat(_this18.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
6522
+ return _this21.core.effects.emit("".concat(_this21.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
6218
6523
  };
6219
6524
  if (!guardedCommitPublished) {
6220
- _context54.next = 180;
6525
+ _context56.next = 180;
6221
6526
  break;
6222
6527
  }
6223
- _context54.prev = 171;
6224
- _context54.next = 174;
6528
+ _context56.prev = 171;
6529
+ _context56.next = 174;
6225
6530
  return emit();
6226
6531
  case 174:
6227
- _context54.next = 178;
6532
+ _context56.next = 178;
6228
6533
  break;
6229
6534
  case 176:
6230
- _context54.prev = 176;
6231
- _context54.t0 = _context54["catch"](171);
6535
+ _context56.prev = 176;
6536
+ _context56.t0 = _context56["catch"](171);
6232
6537
  case 178:
6233
- _context54.next = 182;
6538
+ _context56.next = 182;
6234
6539
  break;
6235
6540
  case 180:
6236
- _context54.next = 182;
6541
+ _context56.next = 182;
6237
6542
  return emit();
6238
6543
  case 182:
6239
- return _context54.abrupt("return", result);
6544
+ return _context56.abrupt("return", result);
6240
6545
  case 183:
6241
- _context54.prev = 183;
6546
+ _context56.prev = 183;
6242
6547
  release = this.releaseAvailabilityCommitLock(normalizedContextId);
6243
6548
  if (!guardedCommitPublished) {
6244
- _context54.next = 190;
6549
+ _context56.next = 190;
6245
6550
  break;
6246
6551
  }
6247
- _context54.next = 188;
6552
+ _context56.next = 188;
6248
6553
  return release.catch(function () {
6249
6554
  return undefined;
6250
6555
  });
6251
6556
  case 188:
6252
- _context54.next = 192;
6557
+ _context56.next = 192;
6253
6558
  break;
6254
6559
  case 190:
6255
- _context54.next = 192;
6560
+ _context56.next = 192;
6256
6561
  return release;
6257
6562
  case 192:
6258
- return _context54.finish(183);
6563
+ return _context56.finish(183);
6259
6564
  case 193:
6260
6565
  case "end":
6261
- return _context54.stop();
6566
+ return _context56.stop();
6262
6567
  }
6263
- }, _callee54, this, [[18,, 183, 193], [171, 176]]);
6568
+ }, _callee56, this, [[18,, 183, 193], [171, 176]]);
6264
6569
  }));
6265
- function commitAvailabilitySelection(_x40, _x41) {
6570
+ function commitAvailabilitySelection(_x43, _x44) {
6266
6571
  return _commitAvailabilitySelection.apply(this, arguments);
6267
6572
  }
6268
6573
  return commitAvailabilitySelection;