@pisell/pisellos 0.10.49 → 0.10.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/modules/Discount/types.d.ts +2 -0
  2. package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
  3. package/dist/modules/FulfillmentTiming/index.js +407 -0
  4. package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
  5. package/dist/modules/FulfillmentTiming/types.js +1 -0
  6. package/dist/modules/OpenData/types.d.ts +6 -0
  7. package/dist/modules/Order/index.d.ts +19 -1
  8. package/dist/modules/Order/index.js +362 -217
  9. package/dist/modules/Order/pickupTiming.d.ts +46 -0
  10. package/dist/modules/Order/pickupTiming.js +53 -0
  11. package/dist/modules/Order/types.d.ts +11 -1
  12. package/dist/modules/Order/utils.d.ts +10 -0
  13. package/dist/modules/Order/utils.js +145 -85
  14. package/dist/modules/Rules/index.js +45 -26
  15. package/dist/modules/Rules/types.d.ts +4 -0
  16. package/dist/modules/index.d.ts +1 -0
  17. package/dist/modules/index.js +1 -0
  18. package/dist/server/modules/order/index.d.ts +8 -0
  19. package/dist/server/modules/order/index.js +506 -453
  20. package/dist/server/modules/order/types.d.ts +1 -0
  21. package/dist/server/utils/small-ticket.js +173 -95
  22. package/dist/solution/BaseSales/index.d.ts +23 -0
  23. package/dist/solution/BaseSales/index.js +1216 -1031
  24. package/dist/solution/BaseSales/pickupTiming.d.ts +37 -0
  25. package/dist/solution/BaseSales/pickupTiming.js +482 -0
  26. package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
  27. package/dist/solution/BookingByStep/index.d.ts +1 -1
  28. package/dist/solution/BookingTicket/utils/cartView.js +3 -1
  29. package/dist/solution/UnifiedBookingSales/index.d.ts +2 -0
  30. package/dist/solution/UnifiedBookingSales/index.js +583 -531
  31. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  32. package/lib/modules/Discount/types.d.ts +2 -0
  33. package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
  34. package/lib/modules/FulfillmentTiming/index.js +359 -0
  35. package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
  36. package/lib/modules/FulfillmentTiming/types.js +5 -0
  37. package/lib/modules/OpenData/types.d.ts +6 -0
  38. package/lib/modules/Order/index.d.ts +19 -1
  39. package/lib/modules/Order/index.js +120 -7
  40. package/lib/modules/Order/pickupTiming.d.ts +46 -0
  41. package/lib/modules/Order/pickupTiming.js +61 -0
  42. package/lib/modules/Order/types.d.ts +11 -1
  43. package/lib/modules/Order/utils.d.ts +10 -0
  44. package/lib/modules/Order/utils.js +58 -4
  45. package/lib/modules/Rules/index.js +24 -13
  46. package/lib/modules/Rules/types.d.ts +4 -0
  47. package/lib/modules/index.d.ts +1 -0
  48. package/lib/modules/index.js +11 -0
  49. package/lib/server/modules/order/index.d.ts +8 -0
  50. package/lib/server/modules/order/index.js +19 -0
  51. package/lib/server/modules/order/types.d.ts +1 -0
  52. package/lib/server/utils/small-ticket.js +93 -22
  53. package/lib/solution/BaseSales/index.d.ts +23 -0
  54. package/lib/solution/BaseSales/index.js +104 -1
  55. package/lib/solution/BaseSales/pickupTiming.d.ts +37 -0
  56. package/lib/solution/BaseSales/pickupTiming.js +222 -0
  57. package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
  58. package/lib/solution/BookingByStep/index.d.ts +1 -1
  59. package/lib/solution/BookingTicket/utils/cartView.js +3 -1
  60. package/lib/solution/UnifiedBookingSales/index.d.ts +2 -0
  61. package/lib/solution/UnifiedBookingSales/index.js +20 -0
  62. package/package.json +1 -1
@@ -1314,6 +1314,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1314
1314
  _defineProperty(_assertThisInitialized(_this), "defaultName", 'unifiedBookingSales');
1315
1315
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
1316
1316
  _defineProperty(_assertThisInitialized(_this), "store", {});
1317
+ _defineProperty(_assertThisInitialized(_this), "pickupTimingEnabled", true);
1317
1318
  _defineProperty(_assertThisInitialized(_this), "unifiedProductCatalog", []);
1318
1319
  _defineProperty(_assertThisInitialized(_this), "availabilityRuntimeOffsetMinutes", null);
1319
1320
  _defineProperty(_assertThisInitialized(_this), "availabilityScheduleCatalog", null);
@@ -2287,6 +2288,57 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2287
2288
  }
2288
2289
  return getOpenData;
2289
2290
  }()
2291
+ }, {
2292
+ key: "loadPickupTimingOpenData",
2293
+ value: function () {
2294
+ var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(force) {
2295
+ var _ref33, _this$otherParams$bus3, _this$otherParams20, _this$otherParams21, _this$getSubmitOrderS;
2296
+ var scope, businessCode, channel, config;
2297
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2298
+ while (1) switch (_context13.prev = _context13.next) {
2299
+ case 0:
2300
+ scope = this.getPickupTimingScope(); // A fresh validation must not borrow a request started for a previous store/context.
2301
+ if (!(force && this.loadOpenDataInFlight)) {
2302
+ _context13.next = 4;
2303
+ break;
2304
+ }
2305
+ _context13.next = 4;
2306
+ return this.loadOpenDataInFlight;
2307
+ case 4:
2308
+ if (!(scope !== this.getPickupTimingScope())) {
2309
+ _context13.next = 6;
2310
+ break;
2311
+ }
2312
+ throw new Error('Store settings changed. Please try again.');
2313
+ case 6:
2314
+ businessCode = String((_ref33 = (_this$otherParams$bus3 = (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.businessCode) !== null && _this$otherParams$bus3 !== void 0 ? _this$otherParams$bus3 : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.business_code) !== null && _ref33 !== void 0 ? _ref33 : '').trim();
2315
+ channel = String((_this$getSubmitOrderS = this.getSubmitOrderSalesChannel()) !== null && _this$getSubmitOrderS !== void 0 ? _this$getSubmitOrderS : '').trim();
2316
+ _context13.next = 10;
2317
+ return this.loadOpenData({
2318
+ businessCode: businessCode,
2319
+ channel: channel,
2320
+ force: force
2321
+ });
2322
+ case 10:
2323
+ config = _context13.sent;
2324
+ if (!(scope !== this.getPickupTimingScope())) {
2325
+ _context13.next = 13;
2326
+ break;
2327
+ }
2328
+ throw new Error('Store settings changed. Please try again.');
2329
+ case 13:
2330
+ return _context13.abrupt("return", config);
2331
+ case 14:
2332
+ case "end":
2333
+ return _context13.stop();
2334
+ }
2335
+ }, _callee13, this);
2336
+ }));
2337
+ function loadPickupTimingOpenData(_x8) {
2338
+ return _loadPickupTimingOpenData.apply(this, arguments);
2339
+ }
2340
+ return loadPickupTimingOpenData;
2341
+ }()
2290
2342
  }, {
2291
2343
  key: "resetAllergyItemRuleState",
2292
2344
  value: function resetAllergyItemRuleState() {
@@ -2297,19 +2349,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2297
2349
  }, {
2298
2350
  key: "fetchAllergyItemRuleConfigs",
2299
2351
  value: function () {
2300
- var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(strategyModelIds) {
2352
+ var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(strategyModelIds) {
2301
2353
  var _response$data, response, list;
2302
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2303
- while (1) switch (_context13.prev = _context13.next) {
2354
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2355
+ while (1) switch (_context14.prev = _context14.next) {
2304
2356
  case 0:
2305
2357
  if (strategyModelIds.length) {
2306
- _context13.next = 2;
2358
+ _context14.next = 2;
2307
2359
  break;
2308
2360
  }
2309
- return _context13.abrupt("return", []);
2361
+ return _context14.abrupt("return", []);
2310
2362
  case 2:
2311
- _context13.prev = 2;
2312
- _context13.next = 5;
2363
+ _context14.prev = 2;
2364
+ _context14.next = 5;
2313
2365
  return this.request.get('/promotion', {
2314
2366
  skip: 1,
2315
2367
  num: 99,
@@ -2317,28 +2369,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2317
2369
  ids: strategyModelIds
2318
2370
  });
2319
2371
  case 5:
2320
- response = _context13.sent;
2372
+ response = _context14.sent;
2321
2373
  if (!((response === null || response === void 0 ? void 0 : response.code) !== 200 || !Array.isArray(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list))) {
2322
- _context13.next = 8;
2374
+ _context14.next = 8;
2323
2375
  break;
2324
2376
  }
2325
2377
  throw new Error('[UnifiedBookingSales] 商品过敏策略加载失败');
2326
2378
  case 8:
2327
2379
  list = response.data.list;
2328
- return _context13.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
2380
+ return _context14.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
2329
2381
  return item === null || item === void 0 ? void 0 : item.metadata;
2330
2382
  })));
2331
2383
  case 12:
2332
- _context13.prev = 12;
2333
- _context13.t0 = _context13["catch"](2);
2334
- throw _context13.t0;
2384
+ _context14.prev = 12;
2385
+ _context14.t0 = _context14["catch"](2);
2386
+ throw _context14.t0;
2335
2387
  case 15:
2336
2388
  case "end":
2337
- return _context13.stop();
2389
+ return _context14.stop();
2338
2390
  }
2339
- }, _callee13, this, [[2, 12]]);
2391
+ }, _callee14, this, [[2, 12]]);
2340
2392
  }));
2341
- function fetchAllergyItemRuleConfigs(_x8) {
2393
+ function fetchAllergyItemRuleConfigs(_x9) {
2342
2394
  return _fetchAllergyItemRuleConfigs.apply(this, arguments);
2343
2395
  }
2344
2396
  return fetchAllergyItemRuleConfigs;
@@ -2346,70 +2398,70 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2346
2398
  }, {
2347
2399
  key: "ensureAllergyItemRuleConfigsLoaded",
2348
2400
  value: function () {
2349
- var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
2401
+ var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
2350
2402
  var _this3 = this;
2351
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2352
- while (1) switch (_context15.prev = _context15.next) {
2403
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2404
+ while (1) switch (_context16.prev = _context16.next) {
2353
2405
  case 0:
2354
2406
  if (!(this.allergyItemRuleConfigs.length > 0)) {
2355
- _context15.next = 2;
2407
+ _context16.next = 2;
2356
2408
  break;
2357
2409
  }
2358
- return _context15.abrupt("return", this.allergyItemRuleConfigs);
2410
+ return _context16.abrupt("return", this.allergyItemRuleConfigs);
2359
2411
  case 2:
2360
2412
  if (!this.allergyItemRuleConfigsPromise) {
2361
- _context15.next = 4;
2413
+ _context16.next = 4;
2362
2414
  break;
2363
2415
  }
2364
- return _context15.abrupt("return", this.allergyItemRuleConfigsPromise);
2416
+ return _context16.abrupt("return", this.allergyItemRuleConfigsPromise);
2365
2417
  case 4:
2366
- this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
2418
+ this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
2367
2419
  var _this3$otherParams;
2368
2420
  var staticConfigs, openData, enabled, strategyModelIds, loaded;
2369
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2370
- while (1) switch (_context14.prev = _context14.next) {
2421
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2422
+ while (1) switch (_context15.prev = _context15.next) {
2371
2423
  case 0:
2372
2424
  staticConfigs = normalizeItemRuleStrategyConfigs((_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 || (_this3$otherParams = _this3$otherParams.itemRule) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.strategyConfigs);
2373
2425
  if (!(staticConfigs.length > 0)) {
2374
- _context14.next = 5;
2426
+ _context15.next = 5;
2375
2427
  break;
2376
2428
  }
2377
2429
  _this3.allergyItemRuleConfigs = staticConfigs;
2378
2430
  _this3.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
2379
- return _context14.abrupt("return", staticConfigs);
2431
+ return _context15.abrupt("return", staticConfigs);
2380
2432
  case 5:
2381
- _context14.next = 7;
2433
+ _context15.next = 7;
2382
2434
  return _this3.getOpenData();
2383
2435
  case 7:
2384
- openData = _context14.sent;
2436
+ openData = _context15.sent;
2385
2437
  enabled = toConfiguredBoolean(openData === null || openData === void 0 ? void 0 : openData['sale.enable_item_rules']);
2386
2438
  strategyModelIds = normalizePositiveIntegerList(openData === null || openData === void 0 ? void 0 : openData['sale.enabled_item_rules']);
2387
2439
  if (!(!enabled || !strategyModelIds.length)) {
2388
- _context14.next = 13;
2440
+ _context15.next = 13;
2389
2441
  break;
2390
2442
  }
2391
2443
  _this3.allergyItemRuleEvaluator.setStrategyConfigs([]);
2392
- return _context14.abrupt("return", []);
2444
+ return _context15.abrupt("return", []);
2393
2445
  case 13:
2394
- _context14.next = 15;
2446
+ _context15.next = 15;
2395
2447
  return _this3.fetchAllergyItemRuleConfigs(strategyModelIds);
2396
2448
  case 15:
2397
- loaded = _context14.sent;
2449
+ loaded = _context15.sent;
2398
2450
  _this3.allergyItemRuleConfigs = loaded;
2399
2451
  _this3.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
2400
- return _context14.abrupt("return", loaded);
2452
+ return _context15.abrupt("return", loaded);
2401
2453
  case 19:
2402
2454
  case "end":
2403
- return _context14.stop();
2455
+ return _context15.stop();
2404
2456
  }
2405
- }, _callee14);
2457
+ }, _callee15);
2406
2458
  }))();
2407
- return _context15.abrupt("return", this.allergyItemRuleConfigsPromise);
2459
+ return _context16.abrupt("return", this.allergyItemRuleConfigsPromise);
2408
2460
  case 6:
2409
2461
  case "end":
2410
- return _context15.stop();
2462
+ return _context16.stop();
2411
2463
  }
2412
- }, _callee15, this);
2464
+ }, _callee16, this);
2413
2465
  }));
2414
2466
  function ensureAllergyItemRuleConfigsLoaded() {
2415
2467
  return _ensureAllergyItemRuleConfigsLoaded.apply(this, arguments);
@@ -2423,51 +2475,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2423
2475
  }, {
2424
2476
  key: "resolveProductAllergyRequirement",
2425
2477
  value: (function () {
2426
- var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
2427
- var _this$otherParams20, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref35, _runtimeConfig$servic, _this$otherParams21, _ref36, _ref37, _params$channel, _this$otherParams22, _this$otherParams23, _runtimeConfig$submis;
2478
+ var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
2479
+ var _this$otherParams22, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref36, _runtimeConfig$servic, _this$otherParams23, _ref37, _ref38, _params$channel, _this$otherParams24, _this$otherParams25, _runtimeConfig$submis;
2428
2480
  var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
2429
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2430
- while (1) switch (_context16.prev = _context16.next) {
2481
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2482
+ while (1) switch (_context17.prev = _context17.next) {
2431
2483
  case 0:
2432
2484
  productId = normalizePositiveInteger(params.productId);
2433
2485
  if (productId) {
2434
- _context16.next = 3;
2486
+ _context17.next = 3;
2435
2487
  break;
2436
2488
  }
2437
- return _context16.abrupt("return", null);
2489
+ return _context17.abrupt("return", null);
2438
2490
  case 3:
2439
- _context16.next = 5;
2491
+ _context17.next = 5;
2440
2492
  return this.ensureAllergyItemRuleConfigsLoaded();
2441
2493
  case 5:
2442
- strategyConfigs = _context16.sent;
2494
+ strategyConfigs = _context17.sent;
2443
2495
  if (strategyConfigs.length) {
2444
- _context16.next = 8;
2496
+ _context17.next = 8;
2445
2497
  break;
2446
2498
  }
2447
- return _context16.abrupt("return", null);
2499
+ return _context17.abrupt("return", null);
2448
2500
  case 8:
2449
2501
  productVariantId = normalizePositiveInteger(params.productVariantId);
2450
- runtimeConfig = ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.itemRule) || {};
2502
+ runtimeConfig = ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.itemRule) || {};
2451
2503
  runtimePax = runtimeConfig.pax || {};
2452
2504
  cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
2453
- var _item$product_id, _item$product_variant, _ref34, _item$num;
2505
+ var _item$product_id, _item$product_variant, _ref35, _item$num;
2454
2506
  return {
2455
2507
  product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id),
2456
2508
  product_variant_id: Number((_item$product_variant = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0) || undefined,
2457
- quantity: Number((_ref34 = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref34 !== void 0 ? _ref34 : 0)
2509
+ quantity: Number((_ref35 = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref35 !== void 0 ? _ref35 : 0)
2458
2510
  };
2459
2511
  }).filter(function (item) {
2460
2512
  return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
2461
2513
  });
2462
- return _context16.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
2514
+ return _context17.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
2463
2515
  pax: {
2464
2516
  total: Number((_runtimePax$total = runtimePax.total) !== null && _runtimePax$total !== void 0 ? _runtimePax$total : 0) || 0,
2465
2517
  adult: Number((_runtimePax$adult = runtimePax.adult) !== null && _runtimePax$adult !== void 0 ? _runtimePax$adult : 0) || 0,
2466
2518
  child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
2467
2519
  },
2468
2520
  cartItems: cartItems,
2469
- serviceType: String((_ref35 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.serviceType) !== null && _ref35 !== void 0 ? _ref35 : ''),
2470
- channel: String((_ref36 = (_ref37 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.channel) !== null && _ref37 !== void 0 ? _ref37 : (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.platform) !== null && _ref36 !== void 0 ? _ref36 : ''),
2521
+ serviceType: String((_ref36 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.serviceType) !== null && _ref36 !== void 0 ? _ref36 : ''),
2522
+ channel: String((_ref37 = (_ref38 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.channel) !== null && _ref38 !== void 0 ? _ref38 : (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.platform) !== null && _ref37 !== void 0 ? _ref37 : ''),
2471
2523
  currentProduct: _objectSpread({
2472
2524
  product_id: productId
2473
2525
  }, productVariantId ? {
@@ -2479,11 +2531,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2479
2531
  }));
2480
2532
  case 13:
2481
2533
  case "end":
2482
- return _context16.stop();
2534
+ return _context17.stop();
2483
2535
  }
2484
- }, _callee16, this);
2536
+ }, _callee17, this);
2485
2537
  }));
2486
- function resolveProductAllergyRequirement(_x9) {
2538
+ function resolveProductAllergyRequirement(_x10) {
2487
2539
  return _resolveProductAllergyRequirement.apply(this, arguments);
2488
2540
  }
2489
2541
  return resolveProductAllergyRequirement;
@@ -2499,27 +2551,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2499
2551
  }, {
2500
2552
  key: "getInvoiceLayoutConfig",
2501
2553
  value: function () {
2502
- var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
2554
+ var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2503
2555
  var openData;
2504
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2505
- while (1) switch (_context17.prev = _context17.next) {
2556
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2557
+ while (1) switch (_context18.prev = _context18.next) {
2506
2558
  case 0:
2507
- _context17.next = 2;
2559
+ _context18.next = 2;
2508
2560
  return this.getOpenData();
2509
2561
  case 2:
2510
- openData = _context17.sent;
2562
+ openData = _context18.sent;
2511
2563
  if (!(!openData || !this.store.openData)) {
2512
- _context17.next = 5;
2564
+ _context18.next = 5;
2513
2565
  break;
2514
2566
  }
2515
- return _context17.abrupt("return", getDefaultInvoiceLayoutConfig());
2567
+ return _context18.abrupt("return", getDefaultInvoiceLayoutConfig());
2516
2568
  case 5:
2517
- return _context17.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
2569
+ return _context18.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
2518
2570
  case 6:
2519
2571
  case "end":
2520
- return _context17.stop();
2572
+ return _context18.stop();
2521
2573
  }
2522
- }, _callee17, this);
2574
+ }, _callee18, this);
2523
2575
  }));
2524
2576
  function getInvoiceLayoutConfig() {
2525
2577
  return _getInvoiceLayoutConfig.apply(this, arguments);
@@ -2529,27 +2581,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2529
2581
  }, {
2530
2582
  key: "getInvoiceTemplateSettings",
2531
2583
  value: function () {
2532
- var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2584
+ var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2533
2585
  var openData;
2534
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2535
- while (1) switch (_context18.prev = _context18.next) {
2586
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2587
+ while (1) switch (_context19.prev = _context19.next) {
2536
2588
  case 0:
2537
- _context18.next = 2;
2589
+ _context19.next = 2;
2538
2590
  return this.getOpenData();
2539
2591
  case 2:
2540
- openData = _context18.sent;
2592
+ openData = _context19.sent;
2541
2593
  if (!(!openData || !this.store.openData)) {
2542
- _context18.next = 5;
2594
+ _context19.next = 5;
2543
2595
  break;
2544
2596
  }
2545
- return _context18.abrupt("return", getDefaultInvoiceTemplateSettings());
2597
+ return _context19.abrupt("return", getDefaultInvoiceTemplateSettings());
2546
2598
  case 5:
2547
- return _context18.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
2599
+ return _context19.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
2548
2600
  case 6:
2549
2601
  case "end":
2550
- return _context18.stop();
2602
+ return _context19.stop();
2551
2603
  }
2552
- }, _callee18, this);
2604
+ }, _callee19, this);
2553
2605
  }));
2554
2606
  function getInvoiceTemplateSettings() {
2555
2607
  return _getInvoiceTemplateSettings.apply(this, arguments);
@@ -2559,9 +2611,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2559
2611
  }, {
2560
2612
  key: "isInvoiceOpenDataCacheCurrent",
2561
2613
  value: function isInvoiceOpenDataCacheCurrent() {
2562
- var _this$otherParams24, _this$otherParams25;
2563
- var businessCode = String(((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.businessCode) || '').trim();
2564
- var channel = String(((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.channel) || '').trim();
2614
+ var _this$otherParams26, _this$otherParams27;
2615
+ var businessCode = String(((_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.businessCode) || '').trim();
2616
+ var channel = String(((_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.channel) || '').trim();
2565
2617
  if (!businessCode || !channel) return false;
2566
2618
  return this.openDataTarget === "".concat(businessCode, "+").concat(channel);
2567
2619
  }
@@ -2572,14 +2624,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2572
2624
  }, {
2573
2625
  key: "getProtocol",
2574
2626
  value: (function () {
2575
- var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(policyId) {
2627
+ var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(policyId) {
2576
2628
  var normalizedPolicyId, policyUrl;
2577
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2578
- while (1) switch (_context19.prev = _context19.next) {
2629
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2630
+ while (1) switch (_context20.prev = _context20.next) {
2579
2631
  case 0:
2580
2632
  normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
2581
2633
  if (normalizedPolicyId) {
2582
- _context19.next = 3;
2634
+ _context20.next = 3;
2583
2635
  break;
2584
2636
  }
2585
2637
  throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
@@ -2588,14 +2640,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2588
2640
  if (this.otherParams.platform === 'kiosk' || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
2589
2641
  policyUrl = 'policy';
2590
2642
  }
2591
- return _context19.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
2643
+ return _context20.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
2592
2644
  case 6:
2593
2645
  case "end":
2594
- return _context19.stop();
2646
+ return _context20.stop();
2595
2647
  }
2596
- }, _callee19, this);
2648
+ }, _callee20, this);
2597
2649
  }));
2598
- function getProtocol(_x10) {
2650
+ function getProtocol(_x11) {
2599
2651
  return _getProtocol.apply(this, arguments);
2600
2652
  }
2601
2653
  return getProtocol;
@@ -2608,27 +2660,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2608
2660
  }, {
2609
2661
  key: "loadProducts",
2610
2662
  value: (function () {
2611
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
2663
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2612
2664
  var params,
2613
2665
  options,
2614
2666
  schedule_date,
2615
2667
  schedule_datetime,
2616
2668
  result,
2617
- _args20 = arguments;
2618
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2619
- while (1) switch (_context20.prev = _context20.next) {
2669
+ _args21 = arguments;
2670
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2671
+ while (1) switch (_context21.prev = _context21.next) {
2620
2672
  case 0:
2621
- params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
2622
- options = _args20.length > 1 ? _args20[1] : undefined;
2673
+ params = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
2674
+ options = _args21.length > 1 ? _args21[1] : undefined;
2623
2675
  if (this.store.products) {
2624
- _context20.next = 4;
2676
+ _context21.next = 4;
2625
2677
  break;
2626
2678
  }
2627
2679
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
2628
2680
  case 4:
2629
2681
  schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
2630
2682
  schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
2631
- _context20.next = 8;
2683
+ _context21.next = 8;
2632
2684
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
2633
2685
  with_count: ['bundleGroup', 'optionGroup'],
2634
2686
  with_schedule: 1
@@ -2638,17 +2690,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2638
2690
  cacheId: this.cacheId
2639
2691
  }), options);
2640
2692
  case 8:
2641
- result = _context20.sent;
2693
+ result = _context21.sent;
2642
2694
  this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
2643
- _context20.next = 12;
2695
+ _context21.next = 12;
2644
2696
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
2645
2697
  case 12:
2646
- return _context20.abrupt("return", result);
2698
+ return _context21.abrupt("return", result);
2647
2699
  case 13:
2648
2700
  case "end":
2649
- return _context20.stop();
2701
+ return _context21.stop();
2650
2702
  }
2651
- }, _callee20, this);
2703
+ }, _callee21, this);
2652
2704
  }));
2653
2705
  function loadProducts() {
2654
2706
  return _loadProducts.apply(this, arguments);
@@ -2658,25 +2710,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2658
2710
  }, {
2659
2711
  key: "queryProducts",
2660
2712
  value: function () {
2661
- var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2713
+ var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2662
2714
  var params,
2663
- _args21 = arguments;
2664
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2665
- while (1) switch (_context21.prev = _context21.next) {
2715
+ _args22 = arguments;
2716
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2717
+ while (1) switch (_context22.prev = _context22.next) {
2666
2718
  case 0:
2667
- params = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
2719
+ params = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
2668
2720
  if (this.store.products) {
2669
- _context21.next = 3;
2721
+ _context22.next = 3;
2670
2722
  break;
2671
2723
  }
2672
2724
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
2673
2725
  case 3:
2674
- return _context21.abrupt("return", this.store.products.queryProducts(params));
2726
+ return _context22.abrupt("return", this.store.products.queryProducts(params));
2675
2727
  case 4:
2676
2728
  case "end":
2677
- return _context21.stop();
2729
+ return _context22.stop();
2678
2730
  }
2679
- }, _callee21, this);
2731
+ }, _callee22, this);
2680
2732
  }));
2681
2733
  function queryProducts() {
2682
2734
  return _queryProducts.apply(this, arguments);
@@ -2686,24 +2738,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2686
2738
  }, {
2687
2739
  key: "loadScheduleAvailableDate",
2688
2740
  value: (function () {
2689
- var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2690
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2691
- while (1) switch (_context22.prev = _context22.next) {
2741
+ var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
2742
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2743
+ while (1) switch (_context23.prev = _context23.next) {
2692
2744
  case 0:
2693
2745
  if (this.store.schedule) {
2694
- _context22.next = 2;
2746
+ _context23.next = 2;
2695
2747
  break;
2696
2748
  }
2697
2749
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
2698
2750
  case 2:
2699
- return _context22.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
2751
+ return _context23.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
2700
2752
  case 3:
2701
2753
  case "end":
2702
- return _context22.stop();
2754
+ return _context23.stop();
2703
2755
  }
2704
- }, _callee22, this);
2756
+ }, _callee23, this);
2705
2757
  }));
2706
- function loadScheduleAvailableDate(_x11) {
2758
+ function loadScheduleAvailableDate(_x12) {
2707
2759
  return _loadScheduleAvailableDate.apply(this, arguments);
2708
2760
  }
2709
2761
  return loadScheduleAvailableDate;
@@ -2717,15 +2769,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2717
2769
  }, {
2718
2770
  key: "loadProductsByScheduleDate",
2719
2771
  value: (function () {
2720
- var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
2772
+ var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
2721
2773
  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;
2722
2774
  var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
2723
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2724
- while (1) switch (_context23.prev = _context23.next) {
2775
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2776
+ while (1) switch (_context24.prev = _context24.next) {
2725
2777
  case 0:
2726
2778
  date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
2727
2779
  if (this.store.schedule) {
2728
- _context23.next = 3;
2780
+ _context24.next = 3;
2729
2781
  break;
2730
2782
  }
2731
2783
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
@@ -2736,10 +2788,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2736
2788
  });
2737
2789
  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;
2738
2790
  if (!(!hasCachedDate && !hasOtherProducts)) {
2739
- _context23.next = 9;
2791
+ _context24.next = 9;
2740
2792
  break;
2741
2793
  }
2742
- _context23.next = 9;
2794
+ _context24.next = 9;
2743
2795
  return this.loadScheduleAvailableDate({
2744
2796
  startDate: date,
2745
2797
  endDate: date,
@@ -2759,45 +2811,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2759
2811
  return !productIdFilter || productIdFilter.has(String(id));
2760
2812
  });
2761
2813
  if (availableProductIds.length) {
2762
- _context23.next = 17;
2814
+ _context24.next = 17;
2763
2815
  break;
2764
2816
  }
2765
2817
  this.unifiedProductCatalog = [];
2766
- _context23.next = 16;
2818
+ _context24.next = 16;
2767
2819
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
2768
2820
  case 16:
2769
- return _context23.abrupt("return", []);
2821
+ return _context24.abrupt("return", []);
2770
2822
  case 17:
2771
- _context23.next = 19;
2823
+ _context24.next = 19;
2772
2824
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
2773
2825
  product_ids: availableProductIds,
2774
2826
  schedule_date: date
2775
2827
  }));
2776
2828
  case 19:
2777
- products = _context23.sent;
2829
+ products = _context24.sent;
2778
2830
  if (!(products.length || availableProductIds.length <= 1)) {
2779
- _context23.next = 22;
2831
+ _context24.next = 22;
2780
2832
  break;
2781
2833
  }
2782
- return _context23.abrupt("return", products);
2834
+ return _context24.abrupt("return", products);
2783
2835
  case 22:
2784
2836
  fallbackProducts = [];
2785
2837
  _iterator = _createForOfIteratorHelper(availableProductIds);
2786
- _context23.prev = 24;
2838
+ _context24.prev = 24;
2787
2839
  _iterator.s();
2788
2840
  case 26:
2789
2841
  if ((_step = _iterator.n()).done) {
2790
- _context23.next = 34;
2842
+ _context24.next = 34;
2791
2843
  break;
2792
2844
  }
2793
2845
  productId = _step.value;
2794
- _context23.next = 30;
2846
+ _context24.next = 30;
2795
2847
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
2796
2848
  product_ids: [productId],
2797
2849
  schedule_date: date
2798
2850
  }));
2799
2851
  case 30:
2800
- result = _context23.sent;
2852
+ result = _context24.sent;
2801
2853
  result.forEach(function (product) {
2802
2854
  var _id;
2803
2855
  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;
@@ -2809,32 +2861,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2809
2861
  }
2810
2862
  });
2811
2863
  case 32:
2812
- _context23.next = 26;
2864
+ _context24.next = 26;
2813
2865
  break;
2814
2866
  case 34:
2815
- _context23.next = 39;
2867
+ _context24.next = 39;
2816
2868
  break;
2817
2869
  case 36:
2818
- _context23.prev = 36;
2819
- _context23.t0 = _context23["catch"](24);
2820
- _iterator.e(_context23.t0);
2870
+ _context24.prev = 36;
2871
+ _context24.t0 = _context24["catch"](24);
2872
+ _iterator.e(_context24.t0);
2821
2873
  case 39:
2822
- _context23.prev = 39;
2874
+ _context24.prev = 39;
2823
2875
  _iterator.f();
2824
- return _context23.finish(39);
2876
+ return _context24.finish(39);
2825
2877
  case 42:
2826
2878
  this.unifiedProductCatalog = [].concat(fallbackProducts);
2827
- _context23.next = 45;
2879
+ _context24.next = 45;
2828
2880
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
2829
2881
  case 45:
2830
- return _context23.abrupt("return", fallbackProducts);
2882
+ return _context24.abrupt("return", fallbackProducts);
2831
2883
  case 46:
2832
2884
  case "end":
2833
- return _context23.stop();
2885
+ return _context24.stop();
2834
2886
  }
2835
- }, _callee23, this, [[24, 36, 39, 42]]);
2887
+ }, _callee24, this, [[24, 36, 39, 42]]);
2836
2888
  }));
2837
- function loadProductsByScheduleDate(_x12) {
2889
+ function loadProductsByScheduleDate(_x13) {
2838
2890
  return _loadProductsByScheduleDate.apply(this, arguments);
2839
2891
  }
2840
2892
  return loadProductsByScheduleDate;
@@ -2887,7 +2939,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2887
2939
  }, {
2888
2940
  key: "applyPlannerDiscounts",
2889
2941
  value: (function () {
2890
- var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2942
+ var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2891
2943
  var _params$customerId;
2892
2944
  var params,
2893
2945
  tempOrder,
@@ -2904,24 +2956,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2904
2956
  discount,
2905
2957
  discountId,
2906
2958
  nextTempOrder,
2907
- _args24 = arguments;
2908
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2909
- while (1) switch (_context24.prev = _context24.next) {
2959
+ _args25 = arguments;
2960
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2961
+ while (1) switch (_context25.prev = _context25.next) {
2910
2962
  case 0:
2911
- params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
2963
+ params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
2912
2964
  tempOrder = this.getTempOrder();
2913
2965
  requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
2914
2966
  parsedCustomerId = Number(requestedCustomerId);
2915
2967
  customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
2916
- _context24.next = 7;
2968
+ _context25.next = 7;
2917
2969
  return this.getSummary();
2918
2970
  case 7:
2919
- summaryBefore = _context24.sent;
2971
+ summaryBefore = _context25.sent;
2920
2972
  if (customerId) {
2921
- _context24.next = 10;
2973
+ _context25.next = 10;
2922
2974
  break;
2923
2975
  }
2924
- return _context24.abrupt("return", buildPlannerDiscountResult({
2976
+ return _context25.abrupt("return", buildPlannerDiscountResult({
2925
2977
  customerId: null,
2926
2978
  discountList: this.getDiscountList(),
2927
2979
  products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
@@ -2930,7 +2982,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2930
2982
  status: 'no_customer'
2931
2983
  }));
2932
2984
  case 10:
2933
- _context24.next = 12;
2985
+ _context25.next = 12;
2934
2986
  return this.loadDiscountConfig({
2935
2987
  customerId: customerId,
2936
2988
  action: 'create'
@@ -2942,7 +2994,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2942
2994
  return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
2943
2995
  });
2944
2996
  if (!preferredDiscount) {
2945
- _context24.next = 40;
2997
+ _context25.next = 40;
2946
2998
  break;
2947
2999
  }
2948
3000
  // A requested card is an explicit UI choice, not a best-effort preference. Clear prior
@@ -2954,98 +3006,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2954
3006
  return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
2955
3007
  });
2956
3008
  _iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
2957
- _context24.prev = 18;
3009
+ _context25.prev = 18;
2958
3010
  _iterator2.s();
2959
3011
  case 20:
2960
3012
  if ((_step2 = _iterator2.n()).done) {
2961
- _context24.next = 28;
3013
+ _context25.next = 28;
2962
3014
  break;
2963
3015
  }
2964
3016
  discount = _step2.value;
2965
3017
  discountId = Number(resolvePlannerDiscountId(discount));
2966
3018
  if (!Number.isFinite(discountId)) {
2967
- _context24.next = 26;
3019
+ _context25.next = 26;
2968
3020
  break;
2969
3021
  }
2970
- _context24.next = 26;
3022
+ _context25.next = 26;
2971
3023
  return this.setDiscountSelected({
2972
3024
  discountId: discountId,
2973
3025
  isSelected: false
2974
3026
  });
2975
3027
  case 26:
2976
- _context24.next = 20;
3028
+ _context25.next = 20;
2977
3029
  break;
2978
3030
  case 28:
2979
- _context24.next = 33;
3031
+ _context25.next = 33;
2980
3032
  break;
2981
3033
  case 30:
2982
- _context24.prev = 30;
2983
- _context24.t0 = _context24["catch"](18);
2984
- _iterator2.e(_context24.t0);
3034
+ _context25.prev = 30;
3035
+ _context25.t0 = _context25["catch"](18);
3036
+ _iterator2.e(_context25.t0);
2985
3037
  case 33:
2986
- _context24.prev = 33;
3038
+ _context25.prev = 33;
2987
3039
  _iterator2.f();
2988
- return _context24.finish(33);
3040
+ return _context25.finish(33);
2989
3041
  case 36:
2990
- _context24.next = 38;
3042
+ _context25.next = 38;
2991
3043
  return this.setDiscountSelected({
2992
3044
  discountId: Number(preferredId),
2993
3045
  isSelected: true
2994
3046
  });
2995
3047
  case 38:
2996
- _context24.next = 49;
3048
+ _context25.next = 49;
2997
3049
  break;
2998
3050
  case 40:
2999
3051
  if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
3000
- _context24.next = 46;
3052
+ _context25.next = 46;
3001
3053
  break;
3002
3054
  }
3003
3055
  if (!(params.applyBestDiscount !== false)) {
3004
- _context24.next = 44;
3056
+ _context25.next = 44;
3005
3057
  break;
3006
3058
  }
3007
- _context24.next = 44;
3059
+ _context25.next = 44;
3008
3060
  return this.bestDiscount();
3009
3061
  case 44:
3010
- _context24.next = 49;
3062
+ _context25.next = 49;
3011
3063
  break;
3012
3064
  case 46:
3013
3065
  if (!(params.applyBestDiscount !== false)) {
3014
- _context24.next = 49;
3066
+ _context25.next = 49;
3015
3067
  break;
3016
3068
  }
3017
- _context24.next = 49;
3069
+ _context25.next = 49;
3018
3070
  return this.bestDiscount();
3019
3071
  case 49:
3020
3072
  nextTempOrder = this.getTempOrder();
3021
- _context24.t1 = buildPlannerDiscountResult;
3022
- _context24.t2 = customerId;
3023
- _context24.t3 = this.getDiscountList();
3024
- _context24.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
3025
- _context24.t5 = summaryBefore;
3026
- _context24.next = 57;
3073
+ _context25.t1 = buildPlannerDiscountResult;
3074
+ _context25.t2 = customerId;
3075
+ _context25.t3 = this.getDiscountList();
3076
+ _context25.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
3077
+ _context25.t5 = summaryBefore;
3078
+ _context25.next = 57;
3027
3079
  return this.getSummary();
3028
3080
  case 57:
3029
- _context24.t6 = _context24.sent;
3030
- _context24.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
3031
- _context24.t8 = preferredDiscountId;
3032
- _context24.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
3033
- _context24.t10 = {
3034
- customerId: _context24.t2,
3035
- discountList: _context24.t3,
3036
- products: _context24.t4,
3037
- summaryBefore: _context24.t5,
3038
- summaryAfter: _context24.t6,
3039
- status: _context24.t7,
3040
- preferredDiscountId: _context24.t8,
3041
- preferredDiscountFound: _context24.t9
3081
+ _context25.t6 = _context25.sent;
3082
+ _context25.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
3083
+ _context25.t8 = preferredDiscountId;
3084
+ _context25.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
3085
+ _context25.t10 = {
3086
+ customerId: _context25.t2,
3087
+ discountList: _context25.t3,
3088
+ products: _context25.t4,
3089
+ summaryBefore: _context25.t5,
3090
+ summaryAfter: _context25.t6,
3091
+ status: _context25.t7,
3092
+ preferredDiscountId: _context25.t8,
3093
+ preferredDiscountFound: _context25.t9
3042
3094
  };
3043
- return _context24.abrupt("return", (0, _context24.t1)(_context24.t10));
3095
+ return _context25.abrupt("return", (0, _context25.t1)(_context25.t10));
3044
3096
  case 63:
3045
3097
  case "end":
3046
- return _context24.stop();
3098
+ return _context25.stop();
3047
3099
  }
3048
- }, _callee24, this, [[18, 30, 33, 36]]);
3100
+ }, _callee25, this, [[18, 30, 33, 36]]);
3049
3101
  }));
3050
3102
  function applyPlannerDiscounts() {
3051
3103
  return _applyPlannerDiscounts.apply(this, arguments);
@@ -3055,16 +3107,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3055
3107
  }, {
3056
3108
  key: "buildUnifiedOrderProduct",
3057
3109
  value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
3058
- var _ref38, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref39, _sourceProduct$produc, _ref40, _ref41, _sourceProduct$quanti, _sourceProduct$price, _ref42, _ref43, _sourceProduct$sellin;
3110
+ var _ref39, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref40, _sourceProduct$produc, _ref41, _ref42, _sourceProduct$quanti, _sourceProduct$price, _ref43, _ref44, _sourceProduct$sellin;
3059
3111
  var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
3060
- var quotationShelfId = (_ref38 = (_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 && _ref38 !== void 0 ? _ref38 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
3112
+ var quotationShelfId = (_ref39 = (_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 && _ref39 !== void 0 ? _ref39 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
3061
3113
  var orderProduct = this.transformBaseProductToOrderProduct({
3062
3114
  payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
3063
3115
  id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
3064
- product_id: (_ref39 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref39 !== void 0 ? _ref39 : product === null || product === void 0 ? void 0 : product.id,
3065
- quantity: (_ref40 = (_ref41 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref41 !== void 0 ? _ref41 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref40 !== void 0 ? _ref40 : 1,
3116
+ product_id: (_ref40 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref40 !== void 0 ? _ref40 : product === null || product === void 0 ? void 0 : product.id,
3117
+ quantity: (_ref41 = (_ref42 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref42 !== void 0 ? _ref42 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref41 !== void 0 ? _ref41 : 1,
3066
3118
  price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
3067
- selling_price: (_ref42 = (_ref43 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref43 !== void 0 ? _ref43 : normalizedProductRaw.selling_price) !== null && _ref42 !== void 0 ? _ref42 : normalizedProductRaw.price,
3119
+ selling_price: (_ref43 = (_ref44 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref44 !== void 0 ? _ref44 : normalizedProductRaw.selling_price) !== null && _ref43 !== void 0 ? _ref43 : normalizedProductRaw.price,
3068
3120
  metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
3069
3121
  }),
3070
3122
  sourceProduct: sourceProduct
@@ -3083,29 +3135,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3083
3135
  }, {
3084
3136
  key: "removeExistingStagedLines",
3085
3137
  value: (function () {
3086
- var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(ownershipKey) {
3138
+ var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(ownershipKey) {
3087
3139
  var _this$getTempOrder;
3088
3140
  var existingLines;
3089
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3090
- while (1) switch (_context25.prev = _context25.next) {
3141
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3142
+ while (1) switch (_context26.prev = _context26.next) {
3091
3143
  case 0:
3092
3144
  existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
3093
3145
  var _product$metadata4;
3094
3146
  return (product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4[ownershipKey]) === true;
3095
3147
  });
3096
3148
  if (!(existingLines.length > 0)) {
3097
- _context25.next = 4;
3149
+ _context26.next = 4;
3098
3150
  break;
3099
3151
  }
3100
- _context25.next = 4;
3152
+ _context26.next = 4;
3101
3153
  return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
3102
3154
  case 4:
3103
3155
  case "end":
3104
- return _context25.stop();
3156
+ return _context26.stop();
3105
3157
  }
3106
- }, _callee25, this);
3158
+ }, _callee26, this);
3107
3159
  }));
3108
- function removeExistingStagedLines(_x13) {
3160
+ function removeExistingStagedLines(_x14) {
3109
3161
  return _removeExistingStagedLines.apply(this, arguments);
3110
3162
  }
3111
3163
  return removeExistingStagedLines;
@@ -3113,25 +3165,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3113
3165
  }, {
3114
3166
  key: "stageProducts",
3115
3167
  value: function () {
3116
- var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params, ownershipKey) {
3168
+ var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params, ownershipKey) {
3117
3169
  var _params$rawProducts;
3118
3170
  var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
3119
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3120
- while (1) switch (_context26.prev = _context26.next) {
3171
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3172
+ while (1) switch (_context27.prev = _context27.next) {
3121
3173
  case 0:
3122
3174
  productIds = params.productIds || [];
3123
3175
  if (productIds.length) {
3124
- _context26.next = 3;
3176
+ _context27.next = 3;
3125
3177
  break;
3126
3178
  }
3127
- return _context26.abrupt("return", this.getTempOrder());
3179
+ return _context27.abrupt("return", this.getTempOrder());
3128
3180
  case 3:
3129
3181
  if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
3130
- _context26.next = 7;
3182
+ _context27.next = 7;
3131
3183
  break;
3132
3184
  }
3133
3185
  this.unifiedProductCatalog = params.rawProducts;
3134
- _context26.next = 12;
3186
+ _context27.next = 12;
3135
3187
  break;
3136
3188
  case 7:
3137
3189
  existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
@@ -3142,15 +3194,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3142
3194
  return !existingIds.has(String(id));
3143
3195
  });
3144
3196
  if (!(missingIds.length || params.productLoadParams)) {
3145
- _context26.next = 12;
3197
+ _context27.next = 12;
3146
3198
  break;
3147
3199
  }
3148
- _context26.next = 12;
3200
+ _context27.next = 12;
3149
3201
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
3150
3202
  product_ids: productIds.map(Number).filter(Number.isFinite)
3151
3203
  }));
3152
3204
  case 12:
3153
- _context26.next = 14;
3205
+ _context27.next = 14;
3154
3206
  return this.removeExistingStagedLines(ownershipKey);
3155
3207
  case 14:
3156
3208
  productIdSet = new Set(productIds.map(function (id) {
@@ -3163,30 +3215,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3163
3215
  _i = 0, _arr = selectedProducts;
3164
3216
  case 17:
3165
3217
  if (!(_i < _arr.length)) {
3166
- _context26.next = 26;
3218
+ _context27.next = 26;
3167
3219
  break;
3168
3220
  }
3169
3221
  sourceProduct = _arr[_i];
3170
3222
  productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
3171
3223
  if (!productInput) {
3172
- _context26.next = 23;
3224
+ _context27.next = 23;
3173
3225
  break;
3174
3226
  }
3175
- _context26.next = 23;
3227
+ _context27.next = 23;
3176
3228
  return this.addProductToOrder(productInput);
3177
3229
  case 23:
3178
3230
  _i++;
3179
- _context26.next = 17;
3231
+ _context27.next = 17;
3180
3232
  break;
3181
3233
  case 26:
3182
- return _context26.abrupt("return", this.getTempOrder());
3234
+ return _context27.abrupt("return", this.getTempOrder());
3183
3235
  case 27:
3184
3236
  case "end":
3185
- return _context26.stop();
3237
+ return _context27.stop();
3186
3238
  }
3187
- }, _callee26, this);
3239
+ }, _callee27, this);
3188
3240
  }));
3189
- function stageProducts(_x14, _x15) {
3241
+ function stageProducts(_x15, _x16) {
3190
3242
  return _stageProducts.apply(this, arguments);
3191
3243
  }
3192
3244
  return stageProducts;
@@ -3198,18 +3250,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3198
3250
  }, {
3199
3251
  key: "stageRetailProducts",
3200
3252
  value: (function () {
3201
- var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3202
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3203
- while (1) switch (_context27.prev = _context27.next) {
3253
+ var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3254
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3255
+ while (1) switch (_context28.prev = _context28.next) {
3204
3256
  case 0:
3205
- return _context27.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
3257
+ return _context28.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
3206
3258
  case 1:
3207
3259
  case "end":
3208
- return _context27.stop();
3260
+ return _context28.stop();
3209
3261
  }
3210
- }, _callee27, this);
3262
+ }, _callee28, this);
3211
3263
  }));
3212
- function stageRetailProducts(_x16) {
3264
+ function stageRetailProducts(_x17) {
3213
3265
  return _stageRetailProducts.apply(this, arguments);
3214
3266
  }
3215
3267
  return stageRetailProducts;
@@ -3223,20 +3275,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3223
3275
  }, {
3224
3276
  key: "addRetailProduct",
3225
3277
  value: (function () {
3226
- var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3227
- var _params$quantity, _ref44, _params$productId, _params$product, _params$product2;
3278
+ var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3279
+ var _params$quantity, _ref45, _params$productId, _params$product, _params$product2;
3228
3280
  var quantity, productId, sourceProduct, products, orderProduct;
3229
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3230
- while (1) switch (_context28.prev = _context28.next) {
3281
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3282
+ while (1) switch (_context29.prev = _context29.next) {
3231
3283
  case 0:
3232
3284
  quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
3233
3285
  if (!(!Number.isFinite(quantity) || quantity <= 0)) {
3234
- _context28.next = 3;
3286
+ _context29.next = 3;
3235
3287
  break;
3236
3288
  }
3237
3289
  throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
3238
3290
  case 3:
3239
- productId = (_ref44 = (_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 && _ref44 !== void 0 ? _ref44 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
3291
+ productId = (_ref45 = (_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 && _ref45 !== void 0 ? _ref45 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
3240
3292
  sourceProduct = params.product;
3241
3293
  if (!sourceProduct && productId !== undefined && productId !== null) {
3242
3294
  sourceProduct = this.unifiedProductCatalog.find(function (product) {
@@ -3245,22 +3297,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3245
3297
  });
3246
3298
  }
3247
3299
  if (!(!sourceProduct && productId !== undefined && productId !== null)) {
3248
- _context28.next = 11;
3300
+ _context29.next = 11;
3249
3301
  break;
3250
3302
  }
3251
- _context28.next = 9;
3303
+ _context29.next = 9;
3252
3304
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
3253
3305
  product_ids: [Number(productId)].filter(Number.isFinite)
3254
3306
  }));
3255
3307
  case 9:
3256
- products = _context28.sent;
3308
+ products = _context29.sent;
3257
3309
  sourceProduct = products.find(function (product) {
3258
3310
  var _product$id4;
3259
3311
  return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
3260
3312
  });
3261
3313
  case 11:
3262
3314
  if (sourceProduct) {
3263
- _context28.next = 13;
3315
+ _context29.next = 13;
3264
3316
  break;
3265
3317
  }
3266
3318
  throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
@@ -3269,19 +3321,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3269
3321
  quantity: quantity
3270
3322
  }), 'unified_booking_sales_retail');
3271
3323
  if (orderProduct) {
3272
- _context28.next = 16;
3324
+ _context29.next = 16;
3273
3325
  break;
3274
3326
  }
3275
3327
  throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
3276
3328
  case 16:
3277
- return _context28.abrupt("return", this.addProductToOrder(orderProduct));
3329
+ return _context29.abrupt("return", this.addProductToOrder(orderProduct));
3278
3330
  case 17:
3279
3331
  case "end":
3280
- return _context28.stop();
3332
+ return _context29.stop();
3281
3333
  }
3282
- }, _callee28, this);
3334
+ }, _callee29, this);
3283
3335
  }));
3284
- function addRetailProduct(_x17) {
3336
+ function addRetailProduct(_x18) {
3285
3337
  return _addRetailProduct.apply(this, arguments);
3286
3338
  }
3287
3339
  return addRetailProduct;
@@ -3469,46 +3521,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3469
3521
  }, {
3470
3522
  key: "loadAvailabilityProducts",
3471
3523
  value: function () {
3472
- var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
3524
+ var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
3473
3525
  var _prepare$catalogScope,
3474
3526
  _prepare$catalogScope2,
3475
3527
  _this5 = this,
3476
3528
  _prepare$resourceIds;
3477
3529
  var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
3478
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3479
- while (1) switch (_context29.prev = _context29.next) {
3530
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3531
+ while (1) switch (_context30.prev = _context30.next) {
3480
3532
  case 0:
3481
3533
  prepare = params.prepare, dateRange = params.dateRange;
3482
3534
  explicitProductIds = prepare.productIds || [];
3483
3535
  rawProducts = [];
3484
3536
  if (!Array.isArray(prepare.rawProducts)) {
3485
- _context29.next = 8;
3537
+ _context30.next = 8;
3486
3538
  break;
3487
3539
  }
3488
3540
  rawProducts = prepare.rawProducts;
3489
3541
  this.unifiedProductCatalog = _toConsumableArray(rawProducts);
3490
- _context29.next = 34;
3542
+ _context30.next = 34;
3491
3543
  break;
3492
3544
  case 8:
3493
3545
  if (!(explicitProductIds.length > 0)) {
3494
- _context29.next = 14;
3546
+ _context30.next = 14;
3495
3547
  break;
3496
3548
  }
3497
- _context29.next = 11;
3549
+ _context30.next = 11;
3498
3550
  return this.loadProducts({
3499
3551
  product_ids: explicitProductIds,
3500
3552
  schedule_date: dateRange.startDate
3501
3553
  });
3502
3554
  case 11:
3503
- rawProducts = _context29.sent;
3504
- _context29.next = 34;
3555
+ rawProducts = _context30.sent;
3556
+ _context30.next = 34;
3505
3557
  break;
3506
3558
  case 14:
3507
3559
  if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
3508
- _context29.next = 30;
3560
+ _context30.next = 30;
3509
3561
  break;
3510
3562
  }
3511
- _context29.next = 17;
3563
+ _context30.next = 17;
3512
3564
  return this.loadScheduleAvailableDate({
3513
3565
  startDate: dateRange.startDate,
3514
3566
  endDate: dateRange.endDate,
@@ -3524,44 +3576,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3524
3576
  });
3525
3577
  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)) || [])));
3526
3578
  if (!(productIds.length > 0)) {
3527
- _context29.next = 27;
3579
+ _context30.next = 27;
3528
3580
  break;
3529
3581
  }
3530
3582
  assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
3531
- _context29.next = 24;
3583
+ _context30.next = 24;
3532
3584
  return this.loadProducts({
3533
3585
  product_ids: productIds,
3534
3586
  schedule_date: dateRange.startDate
3535
3587
  });
3536
3588
  case 24:
3537
- rawProducts = _context29.sent;
3538
- _context29.next = 28;
3589
+ rawProducts = _context30.sent;
3590
+ _context30.next = 28;
3539
3591
  break;
3540
3592
  case 27:
3541
3593
  this.unifiedProductCatalog = [];
3542
3594
  case 28:
3543
- _context29.next = 34;
3595
+ _context30.next = 34;
3544
3596
  break;
3545
3597
  case 30:
3546
3598
  if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
3547
- _context29.next = 34;
3599
+ _context30.next = 34;
3548
3600
  break;
3549
3601
  }
3550
- _context29.next = 33;
3602
+ _context30.next = 33;
3551
3603
  return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
3552
3604
  schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
3553
3605
  }));
3554
3606
  case 33:
3555
- rawProducts = _context29.sent;
3607
+ rawProducts = _context30.sent;
3556
3608
  case 34:
3557
3609
  normalized = rawProducts.map(function (product) {
3558
3610
  return normalizeProductForAvailability(product, params.scheduleList, _this5.getAvailabilityRuntimeOffsetMinutes());
3559
3611
  });
3560
3612
  if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
3561
- _context29.next = 37;
3613
+ _context30.next = 37;
3562
3614
  break;
3563
3615
  }
3564
- return _context29.abrupt("return", normalized.filter(function (product) {
3616
+ return _context30.abrupt("return", normalized.filter(function (product) {
3565
3617
  var _product$requirementG2;
3566
3618
  return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
3567
3619
  var _group$resourceIds3;
@@ -3574,16 +3626,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3574
3626
  }));
3575
3627
  case 37:
3576
3628
  productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
3577
- return _context29.abrupt("return", productIdSet ? normalized.filter(function (product) {
3629
+ return _context30.abrupt("return", productIdSet ? normalized.filter(function (product) {
3578
3630
  return productIdSet.has(String(product.id));
3579
3631
  }) : normalized);
3580
3632
  case 39:
3581
3633
  case "end":
3582
- return _context29.stop();
3634
+ return _context30.stop();
3583
3635
  }
3584
- }, _callee29, this);
3636
+ }, _callee30, this);
3585
3637
  }));
3586
- function loadAvailabilityProducts(_x18) {
3638
+ function loadAvailabilityProducts(_x19) {
3587
3639
  return _loadAvailabilityProducts.apply(this, arguments);
3588
3640
  }
3589
3641
  return loadAvailabilityProducts;
@@ -3596,12 +3648,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3596
3648
  }, {
3597
3649
  key: "fetchAvailabilityResourcesV2",
3598
3650
  value: (function () {
3599
- var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
3651
+ var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3600
3652
  var response, data;
3601
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3602
- while (1) switch (_context30.prev = _context30.next) {
3653
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3654
+ while (1) switch (_context31.prev = _context31.next) {
3603
3655
  case 0:
3604
- _context30.next = 2;
3656
+ _context31.next = 2;
3605
3657
  return this.request.get('/schedule/resource/list/v2', {
3606
3658
  start_date: params.dateRange.startDate,
3607
3659
  end_date: params.dateRange.endDate,
@@ -3611,28 +3663,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3611
3663
  useCache: false
3612
3664
  });
3613
3665
  case 2:
3614
- response = _context30.sent;
3666
+ response = _context31.sent;
3615
3667
  data = response === null || response === void 0 ? void 0 : response.data;
3616
3668
  if (!Array.isArray(data)) {
3617
- _context30.next = 6;
3669
+ _context31.next = 6;
3618
3670
  break;
3619
3671
  }
3620
- return _context30.abrupt("return", data);
3672
+ return _context31.abrupt("return", data);
3621
3673
  case 6:
3622
3674
  if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
3623
- _context30.next = 8;
3675
+ _context31.next = 8;
3624
3676
  break;
3625
3677
  }
3626
- return _context30.abrupt("return", data.list);
3678
+ return _context31.abrupt("return", data.list);
3627
3679
  case 8:
3628
- return _context30.abrupt("return", []);
3680
+ return _context31.abrupt("return", []);
3629
3681
  case 9:
3630
3682
  case "end":
3631
- return _context30.stop();
3683
+ return _context31.stop();
3632
3684
  }
3633
- }, _callee30, this);
3685
+ }, _callee31, this);
3634
3686
  }));
3635
- function fetchAvailabilityResourcesV2(_x19) {
3687
+ function fetchAvailabilityResourcesV2(_x20) {
3636
3688
  return _fetchAvailabilityResourcesV.apply(this, arguments);
3637
3689
  }
3638
3690
  return fetchAvailabilityResourcesV2;
@@ -3640,17 +3692,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3640
3692
  }, {
3641
3693
  key: "fetchAndPublishAvailabilityResourcesV2",
3642
3694
  value: function () {
3643
- var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3695
+ var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3644
3696
  var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
3645
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3646
- while (1) switch (_context31.prev = _context31.next) {
3697
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3698
+ while (1) switch (_context32.prev = _context32.next) {
3647
3699
  case 0:
3648
3700
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
3649
3701
  if (!(normalizedResourceIds.length === 0)) {
3650
- _context31.next = 3;
3702
+ _context32.next = 3;
3651
3703
  break;
3652
3704
  }
3653
- return _context31.abrupt("return", []);
3705
+ return _context32.abrupt("return", []);
3654
3706
  case 3:
3655
3707
  scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
3656
3708
  cacheParams = {
@@ -3660,7 +3712,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3660
3712
  };
3661
3713
  cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
3662
3714
  if (!cachedRawResources) {
3663
- _context31.next = 9;
3715
+ _context32.next = 9;
3664
3716
  break;
3665
3717
  }
3666
3718
  if (params.useCacheOnHit) {
@@ -3672,23 +3724,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3672
3724
  console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
3673
3725
  });
3674
3726
  }
3675
- return _context31.abrupt("return", cachedRawResources);
3727
+ return _context32.abrupt("return", cachedRawResources);
3676
3728
  case 9:
3677
- _context31.next = 11;
3729
+ _context32.next = 11;
3678
3730
  return this.refreshAvailabilityRemoteResourceQuery({
3679
3731
  timezone: params.timezone,
3680
3732
  dateRange: params.dateRange,
3681
3733
  resourceIds: normalizedResourceIds
3682
3734
  });
3683
3735
  case 11:
3684
- return _context31.abrupt("return", _context31.sent);
3736
+ return _context32.abrupt("return", _context32.sent);
3685
3737
  case 12:
3686
3738
  case "end":
3687
- return _context31.stop();
3739
+ return _context32.stop();
3688
3740
  }
3689
- }, _callee31, this);
3741
+ }, _callee32, this);
3690
3742
  }));
3691
- function fetchAndPublishAvailabilityResourcesV2(_x20) {
3743
+ function fetchAndPublishAvailabilityResourcesV2(_x21) {
3692
3744
  return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
3693
3745
  }
3694
3746
  return fetchAndPublishAvailabilityResourcesV2;
@@ -3696,17 +3748,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3696
3748
  }, {
3697
3749
  key: "refreshAvailabilityRemoteResourceQuery",
3698
3750
  value: function () {
3699
- var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3751
+ var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3700
3752
  var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
3701
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3702
- while (1) switch (_context32.prev = _context32.next) {
3753
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3754
+ while (1) switch (_context33.prev = _context33.next) {
3703
3755
  case 0:
3704
3756
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
3705
3757
  if (!(normalizedResourceIds.length === 0)) {
3706
- _context32.next = 3;
3758
+ _context33.next = 3;
3707
3759
  break;
3708
3760
  }
3709
- return _context32.abrupt("return", []);
3761
+ return _context33.abrupt("return", []);
3710
3762
  case 3:
3711
3763
  queryKey = this.buildAvailabilityRemoteResourceQueryKey({
3712
3764
  timezone: params.timezone,
@@ -3716,13 +3768,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3716
3768
  epoch = this.availabilityRemoteResourceEpoch;
3717
3769
  existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
3718
3770
  if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
3719
- _context32.next = 10;
3771
+ _context33.next = 10;
3720
3772
  break;
3721
3773
  }
3722
- _context32.next = 9;
3774
+ _context33.next = 9;
3723
3775
  return existing.promise;
3724
3776
  case 9:
3725
- return _context32.abrupt("return", _context32.sent);
3777
+ return _context33.abrupt("return", _context33.sent);
3726
3778
  case 10:
3727
3779
  this.availabilityRemoteResourceQuerySequence += 1;
3728
3780
  writeVersion = this.availabilityRemoteResourceQuerySequence;
@@ -3734,11 +3786,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3734
3786
  epoch: epoch,
3735
3787
  promise: promise
3736
3788
  });
3737
- _context32.prev = 14;
3738
- _context32.next = 17;
3789
+ _context33.prev = 14;
3790
+ _context33.next = 17;
3739
3791
  return promise;
3740
3792
  case 17:
3741
- rawResources = _context32.sent;
3793
+ rawResources = _context33.sent;
3742
3794
  if (epoch === this.availabilityRemoteResourceEpoch) {
3743
3795
  this.availabilityRemoteOccupancyCache.publish({
3744
3796
  scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
@@ -3749,21 +3801,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3749
3801
  version: writeVersion
3750
3802
  });
3751
3803
  }
3752
- return _context32.abrupt("return", rawResources);
3804
+ return _context33.abrupt("return", rawResources);
3753
3805
  case 20:
3754
- _context32.prev = 20;
3806
+ _context33.prev = 20;
3755
3807
  current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
3756
3808
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
3757
3809
  this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
3758
3810
  }
3759
- return _context32.finish(20);
3811
+ return _context33.finish(20);
3760
3812
  case 24:
3761
3813
  case "end":
3762
- return _context32.stop();
3814
+ return _context33.stop();
3763
3815
  }
3764
- }, _callee32, this, [[14,, 20, 24]]);
3816
+ }, _callee33, this, [[14,, 20, 24]]);
3765
3817
  }));
3766
- function refreshAvailabilityRemoteResourceQuery(_x21) {
3818
+ function refreshAvailabilityRemoteResourceQuery(_x22) {
3767
3819
  return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
3768
3820
  }
3769
3821
  return refreshAvailabilityRemoteResourceQuery;
@@ -3771,26 +3823,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3771
3823
  }, {
3772
3824
  key: "loadAvailabilityResources",
3773
3825
  value: function () {
3774
- var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3826
+ var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
3775
3827
  var resourceIds, cachedRawResources, rawResources;
3776
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3777
- while (1) switch (_context33.prev = _context33.next) {
3828
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3829
+ while (1) switch (_context34.prev = _context34.next) {
3778
3830
  case 0:
3779
3831
  resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
3780
3832
  if (!(resourceIds.length === 0)) {
3781
- _context33.next = 3;
3833
+ _context34.next = 3;
3782
3834
  break;
3783
3835
  }
3784
- return _context33.abrupt("return", {
3836
+ return _context34.abrupt("return", {
3785
3837
  resources: [],
3786
3838
  resourceOccupancies: []
3787
3839
  });
3788
3840
  case 3:
3789
3841
  if (!Array.isArray(params.rawResources)) {
3790
- _context33.next = 5;
3842
+ _context34.next = 5;
3791
3843
  break;
3792
3844
  }
3793
- return _context33.abrupt("return", buildAvailabilityResourcesFromV2({
3845
+ return _context34.abrupt("return", buildAvailabilityResourcesFromV2({
3794
3846
  rawResources: params.rawResources,
3795
3847
  scheduleList: params.scheduleList,
3796
3848
  dateRange: params.dateRange,
@@ -3798,7 +3850,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3798
3850
  }));
3799
3851
  case 5:
3800
3852
  if (!(params.fetchPolicy === 'cache_only')) {
3801
- _context33.next = 10;
3853
+ _context34.next = 10;
3802
3854
  break;
3803
3855
  }
3804
3856
  cachedRawResources = this.availabilityRemoteOccupancyCache.read({
@@ -3807,22 +3859,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3807
3859
  dateRange: params.dateRange
3808
3860
  });
3809
3861
  if (!cachedRawResources) {
3810
- _context33.next = 9;
3862
+ _context34.next = 9;
3811
3863
  break;
3812
3864
  }
3813
- return _context33.abrupt("return", buildAvailabilityResourcesFromV2({
3865
+ return _context34.abrupt("return", buildAvailabilityResourcesFromV2({
3814
3866
  rawResources: cachedRawResources,
3815
3867
  scheduleList: params.scheduleList,
3816
3868
  dateRange: params.dateRange,
3817
3869
  fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
3818
3870
  }));
3819
3871
  case 9:
3820
- return _context33.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
3872
+ return _context34.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
3821
3873
  resources: [],
3822
3874
  resourceOccupancies: []
3823
3875
  });
3824
3876
  case 10:
3825
- _context33.next = 12;
3877
+ _context34.next = 12;
3826
3878
  return this.fetchAndPublishAvailabilityResourcesV2({
3827
3879
  timezone: params.timezone,
3828
3880
  dateRange: params.dateRange,
@@ -3830,8 +3882,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3830
3882
  useCacheOnHit: true
3831
3883
  });
3832
3884
  case 12:
3833
- rawResources = _context33.sent;
3834
- return _context33.abrupt("return", buildAvailabilityResourcesFromV2({
3885
+ rawResources = _context34.sent;
3886
+ return _context34.abrupt("return", buildAvailabilityResourcesFromV2({
3835
3887
  rawResources: rawResources,
3836
3888
  scheduleList: params.scheduleList,
3837
3889
  dateRange: params.dateRange,
@@ -3839,11 +3891,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3839
3891
  }));
3840
3892
  case 14:
3841
3893
  case "end":
3842
- return _context33.stop();
3894
+ return _context34.stop();
3843
3895
  }
3844
- }, _callee33, this);
3896
+ }, _callee34, this);
3845
3897
  }));
3846
- function loadAvailabilityResources(_x22) {
3898
+ function loadAvailabilityResources(_x23) {
3847
3899
  return _loadAvailabilityResources.apply(this, arguments);
3848
3900
  }
3849
3901
  return loadAvailabilityResources;
@@ -3863,7 +3915,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3863
3915
  var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
3864
3916
  var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
3865
3917
  productLineUids.forEach(function (requestedUid) {
3866
- var _ref45, _product$booking_uid2, _product$metadata5;
3918
+ var _ref46, _product$booking_uid2, _product$metadata5;
3867
3919
  var product = products.find(function (line) {
3868
3920
  return getProductLineUid(line) === String(requestedUid);
3869
3921
  });
@@ -3873,7 +3925,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3873
3925
  });
3874
3926
  }
3875
3927
  var productUid = getProductLineUid(product);
3876
- var linkedBookingUid = String((_ref45 = (_product$booking_uid2 = product.booking_uid) !== null && _product$booking_uid2 !== void 0 ? _product$booking_uid2 : (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.booking_uid) !== null && _ref45 !== void 0 ? _ref45 : '');
3928
+ var linkedBookingUid = String((_ref46 = (_product$booking_uid2 = product.booking_uid) !== null && _product$booking_uid2 !== void 0 ? _product$booking_uid2 : (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.booking_uid) !== null && _ref46 !== void 0 ? _ref46 : '');
3877
3929
  var linkedBookings = bookings.filter(function (booking) {
3878
3930
  var _booking$product_uid;
3879
3931
  return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
@@ -3919,16 +3971,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3919
3971
  var _this6 = this;
3920
3972
  var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
3921
3973
  return bookings.flatMap(function (booking) {
3922
- var _ref46, _booking$product_uid2, _booking$metadata2;
3974
+ var _ref47, _booking$product_uid2, _booking$metadata2;
3923
3975
  var bookingUid = getBookingUid(booking);
3924
- var productUid = String((_ref46 = (_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 && _ref46 !== void 0 ? _ref46 : '');
3976
+ var productUid = String((_ref47 = (_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 && _ref47 !== void 0 ? _ref47 : '');
3925
3977
  var scheduleEventId = toNumberId(booking.schedule_event_id);
3926
3978
  var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
3927
3979
  var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
3928
3980
  var resources = Array.isArray(booking.resources) ? booking.resources : [];
3929
3981
  return resources.flatMap(function (resource) {
3930
- var _ref47, _resource$resource_id, _ref48, _resource$capacity;
3931
- var resourceId = (_ref47 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref47 !== void 0 ? _ref47 : resource.id;
3982
+ var _ref48, _resource$resource_id, _ref49, _resource$capacity;
3983
+ var resourceId = (_ref48 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref48 !== void 0 ? _ref48 : resource.id;
3932
3984
  if (resourceId == null || !startAt || !endAt) return [];
3933
3985
  var range = normalizeAvailabilityLocalDateTimeRange({
3934
3986
  startAt: startAt,
@@ -3941,7 +3993,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3941
3993
  resourceId: resourceId,
3942
3994
  startAt: range.startAt,
3943
3995
  endAt: range.endAt,
3944
- pax: Math.max(1, Number((_ref48 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref48 !== void 0 ? _ref48 : 1) || 1),
3996
+ pax: Math.max(1, Number((_ref49 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref49 !== void 0 ? _ref49 : 1) || 1),
3945
3997
  source: 'cart',
3946
3998
  scheduleEventId: scheduleEventId,
3947
3999
  bookingUid: bookingUid || undefined,
@@ -4074,7 +4126,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4074
4126
  }, {
4075
4127
  key: "buildAvailabilityProjectionSnapshot",
4076
4128
  value: function () {
4077
- var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
4129
+ var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4078
4130
  var _this8 = this;
4079
4131
  var options,
4080
4132
  normalizedPrepareParams,
@@ -4096,11 +4148,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4096
4148
  durationCandidateAnchorAt,
4097
4149
  orderRevision,
4098
4150
  projection,
4099
- _args34 = arguments;
4100
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4101
- while (1) switch (_context34.prev = _context34.next) {
4151
+ _args35 = arguments;
4152
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4153
+ while (1) switch (_context35.prev = _context35.next) {
4102
4154
  case 0:
4103
- options = _args34.length > 1 && _args34[1] !== undefined ? _args34[1] : {};
4155
+ options = _args35.length > 1 && _args35[1] !== undefined ? _args35[1] : {};
4104
4156
  normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
4105
4157
  timezoneLabel = String(normalizedPrepareParams.timezone);
4106
4158
  dateRange = normalizedPrepareParams.dateRange;
@@ -4114,15 +4166,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4114
4166
  scheduleList: scheduleList,
4115
4167
  businessHours: businessHours
4116
4168
  });
4117
- _context34.next = 11;
4169
+ _context35.next = 11;
4118
4170
  return this.loadAvailabilityProducts({
4119
4171
  prepare: normalizedPrepareParams,
4120
4172
  dateRange: dateRange,
4121
4173
  scheduleList: scheduleList
4122
4174
  });
4123
4175
  case 11:
4124
- products = _context34.sent;
4125
- _context34.next = 14;
4176
+ products = _context35.sent;
4177
+ _context35.next = 14;
4126
4178
  return this.loadAvailabilityResources({
4127
4179
  timezone: timezoneLabel,
4128
4180
  dateRange: dateRange,
@@ -4134,7 +4186,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4134
4186
  fallbackResources: options.fallbackResources
4135
4187
  });
4136
4188
  case 14:
4137
- loadedResources = _context34.sent;
4189
+ loadedResources = _context35.sent;
4138
4190
  tempOrder = this.getTempOrder();
4139
4191
  exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
4140
4192
  injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
@@ -4180,18 +4232,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4180
4232
  prepareParams: normalizedPrepareParams,
4181
4233
  durationCandidateAnchorAt: durationCandidateAnchorAt
4182
4234
  });
4183
- return _context34.abrupt("return", {
4235
+ return _context35.abrupt("return", {
4184
4236
  projection: projection,
4185
4237
  prepareParams: normalizedPrepareParams,
4186
4238
  orderRevision: orderRevision
4187
4239
  });
4188
4240
  case 26:
4189
4241
  case "end":
4190
- return _context34.stop();
4242
+ return _context35.stop();
4191
4243
  }
4192
- }, _callee34, this);
4244
+ }, _callee35, this);
4193
4245
  }));
4194
- function buildAvailabilityProjectionSnapshot(_x23) {
4246
+ function buildAvailabilityProjectionSnapshot(_x24) {
4195
4247
  return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
4196
4248
  }
4197
4249
  return buildAvailabilityProjectionSnapshot;
@@ -4199,10 +4251,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4199
4251
  }, {
4200
4252
  key: "getSharedPreparedAvailabilitySnapshot",
4201
4253
  value: function () {
4202
- var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4254
+ var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
4203
4255
  var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
4204
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4205
- while (1) switch (_context35.prev = _context35.next) {
4256
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4257
+ while (1) switch (_context36.prev = _context36.next) {
4206
4258
  case 0:
4207
4259
  lifecycleGeneration = this.availabilityLifecycleGeneration;
4208
4260
  normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
@@ -4221,15 +4273,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4221
4273
  }
4222
4274
  })) : this.buildAvailabilityPrepareKey(normalizedParams);
4223
4275
  if (!hasRawInputs) {
4224
- _context35.next = 11;
4276
+ _context36.next = 11;
4225
4277
  break;
4226
4278
  }
4227
- _context35.next = 7;
4279
+ _context36.next = 7;
4228
4280
  return this.buildAvailabilityProjectionSnapshot(normalizedParams);
4229
4281
  case 7:
4230
- snapshot = _context35.sent;
4282
+ snapshot = _context36.sent;
4231
4283
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
4232
- _context35.next = 10;
4284
+ _context36.next = 10;
4233
4285
  break;
4234
4286
  }
4235
4287
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -4238,7 +4290,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4238
4290
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
4239
4291
  });
4240
4292
  case 10:
4241
- return _context35.abrupt("return", {
4293
+ return _context36.abrupt("return", {
4242
4294
  prepareKey: prepareKey,
4243
4295
  snapshot: snapshot
4244
4296
  });
@@ -4252,13 +4304,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4252
4304
  promise: promise
4253
4305
  });
4254
4306
  }
4255
- _context35.prev = 14;
4256
- _context35.next = 17;
4307
+ _context36.prev = 14;
4308
+ _context36.next = 17;
4257
4309
  return promise;
4258
4310
  case 17:
4259
- _snapshot = _context35.sent;
4311
+ _snapshot = _context36.sent;
4260
4312
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
4261
- _context35.next = 20;
4313
+ _context36.next = 20;
4262
4314
  break;
4263
4315
  }
4264
4316
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -4267,24 +4319,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4267
4319
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
4268
4320
  });
4269
4321
  case 20:
4270
- return _context35.abrupt("return", {
4322
+ return _context36.abrupt("return", {
4271
4323
  prepareKey: prepareKey,
4272
4324
  snapshot: _snapshot
4273
4325
  });
4274
4326
  case 21:
4275
- _context35.prev = 21;
4327
+ _context36.prev = 21;
4276
4328
  current = this.availabilityPrepareInFlight.get(prepareKey);
4277
4329
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
4278
4330
  this.availabilityPrepareInFlight.delete(prepareKey);
4279
4331
  }
4280
- return _context35.finish(21);
4332
+ return _context36.finish(21);
4281
4333
  case 25:
4282
4334
  case "end":
4283
- return _context35.stop();
4335
+ return _context36.stop();
4284
4336
  }
4285
- }, _callee35, this, [[14,, 21, 25]]);
4337
+ }, _callee36, this, [[14,, 21, 25]]);
4286
4338
  }));
4287
- function getSharedPreparedAvailabilitySnapshot(_x24) {
4339
+ function getSharedPreparedAvailabilitySnapshot(_x25) {
4288
4340
  return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
4289
4341
  }
4290
4342
  return getSharedPreparedAvailabilitySnapshot;
@@ -4292,49 +4344,49 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4292
4344
  }, {
4293
4345
  key: "refreshAvailabilityContextProjection",
4294
4346
  value: function () {
4295
- var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4347
+ var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4296
4348
  var _this9 = this;
4297
4349
  var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
4298
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4299
- while (1) switch (_context37.prev = _context37.next) {
4350
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4351
+ while (1) switch (_context38.prev = _context38.next) {
4300
4352
  case 0:
4301
4353
  existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
4302
4354
  if (!existingInFlight) {
4303
- _context37.next = 5;
4355
+ _context38.next = 5;
4304
4356
  break;
4305
4357
  }
4306
- _context37.next = 4;
4358
+ _context38.next = 4;
4307
4359
  return existingInFlight;
4308
4360
  case 4:
4309
- return _context37.abrupt("return", _context37.sent);
4361
+ return _context38.abrupt("return", _context38.sent);
4310
4362
  case 5:
4311
4363
  context = this.getAvailabilityContextEntry(params.contextId);
4312
4364
  expectedVersion = context.activeVersion;
4313
4365
  expectedRefreshNonce = context.refreshNonce;
4314
4366
  expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
4315
- refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
4367
+ refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
4316
4368
  var snapshot, currentContext, projectionEntry;
4317
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4318
- while (1) switch (_context36.prev = _context36.next) {
4369
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4370
+ while (1) switch (_context37.prev = _context37.next) {
4319
4371
  case 0:
4320
- _context36.next = 2;
4372
+ _context37.next = 2;
4321
4373
  return _this9.buildAvailabilityProjectionSnapshot(_this9.cloneAvailabilityPrepareParams(context.prepareParams), {
4322
4374
  durationCandidateAnchorAt: context.durationCandidateAnchorAt
4323
4375
  });
4324
4376
  case 2:
4325
- snapshot = _context36.sent;
4377
+ snapshot = _context37.sent;
4326
4378
  currentContext = _this9.availabilityContextRegistry.get(params.contextId);
4327
4379
  if (currentContext) {
4328
- _context36.next = 6;
4380
+ _context37.next = 6;
4329
4381
  break;
4330
4382
  }
4331
- return _context36.abrupt("return", null);
4383
+ return _context37.abrupt("return", null);
4332
4384
  case 6:
4333
4385
  if (!(expectedLifecycleGeneration !== _this9.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
4334
- _context36.next = 8;
4386
+ _context37.next = 8;
4335
4387
  break;
4336
4388
  }
4337
- return _context36.abrupt("return", null);
4389
+ return _context37.abrupt("return", null);
4338
4390
  case 8:
4339
4391
  projectionEntry = _this9.storeAvailabilityProjectionEntry({
4340
4392
  contextId: currentContext.contextId,
@@ -4344,7 +4396,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4344
4396
  orderRevision: snapshot.orderRevision,
4345
4397
  incrementVersion: true
4346
4398
  });
4347
- _context36.next = 11;
4399
+ _context37.next = 11;
4348
4400
  return _this9.emitAvailabilityDiagnostic({
4349
4401
  action: 'refresh',
4350
4402
  contextId: currentContext.contextId,
@@ -4356,33 +4408,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4356
4408
  reason: params.reason
4357
4409
  });
4358
4410
  case 11:
4359
- return _context36.abrupt("return", projectionEntry);
4411
+ return _context37.abrupt("return", projectionEntry);
4360
4412
  case 12:
4361
4413
  case "end":
4362
- return _context36.stop();
4414
+ return _context37.stop();
4363
4415
  }
4364
- }, _callee36);
4416
+ }, _callee37);
4365
4417
  }))();
4366
4418
  this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
4367
- _context37.prev = 11;
4368
- _context37.next = 14;
4419
+ _context38.prev = 11;
4420
+ _context38.next = 14;
4369
4421
  return refreshPromise;
4370
4422
  case 14:
4371
- return _context37.abrupt("return", _context37.sent);
4423
+ return _context38.abrupt("return", _context38.sent);
4372
4424
  case 15:
4373
- _context37.prev = 15;
4425
+ _context38.prev = 15;
4374
4426
  current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
4375
4427
  if (current === refreshPromise) {
4376
4428
  this.availabilityProjectionRefreshInFlight.delete(params.contextId);
4377
4429
  }
4378
- return _context37.finish(15);
4430
+ return _context38.finish(15);
4379
4431
  case 19:
4380
4432
  case "end":
4381
- return _context37.stop();
4433
+ return _context38.stop();
4382
4434
  }
4383
- }, _callee37, this, [[11,, 15, 19]]);
4435
+ }, _callee38, this, [[11,, 15, 19]]);
4384
4436
  }));
4385
- function refreshAvailabilityContextProjection(_x25) {
4437
+ function refreshAvailabilityContextProjection(_x26) {
4386
4438
  return _refreshAvailabilityContextProjection.apply(this, arguments);
4387
4439
  }
4388
4440
  return refreshAvailabilityContextProjection;
@@ -4390,53 +4442,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4390
4442
  }, {
4391
4443
  key: "ensureAvailabilityContextProjection",
4392
4444
  value: function () {
4393
- var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(contextId, reason) {
4445
+ var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(contextId, reason) {
4394
4446
  var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
4395
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4396
- while (1) switch (_context38.prev = _context38.next) {
4447
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4448
+ while (1) switch (_context39.prev = _context39.next) {
4397
4449
  case 0:
4398
4450
  retries = 0;
4399
4451
  case 1:
4400
4452
  if (!(retries < 3)) {
4401
- _context38.next = 19;
4453
+ _context39.next = 19;
4402
4454
  break;
4403
4455
  }
4404
4456
  context = this.getAvailabilityContextEntry(contextId);
4405
4457
  currentOrderRevision = this.getCurrentOrderRevision();
4406
4458
  projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
4407
4459
  if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
4408
- _context38.next = 7;
4460
+ _context39.next = 7;
4409
4461
  break;
4410
4462
  }
4411
- return _context38.abrupt("return", {
4463
+ return _context39.abrupt("return", {
4412
4464
  context: context,
4413
4465
  projectionEntry: projectionEntry,
4414
4466
  refreshed: false
4415
4467
  });
4416
4468
  case 7:
4417
- _context38.next = 9;
4469
+ _context39.next = 9;
4418
4470
  return this.refreshAvailabilityContextProjection({
4419
4471
  contextId: contextId,
4420
4472
  reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
4421
4473
  previousOrderRevision: context.lastKnownOrderRevision
4422
4474
  });
4423
4475
  case 9:
4424
- refreshedProjectionEntry = _context38.sent;
4476
+ refreshedProjectionEntry = _context39.sent;
4425
4477
  if (refreshedProjectionEntry) {
4426
- _context38.next = 13;
4478
+ _context39.next = 13;
4427
4479
  break;
4428
4480
  }
4429
4481
  retries += 1;
4430
- return _context38.abrupt("continue", 1);
4482
+ return _context39.abrupt("continue", 1);
4431
4483
  case 13:
4432
4484
  if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
4433
- _context38.next = 16;
4485
+ _context39.next = 16;
4434
4486
  break;
4435
4487
  }
4436
4488
  retries += 1;
4437
- return _context38.abrupt("continue", 1);
4489
+ return _context39.abrupt("continue", 1);
4438
4490
  case 16:
4439
- return _context38.abrupt("return", {
4491
+ return _context39.abrupt("return", {
4440
4492
  context: this.getAvailabilityContextEntry(contextId),
4441
4493
  projectionEntry: refreshedProjectionEntry,
4442
4494
  refreshed: true
@@ -4448,11 +4500,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4448
4500
  });
4449
4501
  case 20:
4450
4502
  case "end":
4451
- return _context38.stop();
4503
+ return _context39.stop();
4452
4504
  }
4453
- }, _callee38, this);
4505
+ }, _callee39, this);
4454
4506
  }));
4455
- function ensureAvailabilityContextProjection(_x26, _x27) {
4507
+ function ensureAvailabilityContextProjection(_x27, _x28) {
4456
4508
  return _ensureAvailabilityContextProjection.apply(this, arguments);
4457
4509
  }
4458
4510
  return ensureAvailabilityContextProjection;
@@ -4460,18 +4512,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4460
4512
  }, {
4461
4513
  key: "tryAcquireAvailabilityCommitLock",
4462
4514
  value: function () {
4463
- var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(contextId) {
4515
+ var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(contextId) {
4464
4516
  var _currentContext$activ;
4465
4517
  var _waitingContext$activ, waitingContext, currentContext;
4466
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4467
- while (1) switch (_context39.prev = _context39.next) {
4518
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4519
+ while (1) switch (_context40.prev = _context40.next) {
4468
4520
  case 0:
4469
4521
  if (!this.availabilityCommitLocks.has(contextId)) {
4470
- _context39.next = 5;
4522
+ _context40.next = 5;
4471
4523
  break;
4472
4524
  }
4473
4525
  waitingContext = this.availabilityContextRegistry.get(contextId);
4474
- _context39.next = 4;
4526
+ _context40.next = 4;
4475
4527
  return this.emitAvailabilityDiagnostic({
4476
4528
  action: 'commit_lock_wait',
4477
4529
  contextId: contextId,
@@ -4488,7 +4540,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4488
4540
  case 5:
4489
4541
  this.availabilityCommitLocks.add(contextId);
4490
4542
  currentContext = this.availabilityContextRegistry.get(contextId);
4491
- _context39.next = 9;
4543
+ _context40.next = 9;
4492
4544
  return this.emitAvailabilityDiagnostic({
4493
4545
  action: 'commit_lock_acquired',
4494
4546
  contextId: contextId,
@@ -4500,11 +4552,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4500
4552
  });
4501
4553
  case 9:
4502
4554
  case "end":
4503
- return _context39.stop();
4555
+ return _context40.stop();
4504
4556
  }
4505
- }, _callee39, this);
4557
+ }, _callee40, this);
4506
4558
  }));
4507
- function tryAcquireAvailabilityCommitLock(_x28) {
4559
+ function tryAcquireAvailabilityCommitLock(_x29) {
4508
4560
  return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
4509
4561
  }
4510
4562
  return tryAcquireAvailabilityCommitLock;
@@ -4512,15 +4564,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4512
4564
  }, {
4513
4565
  key: "releaseAvailabilityCommitLock",
4514
4566
  value: function () {
4515
- var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(contextId) {
4567
+ var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(contextId) {
4516
4568
  var _releasedContext$acti;
4517
4569
  var releasedContext;
4518
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4519
- while (1) switch (_context40.prev = _context40.next) {
4570
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4571
+ while (1) switch (_context41.prev = _context41.next) {
4520
4572
  case 0:
4521
4573
  this.availabilityCommitLocks.delete(contextId);
4522
4574
  releasedContext = this.availabilityContextRegistry.get(contextId);
4523
- _context40.next = 4;
4575
+ _context41.next = 4;
4524
4576
  return this.emitAvailabilityDiagnostic({
4525
4577
  action: 'commit_lock_released',
4526
4578
  contextId: contextId,
@@ -4532,11 +4584,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4532
4584
  });
4533
4585
  case 4:
4534
4586
  case "end":
4535
- return _context40.stop();
4587
+ return _context41.stop();
4536
4588
  }
4537
- }, _callee40, this);
4589
+ }, _callee41, this);
4538
4590
  }));
4539
- function releaseAvailabilityCommitLock(_x29) {
4591
+ function releaseAvailabilityCommitLock(_x30) {
4540
4592
  return _releaseAvailabilityCommitLock.apply(this, arguments);
4541
4593
  }
4542
4594
  return releaseAvailabilityCommitLock;
@@ -4544,20 +4596,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4544
4596
  }, {
4545
4597
  key: "prepareAvailabilityProjection",
4546
4598
  value: (function () {
4547
- var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
4599
+ var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
4548
4600
  var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
4549
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4550
- while (1) switch (_context41.prev = _context41.next) {
4601
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4602
+ while (1) switch (_context42.prev = _context42.next) {
4551
4603
  case 0:
4552
4604
  this.assertAvailabilityPrepareParams(params);
4553
- _context41.next = 3;
4605
+ _context42.next = 3;
4554
4606
  return this.resolveAvailabilityPrepareDefaults(params);
4555
4607
  case 3:
4556
- paramsWithDefaults = _context41.sent;
4557
- _context41.next = 6;
4608
+ paramsWithDefaults = _context42.sent;
4609
+ _context42.next = 6;
4558
4610
  return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
4559
4611
  case 6:
4560
- _yield$this$getShared = _context41.sent;
4612
+ _yield$this$getShared = _context42.sent;
4561
4613
  prepareKey = _yield$this$getShared.prepareKey;
4562
4614
  snapshot = _yield$this$getShared.snapshot;
4563
4615
  contextId = this.createAvailabilityContextId();
@@ -4578,7 +4630,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4578
4630
  refreshed: false,
4579
4631
  reason: 'prepare'
4580
4632
  };
4581
- _context41.next = 16;
4633
+ _context42.next = 16;
4582
4634
  return this.emitAvailabilityDiagnostic({
4583
4635
  action: 'prepare',
4584
4636
  contextId: contextId,
@@ -4589,17 +4641,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4589
4641
  reason: 'prepare'
4590
4642
  });
4591
4643
  case 16:
4592
- _context41.next = 18;
4644
+ _context42.next = 18;
4593
4645
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
4594
4646
  case 18:
4595
- return _context41.abrupt("return", handle);
4647
+ return _context42.abrupt("return", handle);
4596
4648
  case 19:
4597
4649
  case "end":
4598
- return _context41.stop();
4650
+ return _context42.stop();
4599
4651
  }
4600
- }, _callee41, this);
4652
+ }, _callee42, this);
4601
4653
  }));
4602
- function prepareAvailabilityProjection(_x30) {
4654
+ function prepareAvailabilityProjection(_x31) {
4603
4655
  return _prepareAvailabilityProjection.apply(this, arguments);
4604
4656
  }
4605
4657
  return prepareAvailabilityProjection;
@@ -4607,9 +4659,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4607
4659
  }, {
4608
4660
  key: "getProductTimeRanges",
4609
4661
  value: (function () {
4610
- var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(contextId) {
4662
+ var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(contextId) {
4611
4663
  var _this$otherParams$pla2,
4612
- _this$otherParams26,
4664
+ _this$otherParams28,
4613
4665
  _this10 = this;
4614
4666
  var request,
4615
4667
  _yield$this$ensureAva,
@@ -4618,23 +4670,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4618
4670
  contextVersion,
4619
4671
  isPosAvailabilityRequest,
4620
4672
  allowOutsideOperatingHoursForRequestedStartTimes,
4621
- _args42 = arguments;
4622
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4623
- while (1) switch (_context42.prev = _context42.next) {
4673
+ _args43 = arguments;
4674
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4675
+ while (1) switch (_context43.prev = _context43.next) {
4624
4676
  case 0:
4625
- request = _args42.length > 1 && _args42[1] !== undefined ? _args42[1] : {};
4626
- _context42.next = 3;
4677
+ request = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {};
4678
+ _context43.next = 3;
4627
4679
  return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
4628
4680
  case 3:
4629
- _yield$this$ensureAva = _context42.sent;
4681
+ _yield$this$ensureAva = _context43.sent;
4630
4682
  context = _yield$this$ensureAva.context;
4631
4683
  projectionEntry = _yield$this$ensureAva.projectionEntry;
4632
4684
  contextVersion = context.activeVersion;
4633
- isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
4685
+ isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
4634
4686
  allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
4635
4687
  return Array.isArray(startTimes) && startTimes.length > 0;
4636
4688
  });
4637
- return _context42.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
4689
+ return _context43.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
4638
4690
  allowOutsideOperatingHoursForRequestedStartTimes: true
4639
4691
  } : {}), {
4640
4692
  evaluatedAt: this.getAvailabilityRuntimeDateTime(),
@@ -4650,11 +4702,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4650
4702
  }));
4651
4703
  case 10:
4652
4704
  case "end":
4653
- return _context42.stop();
4705
+ return _context43.stop();
4654
4706
  }
4655
- }, _callee42, this);
4707
+ }, _callee43, this);
4656
4708
  }));
4657
- function getProductTimeRanges(_x31) {
4709
+ function getProductTimeRanges(_x32) {
4658
4710
  return _getProductTimeRanges.apply(this, arguments);
4659
4711
  }
4660
4712
  return getProductTimeRanges;
@@ -4662,21 +4714,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4662
4714
  }, {
4663
4715
  key: "queryBookingAvailability",
4664
4716
  value: (function () {
4665
- var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(contextId, request) {
4666
- var _this$otherParams$pla3, _this$otherParams27;
4717
+ var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(contextId, request) {
4718
+ var _this$otherParams$pla3, _this$otherParams29;
4667
4719
  var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, result, contextVersion, contextualResult;
4668
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4669
- while (1) switch (_context43.prev = _context43.next) {
4720
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4721
+ while (1) switch (_context44.prev = _context44.next) {
4670
4722
  case 0:
4671
- _context43.next = 2;
4723
+ _context44.next = 2;
4672
4724
  return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
4673
4725
  case 2:
4674
- _yield$this$ensureAva2 = _context43.sent;
4726
+ _yield$this$ensureAva2 = _context44.sent;
4675
4727
  context = _yield$this$ensureAva2.context;
4676
4728
  projectionEntry = _yield$this$ensureAva2.projectionEntry;
4677
4729
  refreshed = _yield$this$ensureAva2.refreshed;
4678
4730
  this.assertContextualQueryFreshness(context, request);
4679
- isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
4731
+ isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
4680
4732
  result = queryAvailabilityProjection(projectionEntry.projection, request, {
4681
4733
  useExactDurationCandidateMinute: isPosAvailabilityRequest,
4682
4734
  allowExcludedScheduleDateOverride: isPosAvailabilityRequest
@@ -4707,18 +4759,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4707
4759
  });
4708
4760
  })
4709
4761
  }) : result;
4710
- return _context43.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
4762
+ return _context44.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
4711
4763
  contextId: context.contextId,
4712
4764
  contextVersion: contextVersion,
4713
4765
  refreshed: refreshed
4714
4766
  }));
4715
4767
  case 12:
4716
4768
  case "end":
4717
- return _context43.stop();
4769
+ return _context44.stop();
4718
4770
  }
4719
- }, _callee43, this);
4771
+ }, _callee44, this);
4720
4772
  }));
4721
- function queryBookingAvailability(_x32, _x33) {
4773
+ function queryBookingAvailability(_x33, _x34) {
4722
4774
  return _queryBookingAvailability.apply(this, arguments);
4723
4775
  }
4724
4776
  return queryBookingAvailability;
@@ -4775,9 +4827,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4775
4827
  }, {
4776
4828
  key: "findLinkedBooking",
4777
4829
  value: function findLinkedBooking(product) {
4778
- var _ref50, _product$booking_uid3, _product$metadata6, _this$getTempOrder3;
4830
+ var _ref51, _product$booking_uid3, _product$metadata6, _this$getTempOrder3;
4779
4831
  var productUid = getProductLineUid(product);
4780
- var bookingUid = String((_ref50 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid) !== null && _ref50 !== void 0 ? _ref50 : '');
4832
+ var bookingUid = String((_ref51 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid) !== null && _ref51 !== void 0 ? _ref51 : '');
4781
4833
  return (((_this$getTempOrder3 = this.getTempOrder()) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.bookings) || []).find(function (booking) {
4782
4834
  var _booking$product_uid3;
4783
4835
  return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
@@ -4788,27 +4840,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4788
4840
  }, {
4789
4841
  key: "commitAvailabilitySelection",
4790
4842
  value: (function () {
4791
- var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(contextId, params) {
4792
- var normalizedContextId, _params$bookingCount, _ref51, _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$pla4, _this$otherParams28, _ref52, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref53, _ref54, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, 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, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref55, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _params$salesNotes, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
4793
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4794
- while (1) switch (_context44.prev = _context44.next) {
4843
+ var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(contextId, params) {
4844
+ var normalizedContextId, _params$bookingCount, _ref52, _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$pla4, _this$otherParams30, _ref53, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref54, _ref55, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, 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, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref56, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _params$salesNotes, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
4845
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4846
+ while (1) switch (_context45.prev = _context45.next) {
4795
4847
  case 0:
4796
4848
  normalizedContextId = String(contextId || '').trim();
4797
4849
  if (normalizedContextId) {
4798
- _context44.next = 3;
4850
+ _context45.next = 3;
4799
4851
  break;
4800
4852
  }
4801
4853
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
4802
4854
  candidate: params.candidate
4803
4855
  });
4804
4856
  case 3:
4805
- _context44.next = 5;
4857
+ _context45.next = 5;
4806
4858
  return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
4807
4859
  case 5:
4808
- _context44.prev = 5;
4860
+ _context45.prev = 5;
4809
4861
  bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
4810
4862
  if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
4811
- _context44.next = 9;
4863
+ _context45.next = 9;
4812
4864
  break;
4813
4865
  }
4814
4866
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
@@ -4816,16 +4868,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4816
4868
  });
4817
4869
  case 9:
4818
4870
  if (!(params.mode === 'edit' && bookingCount !== 1)) {
4819
- _context44.next = 11;
4871
+ _context45.next = 11;
4820
4872
  break;
4821
4873
  }
4822
4874
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
4823
4875
  bookingCount: bookingCount
4824
4876
  });
4825
4877
  case 11:
4826
- orderProductQuantity = (_ref51 = (_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 && _ref51 !== void 0 ? _ref51 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
4878
+ orderProductQuantity = (_ref52 = (_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 && _ref52 !== void 0 ? _ref52 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
4827
4879
  if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
4828
- _context44.next = 14;
4880
+ _context45.next = 14;
4829
4881
  break;
4830
4882
  }
4831
4883
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
@@ -4835,22 +4887,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4835
4887
  case 14:
4836
4888
  partySize = Number(params.partySize);
4837
4889
  if (!(!Number.isInteger(partySize) || partySize <= 0)) {
4838
- _context44.next = 17;
4890
+ _context45.next = 17;
4839
4891
  break;
4840
4892
  }
4841
4893
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
4842
4894
  partySize: params.partySize
4843
4895
  });
4844
4896
  case 17:
4845
- _context44.next = 19;
4897
+ _context45.next = 19;
4846
4898
  return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
4847
4899
  case 19:
4848
- _yield$this$ensureAva3 = _context44.sent;
4900
+ _yield$this$ensureAva3 = _context45.sent;
4849
4901
  context = _yield$this$ensureAva3.context;
4850
4902
  projectionEntry = _yield$this$ensureAva3.projectionEntry;
4851
4903
  refreshed = _yield$this$ensureAva3.refreshed;
4852
4904
  if (!refreshed) {
4853
- _context44.next = 25;
4905
+ _context45.next = 25;
4854
4906
  break;
4855
4907
  }
4856
4908
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -4861,11 +4913,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4861
4913
  case 25:
4862
4914
  boundEditingUids = context.prepareParams.editingProductLineUids || [];
4863
4915
  if (!(params.mode === 'edit')) {
4864
- _context44.next = 31;
4916
+ _context45.next = 31;
4865
4917
  break;
4866
4918
  }
4867
4919
  if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
4868
- _context44.next = 29;
4920
+ _context45.next = 29;
4869
4921
  break;
4870
4922
  }
4871
4923
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
@@ -4874,11 +4926,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4874
4926
  editingProductLineUids: boundEditingUids
4875
4927
  });
4876
4928
  case 29:
4877
- _context44.next = 33;
4929
+ _context45.next = 33;
4878
4930
  break;
4879
4931
  case 31:
4880
4932
  if (!(boundEditingUids.length > 0)) {
4881
- _context44.next = 33;
4933
+ _context45.next = 33;
4882
4934
  break;
4883
4935
  }
4884
4936
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
@@ -4887,7 +4939,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4887
4939
  });
4888
4940
  case 33:
4889
4941
  if (!(projectionEntry.contextVersion !== context.activeVersion)) {
4890
- _context44.next = 35;
4942
+ _context45.next = 35;
4891
4943
  break;
4892
4944
  }
4893
4945
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -4897,7 +4949,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4897
4949
  });
4898
4950
  case 35:
4899
4951
  if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
4900
- _context44.next = 37;
4952
+ _context45.next = 37;
4901
4953
  break;
4902
4954
  }
4903
4955
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
@@ -4908,7 +4960,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4908
4960
  });
4909
4961
  case 37:
4910
4962
  if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
4911
- _context44.next = 39;
4963
+ _context45.next = 39;
4912
4964
  break;
4913
4965
  }
4914
4966
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
@@ -4920,7 +4972,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4920
4972
  this.assertAvailabilityCandidateFreshness(context, params.candidate);
4921
4973
  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;
4922
4974
  if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
4923
- _context44.next = 43;
4975
+ _context45.next = 43;
4924
4976
  break;
4925
4977
  }
4926
4978
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
@@ -4929,14 +4981,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4929
4981
  });
4930
4982
  case 43:
4931
4983
  if (!(params.mode === 'edit' && !params.productLineUid)) {
4932
- _context44.next = 45;
4984
+ _context45.next = 45;
4933
4985
  break;
4934
4986
  }
4935
4987
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
4936
4988
  case 45:
4937
4989
  editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
4938
4990
  if (!(params.mode === 'edit' && !editingLine)) {
4939
- _context44.next = 48;
4991
+ _context45.next = 48;
4940
4992
  break;
4941
4993
  }
4942
4994
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
@@ -4944,7 +4996,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4944
4996
  });
4945
4997
  case 48:
4946
4998
  if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
4947
- _context44.next = 50;
4999
+ _context45.next = 50;
4948
5000
  break;
4949
5001
  }
4950
5002
  throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
@@ -4954,7 +5006,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4954
5006
  });
4955
5007
  case 50:
4956
5008
  if (Array.isArray(params.requirementSelections)) {
4957
- _context44.next = 52;
5009
+ _context45.next = 52;
4958
5010
  break;
4959
5011
  }
4960
5012
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
@@ -4971,7 +5023,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4971
5023
  };
4972
5024
  prepareParams = baseProjection.meta.prepareParams;
4973
5025
  if (prepareParams) {
4974
- _context44.next = 57;
5026
+ _context45.next = 57;
4975
5027
  break;
4976
5028
  }
4977
5029
  throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
@@ -4983,7 +5035,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4983
5035
  })),
4984
5036
  includesInjectedRawOccupancies: true
4985
5037
  };
4986
- _context44.next = 60;
5038
+ _context45.next = 60;
4987
5039
  return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
4988
5040
  editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
4989
5041
  }), {
@@ -4992,13 +5044,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4992
5044
  durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
4993
5045
  });
4994
5046
  case 60:
4995
- commitSnapshot = _context44.sent;
5047
+ commitSnapshot = _context45.sent;
4996
5048
  refreshedProjection = commitSnapshot.projection;
4997
5049
  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 : ''))) {
4998
- _context44.next = 67;
5050
+ _context45.next = 67;
4999
5051
  break;
5000
5052
  }
5001
- _context44.next = 65;
5053
+ _context45.next = 65;
5002
5054
  return this.refreshAvailabilityContextProjection({
5003
5055
  contextId: normalizedContextId,
5004
5056
  reason: 'commit_order_revision_changed',
@@ -5019,7 +5071,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5019
5071
  this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
5020
5072
  candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
5021
5073
  candidateStartTime = getCandidateStartTime(params.candidate);
5022
- allowPosAvailabilityOverride = String((_this$otherParams$pla4 = (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() === 'pos';
5074
+ allowPosAvailabilityOverride = String((_this$otherParams$pla4 = (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() === 'pos';
5023
5075
  refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
5024
5076
  productIds: [params.candidate.productId],
5025
5077
  dateRange: {
@@ -5043,7 +5095,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5043
5095
  return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
5044
5096
  });
5045
5097
  if (refreshedCandidateBase) {
5046
- _context44.next = 75;
5098
+ _context45.next = 75;
5047
5099
  break;
5048
5100
  }
5049
5101
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
@@ -5056,7 +5108,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5056
5108
  return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
5057
5109
  });
5058
5110
  if (product) {
5059
- _context44.next = 78;
5111
+ _context45.next = 78;
5060
5112
  break;
5061
5113
  }
5062
5114
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
@@ -5093,7 +5145,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5093
5145
  });
5094
5146
  }
5095
5147
  if (validation.ok) {
5096
- _context44.next = 83;
5148
+ _context45.next = 83;
5097
5149
  break;
5098
5150
  }
5099
5151
  capacityConflict = validation.conflicts.find(function (conflict) {
@@ -5116,7 +5168,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5116
5168
  incrementVersion: true
5117
5169
  });
5118
5170
  revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
5119
- _context44.next = 87;
5171
+ _context45.next = 87;
5120
5172
  return this.emitAvailabilityDiagnostic({
5121
5173
  action: 'refresh',
5122
5174
  contextId: normalizedContextId,
@@ -5139,7 +5191,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5139
5191
  existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
5140
5192
  existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
5141
5193
  if (!(params.mode === 'edit' && !existingBookingUid)) {
5142
- _context44.next = 93;
5194
+ _context45.next = 93;
5143
5195
  break;
5144
5196
  }
5145
5197
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
@@ -5153,15 +5205,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5153
5205
  product: product,
5154
5206
  resources: refreshedProjection.resources,
5155
5207
  bookingUid: existingBookingUid || undefined,
5156
- holder: (_ref52 = (_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 : existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _ref52 !== void 0 ? _ref52 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
5157
- holderIds: (_ref53 = (_ref54 = (_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 && _ref54 !== void 0 ? _ref54 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref53 !== void 0 ? _ref53 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
5208
+ holder: (_ref53 = (_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 : existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _ref53 !== void 0 ? _ref53 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
5209
+ holderIds: (_ref54 = (_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 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref54 !== void 0 ? _ref54 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
5158
5210
  });
5159
5211
  transformed = this.buildUnifiedOrderProduct(_objectSpread(_objectSpread({}, params.orderProduct), {}, {
5160
5212
  num: bookingCount,
5161
5213
  quantity: bookingCount
5162
5214
  }), 'unified_booking_sales', product);
5163
5215
  if (transformed) {
5164
- _context44.next = 98;
5216
+ _context45.next = 98;
5165
5217
  break;
5166
5218
  }
5167
5219
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
@@ -5180,7 +5232,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5180
5232
  productLineUids = [];
5181
5233
  bookingUids = [];
5182
5234
  if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
5183
- _context44.next = 117;
5235
+ _context45.next = 117;
5184
5236
  break;
5185
5237
  }
5186
5238
  transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
@@ -5190,10 +5242,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5190
5242
  unique_identification_number: params.productLineUid,
5191
5243
  booking_uid: existingBookingUid
5192
5244
  });
5193
- _context44.next = 111;
5245
+ _context45.next = 111;
5194
5246
  return this.updateOrderProduct(_objectSpread(_objectSpread({
5195
5247
  product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
5196
- product_variant_id: (_ref55 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref55 !== void 0 ? _ref55 : 0,
5248
+ 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,
5197
5249
  unique_identification_number: params.productLineUid,
5198
5250
  updates: transformed,
5199
5251
  booking: booking
@@ -5207,7 +5259,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5207
5259
  bookingUid = existingBookingUid;
5208
5260
  productLineUids = [productLineUid];
5209
5261
  bookingUids = [bookingUid];
5210
- _context44.next = 129;
5262
+ _context45.next = 129;
5211
5263
  break;
5212
5264
  case 117:
5213
5265
  beforeProductLineUids = new Set((((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || []).map(function (line) {
@@ -5216,12 +5268,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5216
5268
  beforeBookingUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.bookings) || []).map(function (item) {
5217
5269
  return getBookingUid(item);
5218
5270
  }).filter(Boolean));
5219
- _context44.next = 121;
5271
+ _context45.next = 121;
5220
5272
  return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length ? {
5221
5273
  salesNotes: params.salesNotes
5222
5274
  } : undefined);
5223
5275
  case 121:
5224
- products = _context44.sent;
5276
+ products = _context45.sent;
5225
5277
  addedLines = products.filter(function (line) {
5226
5278
  var _line$product_id, _line$metadata;
5227
5279
  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));
@@ -5238,8 +5290,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5238
5290
  }).filter(Boolean);
5239
5291
  if (bookingUids.length === 0) {
5240
5292
  bookingUids = addedLines.map(function (line) {
5241
- var _ref56, _line$booking_uid, _line$metadata2;
5242
- return String((_ref56 = (_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 && _ref56 !== void 0 ? _ref56 : '');
5293
+ var _ref57, _line$booking_uid, _line$metadata2;
5294
+ return String((_ref57 = (_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 && _ref57 !== void 0 ? _ref57 : '');
5243
5295
  }).filter(Boolean);
5244
5296
  }
5245
5297
  productLineUid = productLineUids[productLineUids.length - 1] || '';
@@ -5258,23 +5310,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5258
5310
  productLineUids: productLineUids,
5259
5311
  bookingUids: bookingUids
5260
5312
  };
5261
- _context44.next = 134;
5313
+ _context45.next = 134;
5262
5314
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
5263
5315
  case 134:
5264
- return _context44.abrupt("return", result);
5316
+ return _context45.abrupt("return", result);
5265
5317
  case 135:
5266
- _context44.prev = 135;
5267
- _context44.next = 138;
5318
+ _context45.prev = 135;
5319
+ _context45.next = 138;
5268
5320
  return this.releaseAvailabilityCommitLock(normalizedContextId);
5269
5321
  case 138:
5270
- return _context44.finish(135);
5322
+ return _context45.finish(135);
5271
5323
  case 139:
5272
5324
  case "end":
5273
- return _context44.stop();
5325
+ return _context45.stop();
5274
5326
  }
5275
- }, _callee44, this, [[5,, 135, 139]]);
5327
+ }, _callee45, this, [[5,, 135, 139]]);
5276
5328
  }));
5277
- function commitAvailabilitySelection(_x34, _x35) {
5329
+ function commitAvailabilitySelection(_x35, _x36) {
5278
5330
  return _commitAvailabilitySelection.apply(this, arguments);
5279
5331
  }
5280
5332
  return commitAvailabilitySelection;