@pisell/pisellos 0.10.70 → 0.10.72
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.
- package/dist/modules/BookingContext/utils/productExtend.d.ts +5 -0
- package/dist/modules/BookingContext/utils/productExtend.js +61 -23
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/salesSettings.d.ts +32 -0
- package/dist/modules/OpenData/salesSettings.js +80 -0
- package/dist/modules/OpenData/types.d.ts +13 -0
- package/dist/modules/Order/index.d.ts +13 -4
- package/dist/modules/Order/index.js +1401 -764
- package/dist/modules/Order/types.d.ts +24 -1
- package/dist/modules/Order/types.js +4 -0
- package/dist/server/index.js +5 -2
- package/dist/solution/BaseSales/index.d.ts +2 -2
- package/dist/solution/BaseSales/index.js +8 -8
- package/dist/solution/BookingTicket/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +36 -1
- package/dist/solution/UnifiedBookingSales/index.js +1434 -709
- package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +17 -1
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/BookingContext/utils/productExtend.d.ts +5 -0
- package/lib/modules/BookingContext/utils/productExtend.js +36 -3
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/salesSettings.d.ts +32 -0
- package/lib/modules/OpenData/salesSettings.js +70 -0
- package/lib/modules/OpenData/types.d.ts +13 -0
- package/lib/modules/Order/index.d.ts +13 -4
- package/lib/modules/Order/index.js +284 -24
- package/lib/modules/Order/types.d.ts +24 -1
- package/lib/modules/Order/types.js +2 -0
- package/lib/server/index.js +5 -1
- package/lib/solution/BaseSales/index.d.ts +2 -2
- package/lib/solution/BaseSales/index.js +2 -2
- package/lib/solution/BookingTicket/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.d.ts +36 -1
- package/lib/solution/UnifiedBookingSales/index.js +463 -45
- package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +17 -1
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
var _excluded = ["
|
|
1
|
+
var _excluded = ["product_ids"],
|
|
2
|
+
_excluded2 = ["product_id", "product_ids"],
|
|
3
|
+
_excluded3 = ["date", "custom_page_id", "channel", "product_ids"];
|
|
2
4
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
5
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
6
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -36,9 +38,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
36
38
|
import dayjs from 'dayjs';
|
|
37
39
|
import { cloneDeep } from 'lodash-es';
|
|
38
40
|
import { OpenDataModule } from "../../modules";
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
+
import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
|
|
42
|
+
import { isProductFlexibleDuration, isSessionProduct, isBookingProduct, isMultiDayProduct } from "../../modules/BookingContext/utils";
|
|
43
|
+
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeSalesSettings } from "../../modules/OpenData";
|
|
44
|
+
import { getBookingBoundary, getBookingHolderIds, normalizeBookingDateTime, resolveDefaultBookingStart } from "./salesSettings";
|
|
41
45
|
import { getScheduleStartEndTimePoints } from "../../modules/Schedule/getDateIsInSchedule";
|
|
46
|
+
import { PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants } from "../../modules/ProductList/clientDataVariants";
|
|
42
47
|
import { AvailabilityError, createAvailabilityProjection, getProductTimeRanges as getProjectionProductTimeRanges, queryAvailabilityProjection, validateAvailabilitySelection } from "../../modules/ResourcePlanner";
|
|
43
48
|
import { UnifiedBookingSalesHooks } from "./types";
|
|
44
49
|
import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
|
|
@@ -48,8 +53,9 @@ import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, for
|
|
|
48
53
|
import { isCustomerUserPlatform, isSelfServicePlatform, normalizeRuntimePlatform } from "../../utils/platform";
|
|
49
54
|
import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
50
55
|
export * from "./types";
|
|
56
|
+
export * from "./salesSettings";
|
|
51
57
|
export { AvailabilityError } from "../../modules/ResourcePlanner";
|
|
52
|
-
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability'];
|
|
58
|
+
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability', 'interface'];
|
|
53
59
|
function normalizePositiveInteger(value) {
|
|
54
60
|
var normalized = Number(value);
|
|
55
61
|
if (!Number.isInteger(normalized) || normalized <= 0) return undefined;
|
|
@@ -1134,12 +1140,17 @@ function buildBookingFromAvailabilitySelection(params) {
|
|
|
1134
1140
|
}
|
|
1135
1141
|
} : {});
|
|
1136
1142
|
}),
|
|
1137
|
-
metadata: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, bookingUid ? {
|
|
1143
|
+
metadata: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, bookingUid ? {
|
|
1138
1144
|
unique_identification_number: bookingUid
|
|
1139
1145
|
} : {}), {}, {
|
|
1140
1146
|
unified_booking_sales: true,
|
|
1141
1147
|
availability_candidate_key: candidate.key,
|
|
1142
1148
|
availability_source: candidate.source,
|
|
1149
|
+
availability_business_date: candidate.businessDate || candidate.date,
|
|
1150
|
+
availability_timezone: candidate.timezone
|
|
1151
|
+
}, candidate.primaryScheduleRef ? {
|
|
1152
|
+
availability_primary_schedule_ref: cloneDeep(candidate.primaryScheduleRef)
|
|
1153
|
+
} : {}), {}, {
|
|
1143
1154
|
availability_slice_start_at: candidate.startAt,
|
|
1144
1155
|
availability_slice_end_at: candidate.endAt,
|
|
1145
1156
|
availability_schedule_refs: candidate.scheduleRefs
|
|
@@ -2505,39 +2516,297 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2505
2516
|
return _getOpenData.apply(this, arguments);
|
|
2506
2517
|
}
|
|
2507
2518
|
return getOpenData;
|
|
2508
|
-
}()
|
|
2519
|
+
}() /** One policy snapshot for all Sales 2.0 consumers. Network errors must reach the caller. */
|
|
2520
|
+
}, {
|
|
2521
|
+
key: "getSalesSettings",
|
|
2522
|
+
value: (function () {
|
|
2523
|
+
var _getSalesSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
2524
|
+
var _this$otherParams19;
|
|
2525
|
+
var config;
|
|
2526
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
2527
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
2528
|
+
case 0:
|
|
2529
|
+
_context16.next = 2;
|
|
2530
|
+
return this.getOpenData();
|
|
2531
|
+
case 2:
|
|
2532
|
+
config = _context16.sent;
|
|
2533
|
+
if (config) {
|
|
2534
|
+
_context16.next = 5;
|
|
2535
|
+
break;
|
|
2536
|
+
}
|
|
2537
|
+
throw new Error('Sales settings are unavailable without a business context.');
|
|
2538
|
+
case 5:
|
|
2539
|
+
return _context16.abrupt("return", normalizeSalesSettings(config, (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.platform));
|
|
2540
|
+
case 6:
|
|
2541
|
+
case "end":
|
|
2542
|
+
return _context16.stop();
|
|
2543
|
+
}
|
|
2544
|
+
}, _callee16, this);
|
|
2545
|
+
}));
|
|
2546
|
+
function getSalesSettings() {
|
|
2547
|
+
return _getSalesSettings.apply(this, arguments);
|
|
2548
|
+
}
|
|
2549
|
+
return getSalesSettings;
|
|
2550
|
+
}())
|
|
2551
|
+
}, {
|
|
2552
|
+
key: "getLoadedSalesSettings",
|
|
2553
|
+
value: function getLoadedSalesSettings() {
|
|
2554
|
+
var _this$otherParams20;
|
|
2555
|
+
if (!this.runtimeOpenDataSnapshot) {
|
|
2556
|
+
throw new Error('Sales settings are not loaded. Call getSalesSettings before preparing a booking.');
|
|
2557
|
+
}
|
|
2558
|
+
return normalizeSalesSettings(this.runtimeOpenDataSnapshot, (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.platform);
|
|
2559
|
+
}
|
|
2560
|
+
}, {
|
|
2561
|
+
key: "getProductBookingsForScheduling",
|
|
2562
|
+
value: function getProductBookingsForScheduling() {
|
|
2563
|
+
var _this$getTempOrder,
|
|
2564
|
+
_this6 = this;
|
|
2565
|
+
var seen = new Set();
|
|
2566
|
+
return (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).flatMap(function (product) {
|
|
2567
|
+
var _product$metadata4;
|
|
2568
|
+
if (((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.product_add_schedule_time) != null || product.deleted_at) return [];
|
|
2569
|
+
var booking = _this6.findLinkedBooking(product);
|
|
2570
|
+
if (!booking || isFulfillmentTimingBooking(booking) || seen.has(booking)) return [];
|
|
2571
|
+
seen.add(booking);
|
|
2572
|
+
return [booking];
|
|
2573
|
+
});
|
|
2574
|
+
}
|
|
2575
|
+
}, {
|
|
2576
|
+
key: "shouldApplyMultipleBookingScheduling",
|
|
2577
|
+
value: function shouldApplyMultipleBookingScheduling() {
|
|
2578
|
+
var _this$otherParams21;
|
|
2579
|
+
var platform = normalizeRuntimePlatform((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.platform);
|
|
2580
|
+
return platform === 'pos' || platform === 'webpos';
|
|
2581
|
+
}
|
|
2582
|
+
}, {
|
|
2583
|
+
key: "resolveLoadedDefaultBookingStart",
|
|
2584
|
+
value: function resolveLoadedDefaultBookingStart(holderIds, fallback) {
|
|
2585
|
+
// Customer channels keep their entry default instead of following cart bookings.
|
|
2586
|
+
// Keep this callback installed so BookingContext cannot fall back to Board.
|
|
2587
|
+
if (!this.shouldApplyMultipleBookingScheduling()) return normalizeBookingDateTime(fallback);
|
|
2588
|
+
var settings = this.getLoadedSalesSettings();
|
|
2589
|
+
return resolveDefaultBookingStart({
|
|
2590
|
+
bookings: this.getProductBookingsForScheduling(),
|
|
2591
|
+
holderIds: holderIds,
|
|
2592
|
+
mode: settings.reservation.multipleBookingScheduling,
|
|
2593
|
+
fallback: fallback
|
|
2594
|
+
});
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
/** Used by the SKU flow after Holder changes, without changing an explicit user-selected time. */
|
|
2598
|
+
}, {
|
|
2599
|
+
key: "resolveDefaultBookingStart",
|
|
2600
|
+
value: (function () {
|
|
2601
|
+
var _resolveDefaultBookingStart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
2602
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
2603
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
2604
|
+
case 0:
|
|
2605
|
+
if (this.shouldApplyMultipleBookingScheduling()) {
|
|
2606
|
+
_context17.next = 2;
|
|
2607
|
+
break;
|
|
2608
|
+
}
|
|
2609
|
+
return _context17.abrupt("return", normalizeBookingDateTime(params.fallback));
|
|
2610
|
+
case 2:
|
|
2611
|
+
_context17.next = 4;
|
|
2612
|
+
return this.getSalesSettings();
|
|
2613
|
+
case 4:
|
|
2614
|
+
return _context17.abrupt("return", this.resolveLoadedDefaultBookingStart(params.holderIds, params.fallback));
|
|
2615
|
+
case 5:
|
|
2616
|
+
case "end":
|
|
2617
|
+
return _context17.stop();
|
|
2618
|
+
}
|
|
2619
|
+
}, _callee17, this);
|
|
2620
|
+
}));
|
|
2621
|
+
function resolveDefaultBookingStart(_x9) {
|
|
2622
|
+
return _resolveDefaultBookingStart.apply(this, arguments);
|
|
2623
|
+
}
|
|
2624
|
+
return resolveDefaultBookingStart;
|
|
2625
|
+
}())
|
|
2626
|
+
}, {
|
|
2627
|
+
key: "buildBookingCalcContext",
|
|
2628
|
+
value: function buildBookingCalcContext(extra) {
|
|
2629
|
+
var _this7 = this;
|
|
2630
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "buildBookingCalcContext", this).call(this, extra)), {}, {
|
|
2631
|
+
resolveDefaultBookingStart: function resolveDefaultBookingStart(cacheItem, fallback) {
|
|
2632
|
+
var _extra$holderIds;
|
|
2633
|
+
return _this7.resolveLoadedDefaultBookingStart((_extra$holderIds = extra === null || extra === void 0 ? void 0 : extra.holderIds) !== null && _extra$holderIds !== void 0 ? _extra$holderIds : getBookingHolderIds(cacheItem), fallback);
|
|
2634
|
+
}
|
|
2635
|
+
});
|
|
2636
|
+
}
|
|
2637
|
+
}, {
|
|
2638
|
+
key: "buildAddProductCtx",
|
|
2639
|
+
value: function buildAddProductCtx(extra) {
|
|
2640
|
+
var _this8 = this;
|
|
2641
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "buildAddProductCtx", this).call(this, extra)), {}, {
|
|
2642
|
+
resolveDefaultBookingStart: function resolveDefaultBookingStart(cacheItem, fallback) {
|
|
2643
|
+
var _extra$holderIds2;
|
|
2644
|
+
return _this8.resolveLoadedDefaultBookingStart((_extra$holderIds2 = extra === null || extra === void 0 ? void 0 : extra.holderIds) !== null && _extra$holderIds2 !== void 0 ? _extra$holderIds2 : getBookingHolderIds(cacheItem), fallback);
|
|
2645
|
+
}
|
|
2646
|
+
});
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
/** Re-evaluate an automatic default after Holder enrichment, or restore a known explicit TimeBar start. */
|
|
2650
|
+
}, {
|
|
2651
|
+
key: "applyDefaultBookingStart",
|
|
2652
|
+
value: (function () {
|
|
2653
|
+
var _applyDefaultBookingStart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(cacheItem) {
|
|
2654
|
+
var _cacheItem$_extend, _cacheItem$_data, _options$holderIds, _ref34, _normalizeBookingDate, _cacheItem$_data2;
|
|
2655
|
+
var options,
|
|
2656
|
+
extend,
|
|
2657
|
+
currentStart,
|
|
2658
|
+
automaticStart,
|
|
2659
|
+
explicitStart,
|
|
2660
|
+
holderIds,
|
|
2661
|
+
fallback,
|
|
2662
|
+
nextStart,
|
|
2663
|
+
data,
|
|
2664
|
+
nextExtend,
|
|
2665
|
+
_i,
|
|
2666
|
+
_arr,
|
|
2667
|
+
key,
|
|
2668
|
+
shiftDays,
|
|
2669
|
+
_args18 = arguments;
|
|
2670
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
2671
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2672
|
+
case 0:
|
|
2673
|
+
options = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {};
|
|
2674
|
+
if (this.shouldApplyMultipleBookingScheduling()) {
|
|
2675
|
+
_context18.next = 3;
|
|
2676
|
+
break;
|
|
2677
|
+
}
|
|
2678
|
+
return _context18.abrupt("return", cacheItem);
|
|
2679
|
+
case 3:
|
|
2680
|
+
if (!(!(cacheItem !== null && cacheItem !== void 0 && cacheItem.new) || !isBookingProduct(cacheItem) || isSessionProduct(cacheItem) || cacheItem !== null && cacheItem !== void 0 && (_cacheItem$_extend = cacheItem._extend) !== null && _cacheItem$_extend !== void 0 && (_cacheItem$_extend = _cacheItem$_extend.other) !== null && _cacheItem$_extend !== void 0 && _cacheItem$_extend.session)) {
|
|
2681
|
+
_context18.next = 5;
|
|
2682
|
+
break;
|
|
2683
|
+
}
|
|
2684
|
+
return _context18.abrupt("return", cacheItem);
|
|
2685
|
+
case 5:
|
|
2686
|
+
extend = cacheItem._extend || {};
|
|
2687
|
+
currentStart = getBookingBoundary(extend, 'start');
|
|
2688
|
+
automaticStart = normalizeBookingDateTime((_cacheItem$_data = cacheItem._data) === null || _cacheItem$_data === void 0 ? void 0 : _cacheItem$_data.salesDefaultBookingStart);
|
|
2689
|
+
if (!(extend.start_time && (!automaticStart || !currentStart || dayjs(currentStart).valueOf() !== dayjs(automaticStart).valueOf()))) {
|
|
2690
|
+
_context18.next = 10;
|
|
2691
|
+
break;
|
|
2692
|
+
}
|
|
2693
|
+
return _context18.abrupt("return", cacheItem);
|
|
2694
|
+
case 10:
|
|
2695
|
+
explicitStart = normalizeBookingDateTime(options.explicitStart);
|
|
2696
|
+
if (!(options.explicitStart !== undefined && !explicitStart)) {
|
|
2697
|
+
_context18.next = 13;
|
|
2698
|
+
break;
|
|
2699
|
+
}
|
|
2700
|
+
throw new Error('The explicit booking start must be a valid date and time.');
|
|
2701
|
+
case 13:
|
|
2702
|
+
holderIds = (_options$holderIds = options.holderIds) !== null && _options$holderIds !== void 0 ? _options$holderIds : getBookingHolderIds(cacheItem);
|
|
2703
|
+
fallback = (_ref34 = (_normalizeBookingDate = normalizeBookingDateTime((_cacheItem$_data2 = cacheItem._data) === null || _cacheItem$_data2 === void 0 ? void 0 : _cacheItem$_data2.salesDefaultBookingFallback)) !== null && _normalizeBookingDate !== void 0 ? _normalizeBookingDate : currentStart) !== null && _ref34 !== void 0 ? _ref34 : normalizeBookingDateTime(String(this.getBookingDate() || ''));
|
|
2704
|
+
if (!(explicitStart !== null && explicitStart !== void 0)) {
|
|
2705
|
+
_context18.next = 19;
|
|
2706
|
+
break;
|
|
2707
|
+
}
|
|
2708
|
+
_context18.t0 = explicitStart;
|
|
2709
|
+
_context18.next = 22;
|
|
2710
|
+
break;
|
|
2711
|
+
case 19:
|
|
2712
|
+
_context18.next = 21;
|
|
2713
|
+
return this.resolveDefaultBookingStart({
|
|
2714
|
+
holderIds: holderIds,
|
|
2715
|
+
fallback: fallback
|
|
2716
|
+
});
|
|
2717
|
+
case 21:
|
|
2718
|
+
_context18.t0 = _context18.sent;
|
|
2719
|
+
case 22:
|
|
2720
|
+
nextStart = _context18.t0;
|
|
2721
|
+
if (nextStart) {
|
|
2722
|
+
_context18.next = 25;
|
|
2723
|
+
break;
|
|
2724
|
+
}
|
|
2725
|
+
return _context18.abrupt("return", cacheItem);
|
|
2726
|
+
case 25:
|
|
2727
|
+
if (!(currentStart && dayjs(nextStart).valueOf() === dayjs(currentStart).valueOf())) {
|
|
2728
|
+
_context18.next = 32;
|
|
2729
|
+
break;
|
|
2730
|
+
}
|
|
2731
|
+
if (explicitStart) {
|
|
2732
|
+
_context18.next = 28;
|
|
2733
|
+
break;
|
|
2734
|
+
}
|
|
2735
|
+
return _context18.abrupt("return", cacheItem);
|
|
2736
|
+
case 28:
|
|
2737
|
+
data = _objectSpread({}, cacheItem._data);
|
|
2738
|
+
delete data.salesDefaultBookingStart;
|
|
2739
|
+
delete data.salesDefaultBookingFallback;
|
|
2740
|
+
return _context18.abrupt("return", _objectSpread(_objectSpread({}, cacheItem), {}, {
|
|
2741
|
+
_data: data
|
|
2742
|
+
}));
|
|
2743
|
+
case 32:
|
|
2744
|
+
nextExtend = _objectSpread(_objectSpread({}, extend), {}, {
|
|
2745
|
+
start_date: nextStart.slice(0, 10),
|
|
2746
|
+
start_time: nextStart.slice(11)
|
|
2747
|
+
});
|
|
2748
|
+
for (_i = 0, _arr = ['startDate', 'endDate', 'end_time', 'resource', 'resources', 'availabilitySelection']; _i < _arr.length; _i++) {
|
|
2749
|
+
key = _arr[_i];
|
|
2750
|
+
delete nextExtend[key];
|
|
2751
|
+
}
|
|
2752
|
+
if (isMultiDayProduct(cacheItem) && currentStart && extend.end_date) {
|
|
2753
|
+
shiftDays = dayjs(nextStart.slice(0, 10)).diff(dayjs(currentStart.slice(0, 10)), 'day');
|
|
2754
|
+
nextExtend.end_date = dayjs(extend.end_date).add(shiftDays, 'day').format('YYYY-MM-DD');
|
|
2755
|
+
} else {
|
|
2756
|
+
delete nextExtend.end_date;
|
|
2757
|
+
}
|
|
2758
|
+
return _context18.abrupt("return", this.getProductExtend(_objectSpread(_objectSpread({}, cacheItem), {}, {
|
|
2759
|
+
_extend: nextExtend,
|
|
2760
|
+
_data: explicitStart ? {} : {
|
|
2761
|
+
salesDefaultBookingStart: nextStart,
|
|
2762
|
+
salesDefaultBookingFallback: fallback
|
|
2763
|
+
}
|
|
2764
|
+
}), {
|
|
2765
|
+
holderIds: holderIds
|
|
2766
|
+
}));
|
|
2767
|
+
case 36:
|
|
2768
|
+
case "end":
|
|
2769
|
+
return _context18.stop();
|
|
2770
|
+
}
|
|
2771
|
+
}, _callee18, this);
|
|
2772
|
+
}));
|
|
2773
|
+
function applyDefaultBookingStart(_x10) {
|
|
2774
|
+
return _applyDefaultBookingStart.apply(this, arguments);
|
|
2775
|
+
}
|
|
2776
|
+
return applyDefaultBookingStart;
|
|
2777
|
+
}())
|
|
2509
2778
|
}, {
|
|
2510
2779
|
key: "loadPickupTimingOpenData",
|
|
2511
2780
|
value: function () {
|
|
2512
|
-
var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2513
|
-
var
|
|
2781
|
+
var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_force) {
|
|
2782
|
+
var _ref35, _this$otherParams$bus2, _this$otherParams22, _this$otherParams23;
|
|
2514
2783
|
var scope, businessCode, config;
|
|
2515
|
-
return _regeneratorRuntime().wrap(function
|
|
2516
|
-
while (1) switch (
|
|
2784
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
2785
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2517
2786
|
case 0:
|
|
2518
2787
|
scope = this.getPickupTimingScope();
|
|
2519
|
-
businessCode = String((
|
|
2520
|
-
|
|
2788
|
+
businessCode = String((_ref35 = (_this$otherParams$bus2 = (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.business_code) !== null && _ref35 !== void 0 ? _ref35 : '').trim();
|
|
2789
|
+
_context19.next = 4;
|
|
2521
2790
|
return this.loadOpenData({
|
|
2522
2791
|
businessCode: businessCode,
|
|
2523
2792
|
channel: this.getSubmitOrderSalesChannel()
|
|
2524
2793
|
});
|
|
2525
2794
|
case 4:
|
|
2526
|
-
config =
|
|
2795
|
+
config = _context19.sent;
|
|
2527
2796
|
if (!(scope !== this.getPickupTimingScope())) {
|
|
2528
|
-
|
|
2797
|
+
_context19.next = 7;
|
|
2529
2798
|
break;
|
|
2530
2799
|
}
|
|
2531
2800
|
throw new Error('Store settings changed. Please try again.');
|
|
2532
2801
|
case 7:
|
|
2533
|
-
return
|
|
2802
|
+
return _context19.abrupt("return", config);
|
|
2534
2803
|
case 8:
|
|
2535
2804
|
case "end":
|
|
2536
|
-
return
|
|
2805
|
+
return _context19.stop();
|
|
2537
2806
|
}
|
|
2538
|
-
},
|
|
2807
|
+
}, _callee19, this);
|
|
2539
2808
|
}));
|
|
2540
|
-
function loadPickupTimingOpenData(
|
|
2809
|
+
function loadPickupTimingOpenData(_x11) {
|
|
2541
2810
|
return _loadPickupTimingOpenData.apply(this, arguments);
|
|
2542
2811
|
}
|
|
2543
2812
|
return loadPickupTimingOpenData;
|
|
@@ -2552,19 +2821,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2552
2821
|
}, {
|
|
2553
2822
|
key: "fetchAllergyItemRuleConfigs",
|
|
2554
2823
|
value: function () {
|
|
2555
|
-
var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2824
|
+
var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(strategyModelIds) {
|
|
2556
2825
|
var _response$data, response, list;
|
|
2557
|
-
return _regeneratorRuntime().wrap(function
|
|
2558
|
-
while (1) switch (
|
|
2826
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2827
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2559
2828
|
case 0:
|
|
2560
2829
|
if (strategyModelIds.length) {
|
|
2561
|
-
|
|
2830
|
+
_context20.next = 2;
|
|
2562
2831
|
break;
|
|
2563
2832
|
}
|
|
2564
|
-
return
|
|
2833
|
+
return _context20.abrupt("return", []);
|
|
2565
2834
|
case 2:
|
|
2566
|
-
|
|
2567
|
-
|
|
2835
|
+
_context20.prev = 2;
|
|
2836
|
+
_context20.next = 5;
|
|
2568
2837
|
return this.request.get('/promotion', {
|
|
2569
2838
|
skip: 1,
|
|
2570
2839
|
num: 99,
|
|
@@ -2572,28 +2841,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2572
2841
|
ids: strategyModelIds
|
|
2573
2842
|
});
|
|
2574
2843
|
case 5:
|
|
2575
|
-
response =
|
|
2844
|
+
response = _context20.sent;
|
|
2576
2845
|
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))) {
|
|
2577
|
-
|
|
2846
|
+
_context20.next = 8;
|
|
2578
2847
|
break;
|
|
2579
2848
|
}
|
|
2580
2849
|
throw new Error('[UnifiedBookingSales] 商品过敏策略加载失败');
|
|
2581
2850
|
case 8:
|
|
2582
2851
|
list = response.data.list;
|
|
2583
|
-
return
|
|
2852
|
+
return _context20.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
|
|
2584
2853
|
return item === null || item === void 0 ? void 0 : item.metadata;
|
|
2585
2854
|
})));
|
|
2586
2855
|
case 12:
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
throw
|
|
2856
|
+
_context20.prev = 12;
|
|
2857
|
+
_context20.t0 = _context20["catch"](2);
|
|
2858
|
+
throw _context20.t0;
|
|
2590
2859
|
case 15:
|
|
2591
2860
|
case "end":
|
|
2592
|
-
return
|
|
2861
|
+
return _context20.stop();
|
|
2593
2862
|
}
|
|
2594
|
-
},
|
|
2863
|
+
}, _callee20, this, [[2, 12]]);
|
|
2595
2864
|
}));
|
|
2596
|
-
function fetchAllergyItemRuleConfigs(
|
|
2865
|
+
function fetchAllergyItemRuleConfigs(_x12) {
|
|
2597
2866
|
return _fetchAllergyItemRuleConfigs.apply(this, arguments);
|
|
2598
2867
|
}
|
|
2599
2868
|
return fetchAllergyItemRuleConfigs;
|
|
@@ -2601,70 +2870,70 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2601
2870
|
}, {
|
|
2602
2871
|
key: "ensureAllergyItemRuleConfigsLoaded",
|
|
2603
2872
|
value: function () {
|
|
2604
|
-
var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2605
|
-
var
|
|
2606
|
-
return _regeneratorRuntime().wrap(function
|
|
2607
|
-
while (1) switch (
|
|
2873
|
+
var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
2874
|
+
var _this9 = this;
|
|
2875
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2876
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2608
2877
|
case 0:
|
|
2609
2878
|
if (!(this.allergyItemRuleConfigs.length > 0)) {
|
|
2610
|
-
|
|
2879
|
+
_context22.next = 2;
|
|
2611
2880
|
break;
|
|
2612
2881
|
}
|
|
2613
|
-
return
|
|
2882
|
+
return _context22.abrupt("return", this.allergyItemRuleConfigs);
|
|
2614
2883
|
case 2:
|
|
2615
2884
|
if (!this.allergyItemRuleConfigsPromise) {
|
|
2616
|
-
|
|
2885
|
+
_context22.next = 4;
|
|
2617
2886
|
break;
|
|
2618
2887
|
}
|
|
2619
|
-
return
|
|
2888
|
+
return _context22.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
2620
2889
|
case 4:
|
|
2621
|
-
this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2622
|
-
var
|
|
2890
|
+
this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
2891
|
+
var _this9$otherParams;
|
|
2623
2892
|
var staticConfigs, openData, enabled, strategyModelIds, loaded;
|
|
2624
|
-
return _regeneratorRuntime().wrap(function
|
|
2625
|
-
while (1) switch (
|
|
2893
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2894
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2626
2895
|
case 0:
|
|
2627
|
-
staticConfigs = normalizeItemRuleStrategyConfigs((
|
|
2896
|
+
staticConfigs = normalizeItemRuleStrategyConfigs((_this9$otherParams = _this9.otherParams) === null || _this9$otherParams === void 0 || (_this9$otherParams = _this9$otherParams.itemRule) === null || _this9$otherParams === void 0 ? void 0 : _this9$otherParams.strategyConfigs);
|
|
2628
2897
|
if (!(staticConfigs.length > 0)) {
|
|
2629
|
-
|
|
2898
|
+
_context21.next = 5;
|
|
2630
2899
|
break;
|
|
2631
2900
|
}
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
return
|
|
2901
|
+
_this9.allergyItemRuleConfigs = staticConfigs;
|
|
2902
|
+
_this9.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2903
|
+
return _context21.abrupt("return", staticConfigs);
|
|
2635
2904
|
case 5:
|
|
2636
|
-
|
|
2637
|
-
return
|
|
2905
|
+
_context21.next = 7;
|
|
2906
|
+
return _this9.getOpenData();
|
|
2638
2907
|
case 7:
|
|
2639
|
-
openData =
|
|
2908
|
+
openData = _context21.sent;
|
|
2640
2909
|
enabled = toConfiguredBoolean(openData === null || openData === void 0 ? void 0 : openData['sale.enable_item_rules']);
|
|
2641
2910
|
strategyModelIds = normalizePositiveIntegerList(openData === null || openData === void 0 ? void 0 : openData['sale.enabled_item_rules']);
|
|
2642
2911
|
if (!(!enabled || !strategyModelIds.length)) {
|
|
2643
|
-
|
|
2912
|
+
_context21.next = 13;
|
|
2644
2913
|
break;
|
|
2645
2914
|
}
|
|
2646
|
-
|
|
2647
|
-
return
|
|
2915
|
+
_this9.allergyItemRuleEvaluator.setStrategyConfigs([]);
|
|
2916
|
+
return _context21.abrupt("return", []);
|
|
2648
2917
|
case 13:
|
|
2649
|
-
|
|
2650
|
-
return
|
|
2918
|
+
_context21.next = 15;
|
|
2919
|
+
return _this9.fetchAllergyItemRuleConfigs(strategyModelIds);
|
|
2651
2920
|
case 15:
|
|
2652
|
-
loaded =
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
return
|
|
2921
|
+
loaded = _context21.sent;
|
|
2922
|
+
_this9.allergyItemRuleConfigs = loaded;
|
|
2923
|
+
_this9.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
|
|
2924
|
+
return _context21.abrupt("return", loaded);
|
|
2656
2925
|
case 19:
|
|
2657
2926
|
case "end":
|
|
2658
|
-
return
|
|
2927
|
+
return _context21.stop();
|
|
2659
2928
|
}
|
|
2660
|
-
},
|
|
2929
|
+
}, _callee21);
|
|
2661
2930
|
}))();
|
|
2662
|
-
return
|
|
2931
|
+
return _context22.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
2663
2932
|
case 6:
|
|
2664
2933
|
case "end":
|
|
2665
|
-
return
|
|
2934
|
+
return _context22.stop();
|
|
2666
2935
|
}
|
|
2667
|
-
},
|
|
2936
|
+
}, _callee22, this);
|
|
2668
2937
|
}));
|
|
2669
2938
|
function ensureAllergyItemRuleConfigsLoaded() {
|
|
2670
2939
|
return _ensureAllergyItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -2678,51 +2947,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2678
2947
|
}, {
|
|
2679
2948
|
key: "resolveProductAllergyRequirement",
|
|
2680
2949
|
value: (function () {
|
|
2681
|
-
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2682
|
-
var _this$
|
|
2950
|
+
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
2951
|
+
var _this$otherParams24, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref38, _runtimeConfig$servic, _this$otherParams25, _ref39, _ref40, _params$channel, _this$otherParams26, _this$otherParams27, _runtimeConfig$submis;
|
|
2683
2952
|
var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
|
|
2684
|
-
return _regeneratorRuntime().wrap(function
|
|
2685
|
-
while (1) switch (
|
|
2953
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2954
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2686
2955
|
case 0:
|
|
2687
2956
|
productId = normalizePositiveInteger(params.productId);
|
|
2688
2957
|
if (productId) {
|
|
2689
|
-
|
|
2958
|
+
_context23.next = 3;
|
|
2690
2959
|
break;
|
|
2691
2960
|
}
|
|
2692
|
-
return
|
|
2961
|
+
return _context23.abrupt("return", null);
|
|
2693
2962
|
case 3:
|
|
2694
|
-
|
|
2963
|
+
_context23.next = 5;
|
|
2695
2964
|
return this.ensureAllergyItemRuleConfigsLoaded();
|
|
2696
2965
|
case 5:
|
|
2697
|
-
strategyConfigs =
|
|
2966
|
+
strategyConfigs = _context23.sent;
|
|
2698
2967
|
if (strategyConfigs.length) {
|
|
2699
|
-
|
|
2968
|
+
_context23.next = 8;
|
|
2700
2969
|
break;
|
|
2701
2970
|
}
|
|
2702
|
-
return
|
|
2971
|
+
return _context23.abrupt("return", null);
|
|
2703
2972
|
case 8:
|
|
2704
2973
|
productVariantId = normalizePositiveInteger(params.productVariantId);
|
|
2705
|
-
runtimeConfig = ((_this$
|
|
2974
|
+
runtimeConfig = ((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.itemRule) || {};
|
|
2706
2975
|
runtimePax = runtimeConfig.pax || {};
|
|
2707
2976
|
cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
|
|
2708
|
-
var _item$product_id, _item$product_variant,
|
|
2977
|
+
var _item$product_id, _item$product_variant, _ref37, _item$num;
|
|
2709
2978
|
return {
|
|
2710
2979
|
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),
|
|
2711
2980
|
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,
|
|
2712
|
-
quantity: Number((
|
|
2981
|
+
quantity: Number((_ref37 = (_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 && _ref37 !== void 0 ? _ref37 : 0)
|
|
2713
2982
|
};
|
|
2714
2983
|
}).filter(function (item) {
|
|
2715
2984
|
return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
|
|
2716
2985
|
});
|
|
2717
|
-
return
|
|
2986
|
+
return _context23.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
|
|
2718
2987
|
pax: {
|
|
2719
2988
|
total: Number((_runtimePax$total = runtimePax.total) !== null && _runtimePax$total !== void 0 ? _runtimePax$total : 0) || 0,
|
|
2720
2989
|
adult: Number((_runtimePax$adult = runtimePax.adult) !== null && _runtimePax$adult !== void 0 ? _runtimePax$adult : 0) || 0,
|
|
2721
2990
|
child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
|
|
2722
2991
|
},
|
|
2723
2992
|
cartItems: cartItems,
|
|
2724
|
-
serviceType: String((
|
|
2725
|
-
channel: String((
|
|
2993
|
+
serviceType: String((_ref38 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.serviceType) !== null && _ref38 !== void 0 ? _ref38 : ''),
|
|
2994
|
+
channel: String((_ref39 = (_ref40 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.channel) !== null && _ref40 !== void 0 ? _ref40 : (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform) !== null && _ref39 !== void 0 ? _ref39 : ''),
|
|
2726
2995
|
currentProduct: _objectSpread({
|
|
2727
2996
|
product_id: productId
|
|
2728
2997
|
}, productVariantId ? {
|
|
@@ -2734,11 +3003,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2734
3003
|
}));
|
|
2735
3004
|
case 13:
|
|
2736
3005
|
case "end":
|
|
2737
|
-
return
|
|
3006
|
+
return _context23.stop();
|
|
2738
3007
|
}
|
|
2739
|
-
},
|
|
3008
|
+
}, _callee23, this);
|
|
2740
3009
|
}));
|
|
2741
|
-
function resolveProductAllergyRequirement(
|
|
3010
|
+
function resolveProductAllergyRequirement(_x13) {
|
|
2742
3011
|
return _resolveProductAllergyRequirement.apply(this, arguments);
|
|
2743
3012
|
}
|
|
2744
3013
|
return resolveProductAllergyRequirement;
|
|
@@ -2752,27 +3021,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2752
3021
|
}, {
|
|
2753
3022
|
key: "getInvoiceLayoutConfig",
|
|
2754
3023
|
value: function () {
|
|
2755
|
-
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3024
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2756
3025
|
var openData;
|
|
2757
|
-
return _regeneratorRuntime().wrap(function
|
|
2758
|
-
while (1) switch (
|
|
3026
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
3027
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2759
3028
|
case 0:
|
|
2760
|
-
|
|
3029
|
+
_context24.next = 2;
|
|
2761
3030
|
return this.getOpenData();
|
|
2762
3031
|
case 2:
|
|
2763
|
-
openData =
|
|
3032
|
+
openData = _context24.sent;
|
|
2764
3033
|
if (!(!openData || !this.store.openData)) {
|
|
2765
|
-
|
|
3034
|
+
_context24.next = 5;
|
|
2766
3035
|
break;
|
|
2767
3036
|
}
|
|
2768
|
-
return
|
|
3037
|
+
return _context24.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
2769
3038
|
case 5:
|
|
2770
|
-
return
|
|
3039
|
+
return _context24.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
2771
3040
|
case 6:
|
|
2772
3041
|
case "end":
|
|
2773
|
-
return
|
|
3042
|
+
return _context24.stop();
|
|
2774
3043
|
}
|
|
2775
|
-
},
|
|
3044
|
+
}, _callee24, this);
|
|
2776
3045
|
}));
|
|
2777
3046
|
function getInvoiceLayoutConfig() {
|
|
2778
3047
|
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
@@ -2782,27 +3051,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2782
3051
|
}, {
|
|
2783
3052
|
key: "getInvoiceTemplateSettings",
|
|
2784
3053
|
value: function () {
|
|
2785
|
-
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3054
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
2786
3055
|
var openData;
|
|
2787
|
-
return _regeneratorRuntime().wrap(function
|
|
2788
|
-
while (1) switch (
|
|
3056
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
3057
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2789
3058
|
case 0:
|
|
2790
|
-
|
|
3059
|
+
_context25.next = 2;
|
|
2791
3060
|
return this.getOpenData();
|
|
2792
3061
|
case 2:
|
|
2793
|
-
openData =
|
|
3062
|
+
openData = _context25.sent;
|
|
2794
3063
|
if (!(!openData || !this.store.openData)) {
|
|
2795
|
-
|
|
3064
|
+
_context25.next = 5;
|
|
2796
3065
|
break;
|
|
2797
3066
|
}
|
|
2798
|
-
return
|
|
3067
|
+
return _context25.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
2799
3068
|
case 5:
|
|
2800
|
-
return
|
|
3069
|
+
return _context25.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
2801
3070
|
case 6:
|
|
2802
3071
|
case "end":
|
|
2803
|
-
return
|
|
3072
|
+
return _context25.stop();
|
|
2804
3073
|
}
|
|
2805
|
-
},
|
|
3074
|
+
}, _callee25, this);
|
|
2806
3075
|
}));
|
|
2807
3076
|
function getInvoiceTemplateSettings() {
|
|
2808
3077
|
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
@@ -2812,9 +3081,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2812
3081
|
}, {
|
|
2813
3082
|
key: "isInvoiceOpenDataCacheCurrent",
|
|
2814
3083
|
value: function isInvoiceOpenDataCacheCurrent() {
|
|
2815
|
-
var _this$
|
|
2816
|
-
var businessCode = String(((_this$
|
|
2817
|
-
var channel = String(((_this$
|
|
3084
|
+
var _this$otherParams28, _this$otherParams29;
|
|
3085
|
+
var businessCode = String(((_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.businessCode) || '').trim();
|
|
3086
|
+
var channel = String(((_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.channel) || '').trim();
|
|
2818
3087
|
if (!businessCode || !channel) return false;
|
|
2819
3088
|
return this.openDataTarget === "".concat(businessCode, "+").concat(channel) && this.runtimeOpenDataScope === this.getRuntimeOpenDataScope();
|
|
2820
3089
|
}
|
|
@@ -2825,14 +3094,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2825
3094
|
}, {
|
|
2826
3095
|
key: "getProtocol",
|
|
2827
3096
|
value: (function () {
|
|
2828
|
-
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3097
|
+
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(policyId) {
|
|
2829
3098
|
var normalizedPolicyId, policyUrl;
|
|
2830
|
-
return _regeneratorRuntime().wrap(function
|
|
2831
|
-
while (1) switch (
|
|
3099
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3100
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2832
3101
|
case 0:
|
|
2833
3102
|
normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
|
|
2834
3103
|
if (normalizedPolicyId) {
|
|
2835
|
-
|
|
3104
|
+
_context26.next = 3;
|
|
2836
3105
|
break;
|
|
2837
3106
|
}
|
|
2838
3107
|
throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
|
|
@@ -2841,14 +3110,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2841
3110
|
if (isSelfServicePlatform(this.otherParams.platform) || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
|
|
2842
3111
|
policyUrl = 'policy';
|
|
2843
3112
|
}
|
|
2844
|
-
return
|
|
3113
|
+
return _context26.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
|
|
2845
3114
|
case 6:
|
|
2846
3115
|
case "end":
|
|
2847
|
-
return
|
|
3116
|
+
return _context26.stop();
|
|
2848
3117
|
}
|
|
2849
|
-
},
|
|
3118
|
+
}, _callee26, this);
|
|
2850
3119
|
}));
|
|
2851
|
-
function getProtocol(
|
|
3120
|
+
function getProtocol(_x14) {
|
|
2852
3121
|
return _getProtocol.apply(this, arguments);
|
|
2853
3122
|
}
|
|
2854
3123
|
return getProtocol;
|
|
@@ -2861,21 +3130,236 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2861
3130
|
}, {
|
|
2862
3131
|
key: "loadProducts",
|
|
2863
3132
|
value: (function () {
|
|
2864
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3133
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
3134
|
+
var params,
|
|
3135
|
+
options,
|
|
3136
|
+
catalogScope,
|
|
3137
|
+
result,
|
|
3138
|
+
_args27 = arguments;
|
|
3139
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3140
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
3141
|
+
case 0:
|
|
3142
|
+
params = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {};
|
|
3143
|
+
options = _args27.length > 1 ? _args27[1] : undefined;
|
|
3144
|
+
catalogScope = this.otherParams.catalogScopeKey;
|
|
3145
|
+
_context27.next = 5;
|
|
3146
|
+
return this.loadCatalogProducts(params, options);
|
|
3147
|
+
case 5:
|
|
3148
|
+
result = _context27.sent;
|
|
3149
|
+
if (!(catalogScope !== this.otherParams.catalogScopeKey)) {
|
|
3150
|
+
_context27.next = 8;
|
|
3151
|
+
break;
|
|
3152
|
+
}
|
|
3153
|
+
throw Object.assign(new Error('Product scope changed'), {
|
|
3154
|
+
name: 'AbortError'
|
|
3155
|
+
});
|
|
3156
|
+
case 8:
|
|
3157
|
+
this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
3158
|
+
_context27.next = 11;
|
|
3159
|
+
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
|
|
3160
|
+
case 11:
|
|
3161
|
+
return _context27.abrupt("return", result);
|
|
3162
|
+
case 12:
|
|
3163
|
+
case "end":
|
|
3164
|
+
return _context27.stop();
|
|
3165
|
+
}
|
|
3166
|
+
}, _callee27, this);
|
|
3167
|
+
}));
|
|
3168
|
+
function loadProducts() {
|
|
3169
|
+
return _loadProducts.apply(this, arguments);
|
|
3170
|
+
}
|
|
3171
|
+
return loadProducts;
|
|
3172
|
+
}()
|
|
3173
|
+
/**
|
|
3174
|
+
* Queries one explicitly configured menu scope without publishing the sales catalog.
|
|
3175
|
+
* The returned graph is detached from ProductList's shared ID cache. Callers own its
|
|
3176
|
+
* membership and must requery/reprice with the service datetime after a context change.
|
|
3177
|
+
* Missing/invalid menu configuration fails closed instead of querying every product.
|
|
3178
|
+
*/
|
|
3179
|
+
)
|
|
3180
|
+
}, {
|
|
3181
|
+
key: "queryCatalogSnapshot",
|
|
3182
|
+
value: (function () {
|
|
3183
|
+
var _queryCatalogSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
3184
|
+
var _cloneDeep, product_ids, scopeParams, result, list;
|
|
3185
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3186
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3187
|
+
case 0:
|
|
3188
|
+
if (!(!Array.isArray(params.menu_list_ids) || params.menu_list_ids.length === 0 || params.menu_list_ids.some(function (id) {
|
|
3189
|
+
return !Number.isInteger(id) || id <= 0;
|
|
3190
|
+
}))) {
|
|
3191
|
+
_context28.next = 2;
|
|
3192
|
+
break;
|
|
3193
|
+
}
|
|
3194
|
+
return _context28.abrupt("return", []);
|
|
3195
|
+
case 2:
|
|
3196
|
+
_cloneDeep = cloneDeep(params), product_ids = _cloneDeep.product_ids, scopeParams = _objectWithoutProperties(_cloneDeep, _excluded); // The OS Server ID-query branch intentionally bypasses menus. Apply IDs only after
|
|
3197
|
+
// querying the configured menu so an isolated scope cannot leak other products.
|
|
3198
|
+
_context28.next = 5;
|
|
3199
|
+
return this.loadCatalogProducts(_objectSpread(_objectSpread({}, scopeParams), {}, {
|
|
3200
|
+
menu_list_ids: _toConsumableArray(new Set(params.menu_list_ids))
|
|
3201
|
+
}));
|
|
3202
|
+
case 5:
|
|
3203
|
+
result = _context28.sent;
|
|
3204
|
+
list = Array.isArray(result) ? result : [];
|
|
3205
|
+
return _context28.abrupt("return", cloneDeep(product_ids !== null && product_ids !== void 0 && product_ids.length ? list.filter(function (product) {
|
|
3206
|
+
return product_ids.some(function (id) {
|
|
3207
|
+
return Number(id) === Number(product.id);
|
|
3208
|
+
});
|
|
3209
|
+
}) : list));
|
|
3210
|
+
case 8:
|
|
3211
|
+
case "end":
|
|
3212
|
+
return _context28.stop();
|
|
3213
|
+
}
|
|
3214
|
+
}, _callee28, this);
|
|
3215
|
+
}));
|
|
3216
|
+
function queryCatalogSnapshot(_x15) {
|
|
3217
|
+
return _queryCatalogSnapshot.apply(this, arguments);
|
|
3218
|
+
}
|
|
3219
|
+
return queryCatalogSnapshot;
|
|
3220
|
+
}() /** Full SKU/bundle detail, after verifying membership in the explicit day/menu scope. */)
|
|
3221
|
+
}, {
|
|
3222
|
+
key: "queryCatalogProductDetail",
|
|
3223
|
+
value: (function () {
|
|
3224
|
+
var _queryCatalogProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
3225
|
+
var _this$otherParams30, _this$core$server, _this$core$server$has, _this$otherParams31, _this$otherParams32, _this$otherParams$bus3, _this$otherParams33, _this$otherParams34, _this$core$getPlugin, _this$core3, _this$core$getPlugin$, _this$otherParams35, _response$data$item, _response$data2, _raw$id2, _this$store$products, _this$store$products$;
|
|
3226
|
+
var _cloneDeep2, product_id, _ignoredIds, catalogParams, schedule_date, schedule_datetime, scopedParams, member, baseUrl, localPath, handledByOsServer, channelMap, channel, businessCode, strategy_context, customerId, queryPayload, response, raw, resolved, detail, _i2, _arr2, key;
|
|
3227
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3228
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3229
|
+
case 0:
|
|
3230
|
+
_cloneDeep2 = cloneDeep(params), product_id = _cloneDeep2.product_id, _ignoredIds = _cloneDeep2.product_ids, catalogParams = _objectWithoutProperties(_cloneDeep2, _excluded2);
|
|
3231
|
+
if (!(!Number.isInteger(product_id) || product_id <= 0)) {
|
|
3232
|
+
_context29.next = 3;
|
|
3233
|
+
break;
|
|
3234
|
+
}
|
|
3235
|
+
return _context29.abrupt("return", undefined);
|
|
3236
|
+
case 3:
|
|
3237
|
+
schedule_date = catalogParams.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
3238
|
+
schedule_datetime = catalogParams.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
3239
|
+
scopedParams = _objectSpread(_objectSpread({}, catalogParams), {}, {
|
|
3240
|
+
schedule_date: schedule_date,
|
|
3241
|
+
schedule_datetime: schedule_datetime
|
|
3242
|
+
});
|
|
3243
|
+
_context29.next = 8;
|
|
3244
|
+
return this.queryCatalogSnapshot(scopedParams);
|
|
3245
|
+
case 8:
|
|
3246
|
+
member = _context29.sent.find(function (item) {
|
|
3247
|
+
return Number(item.id) === product_id;
|
|
3248
|
+
});
|
|
3249
|
+
if (member) {
|
|
3250
|
+
_context29.next = 11;
|
|
3251
|
+
break;
|
|
3252
|
+
}
|
|
3253
|
+
return _context29.abrupt("return", undefined);
|
|
3254
|
+
case 11:
|
|
3255
|
+
baseUrl = String(this.request.baseUrl || (isCustomerUserPlatform((_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform) ? '/h5' : '/shop')).replace(/\/+$/, '');
|
|
3256
|
+
localPath = "/product/query/".concat(product_id);
|
|
3257
|
+
handledByOsServer = ((_this$core$server = this.core.server) === null || _this$core$server === void 0 || (_this$core$server$has = _this$core$server.hasRoute) === null || _this$core$server$has === void 0 ? void 0 : _this$core$server$has.call(_this$core$server, 'get', "".concat(baseUrl).concat(localPath))) === true;
|
|
3258
|
+
channelMap = {
|
|
3259
|
+
online_store: 'online-store',
|
|
3260
|
+
scan_to_order: 'online-store',
|
|
3261
|
+
'scan-to-order': 'online-store',
|
|
3262
|
+
scan_to_order_2: 'online-store',
|
|
3263
|
+
scan_to_order_3: 'scantoorder3'
|
|
3264
|
+
};
|
|
3265
|
+
channel = channelMap[(_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.channel] || ((_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.channel);
|
|
3266
|
+
businessCode = (_this$otherParams$bus3 = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.businessCode) !== null && _this$otherParams$bus3 !== void 0 ? _this$otherParams$bus3 : (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.business_code;
|
|
3267
|
+
strategy_context = _objectSpread(_objectSpread(_objectSpread({}, channel ? {
|
|
3268
|
+
channel: channel
|
|
3269
|
+
} : {}), businessCode ? {
|
|
3270
|
+
business_code: businessCode
|
|
3271
|
+
} : {}), scopedParams.strategy_context || {});
|
|
3272
|
+
customerId = scopedParams.customer_id;
|
|
3273
|
+
if (customerId == null) customerId = (_this$core$getPlugin = (_this$core3 = this.core).getPlugin) === null || _this$core$getPlugin === void 0 || (_this$core$getPlugin = _this$core$getPlugin.call(_this$core3, 'user')) === null || _this$core$getPlugin === void 0 || (_this$core$getPlugin$ = _this$core$getPlugin.get) === null || _this$core$getPlugin$ === void 0 || (_this$core$getPlugin$ = _this$core$getPlugin$.call(_this$core$getPlugin)) === null || _this$core$getPlugin$ === void 0 ? void 0 : _this$core$getPlugin$.id;
|
|
3274
|
+
queryPayload = _objectSpread(_objectSpread({}, scopedParams), {}, {
|
|
3275
|
+
customer_id: customerId,
|
|
3276
|
+
strategy_context: strategy_context,
|
|
3277
|
+
application_code: channel,
|
|
3278
|
+
is_eject: 1,
|
|
3279
|
+
open_bundle: 1,
|
|
3280
|
+
with_schedule: 1,
|
|
3281
|
+
with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS)
|
|
3282
|
+
}, isCustomerUserPlatform((_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.platform) ? {} : {
|
|
3283
|
+
open_quotation: 1
|
|
3284
|
+
});
|
|
3285
|
+
_context29.next = 23;
|
|
3286
|
+
return this.request.get(baseUrl === '/shop' ? localPath : "/product/show/".concat(product_id), queryPayload, {
|
|
3287
|
+
osServer: true,
|
|
3288
|
+
useCache: false,
|
|
3289
|
+
customToast: function customToast() {}
|
|
3290
|
+
});
|
|
3291
|
+
case 23:
|
|
3292
|
+
response = _context29.sent;
|
|
3293
|
+
if (!((response === null || response === void 0 ? void 0 : response.status) === false || Number(response === null || response === void 0 ? void 0 : response.code) >= 400)) {
|
|
3294
|
+
_context29.next = 26;
|
|
3295
|
+
break;
|
|
3296
|
+
}
|
|
3297
|
+
throw new Error('[UnifiedBookingSales] Product detail query failed');
|
|
3298
|
+
case 26:
|
|
3299
|
+
raw = (_response$data$item = response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.item) !== null && _response$data$item !== void 0 ? _response$data$item : response === null || response === void 0 ? void 0 : response.data;
|
|
3300
|
+
if (!(!raw || Number((_raw$id2 = raw.id) !== null && _raw$id2 !== void 0 ? _raw$id2 : raw.product_id) !== product_id)) {
|
|
3301
|
+
_context29.next = 29;
|
|
3302
|
+
break;
|
|
3303
|
+
}
|
|
3304
|
+
return _context29.abrupt("return", undefined);
|
|
3305
|
+
case 29:
|
|
3306
|
+
if (!(raw.status && raw.status !== 'published')) {
|
|
3307
|
+
_context29.next = 31;
|
|
3308
|
+
break;
|
|
3309
|
+
}
|
|
3310
|
+
return _context29.abrupt("return", undefined);
|
|
3311
|
+
case 31:
|
|
3312
|
+
if (!handledByOsServer) (_this$store$products = this.store.products) === null || _this$store$products === void 0 || (_this$store$products$ = _this$store$products.rememberRawProductQueryResult) === null || _this$store$products$ === void 0 || _this$store$products$.call(_this$store$products, [cloneDeep(raw)]);
|
|
3313
|
+
resolved = resolveClientDataVariants({
|
|
3314
|
+
core: this.core,
|
|
3315
|
+
otherParams: this.otherParams,
|
|
3316
|
+
products: [cloneDeep(raw)],
|
|
3317
|
+
queryPayload: queryPayload,
|
|
3318
|
+
handledByOsServer: handledByOsServer
|
|
3319
|
+
})[0]; // Detail owns relation arrays. Never synthesize empty groups from list counts.
|
|
3320
|
+
if (resolved) {
|
|
3321
|
+
_context29.next = 35;
|
|
3322
|
+
break;
|
|
3323
|
+
}
|
|
3324
|
+
return _context29.abrupt("return", undefined);
|
|
3325
|
+
case 35:
|
|
3326
|
+
detail = _objectSpread(_objectSpread(_objectSpread({}, member), resolved), {}, {
|
|
3327
|
+
metadata: _objectSpread(_objectSpread({}, member.metadata || {}), resolved.metadata || {})
|
|
3328
|
+
});
|
|
3329
|
+
for (_i2 = 0, _arr2 = ['bundle_group', 'bundle_groups', 'option_group', 'variant_group', 'variant']; _i2 < _arr2.length; _i2++) {
|
|
3330
|
+
key = _arr2[_i2];
|
|
3331
|
+
if (!Object.prototype.hasOwnProperty.call(resolved, key)) delete detail[key];
|
|
3332
|
+
}
|
|
3333
|
+
return _context29.abrupt("return", cloneDeep(detail));
|
|
3334
|
+
case 38:
|
|
3335
|
+
case "end":
|
|
3336
|
+
return _context29.stop();
|
|
3337
|
+
}
|
|
3338
|
+
}, _callee29, this);
|
|
3339
|
+
}));
|
|
3340
|
+
function queryCatalogProductDetail(_x16) {
|
|
3341
|
+
return _queryCatalogProductDetail.apply(this, arguments);
|
|
3342
|
+
}
|
|
3343
|
+
return queryCatalogProductDetail;
|
|
3344
|
+
}())
|
|
3345
|
+
}, {
|
|
3346
|
+
key: "loadCatalogProducts",
|
|
3347
|
+
value: function () {
|
|
3348
|
+
var _loadCatalogProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2865
3349
|
var params,
|
|
2866
3350
|
options,
|
|
2867
3351
|
catalogScope,
|
|
2868
3352
|
schedule_date,
|
|
2869
3353
|
schedule_datetime,
|
|
2870
3354
|
result,
|
|
2871
|
-
|
|
2872
|
-
return _regeneratorRuntime().wrap(function
|
|
2873
|
-
while (1) switch (
|
|
3355
|
+
_args30 = arguments;
|
|
3356
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3357
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2874
3358
|
case 0:
|
|
2875
|
-
params =
|
|
2876
|
-
options =
|
|
3359
|
+
params = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
|
|
3360
|
+
options = _args30.length > 1 ? _args30[1] : undefined;
|
|
2877
3361
|
if (this.store.products) {
|
|
2878
|
-
|
|
3362
|
+
_context30.next = 4;
|
|
2879
3363
|
break;
|
|
2880
3364
|
}
|
|
2881
3365
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
@@ -2883,7 +3367,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2883
3367
|
catalogScope = this.otherParams.catalogScopeKey;
|
|
2884
3368
|
schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
2885
3369
|
schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
2886
|
-
|
|
3370
|
+
_context30.next = 9;
|
|
2887
3371
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
2888
3372
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
2889
3373
|
with_schedule: 1
|
|
@@ -2893,53 +3377,49 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2893
3377
|
cacheId: this.cacheId
|
|
2894
3378
|
}), options);
|
|
2895
3379
|
case 9:
|
|
2896
|
-
result =
|
|
3380
|
+
result = _context30.sent;
|
|
2897
3381
|
if (!(catalogScope !== this.otherParams.catalogScopeKey)) {
|
|
2898
|
-
|
|
3382
|
+
_context30.next = 12;
|
|
2899
3383
|
break;
|
|
2900
3384
|
}
|
|
2901
3385
|
throw Object.assign(new Error('Product scope changed'), {
|
|
2902
3386
|
name: 'AbortError'
|
|
2903
3387
|
});
|
|
2904
3388
|
case 12:
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
|
|
2908
|
-
case 15:
|
|
2909
|
-
return _context24.abrupt("return", result);
|
|
2910
|
-
case 16:
|
|
3389
|
+
return _context30.abrupt("return", result);
|
|
3390
|
+
case 13:
|
|
2911
3391
|
case "end":
|
|
2912
|
-
return
|
|
3392
|
+
return _context30.stop();
|
|
2913
3393
|
}
|
|
2914
|
-
},
|
|
3394
|
+
}, _callee30, this);
|
|
2915
3395
|
}));
|
|
2916
|
-
function
|
|
2917
|
-
return
|
|
3396
|
+
function loadCatalogProducts() {
|
|
3397
|
+
return _loadCatalogProducts.apply(this, arguments);
|
|
2918
3398
|
}
|
|
2919
|
-
return
|
|
2920
|
-
}()
|
|
3399
|
+
return loadCatalogProducts;
|
|
3400
|
+
}()
|
|
2921
3401
|
}, {
|
|
2922
3402
|
key: "queryProducts",
|
|
2923
3403
|
value: function () {
|
|
2924
|
-
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3404
|
+
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2925
3405
|
var params,
|
|
2926
|
-
|
|
2927
|
-
return _regeneratorRuntime().wrap(function
|
|
2928
|
-
while (1) switch (
|
|
3406
|
+
_args31 = arguments;
|
|
3407
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3408
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2929
3409
|
case 0:
|
|
2930
|
-
params =
|
|
3410
|
+
params = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {};
|
|
2931
3411
|
if (this.store.products) {
|
|
2932
|
-
|
|
3412
|
+
_context31.next = 3;
|
|
2933
3413
|
break;
|
|
2934
3414
|
}
|
|
2935
3415
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
2936
3416
|
case 3:
|
|
2937
|
-
return
|
|
3417
|
+
return _context31.abrupt("return", this.store.products.queryProducts(params));
|
|
2938
3418
|
case 4:
|
|
2939
3419
|
case "end":
|
|
2940
|
-
return
|
|
3420
|
+
return _context31.stop();
|
|
2941
3421
|
}
|
|
2942
|
-
},
|
|
3422
|
+
}, _callee31, this);
|
|
2943
3423
|
}));
|
|
2944
3424
|
function queryProducts() {
|
|
2945
3425
|
return _queryProducts.apply(this, arguments);
|
|
@@ -2949,24 +3429,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2949
3429
|
}, {
|
|
2950
3430
|
key: "loadScheduleAvailableDate",
|
|
2951
3431
|
value: (function () {
|
|
2952
|
-
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2953
|
-
return _regeneratorRuntime().wrap(function
|
|
2954
|
-
while (1) switch (
|
|
3432
|
+
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3433
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3434
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2955
3435
|
case 0:
|
|
2956
3436
|
if (this.store.schedule) {
|
|
2957
|
-
|
|
3437
|
+
_context32.next = 2;
|
|
2958
3438
|
break;
|
|
2959
3439
|
}
|
|
2960
3440
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
2961
3441
|
case 2:
|
|
2962
|
-
return
|
|
3442
|
+
return _context32.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
|
|
2963
3443
|
case 3:
|
|
2964
3444
|
case "end":
|
|
2965
|
-
return
|
|
3445
|
+
return _context32.stop();
|
|
2966
3446
|
}
|
|
2967
|
-
},
|
|
3447
|
+
}, _callee32, this);
|
|
2968
3448
|
}));
|
|
2969
|
-
function loadScheduleAvailableDate(
|
|
3449
|
+
function loadScheduleAvailableDate(_x17) {
|
|
2970
3450
|
return _loadScheduleAvailableDate.apply(this, arguments);
|
|
2971
3451
|
}
|
|
2972
3452
|
return loadScheduleAvailableDate;
|
|
@@ -2980,15 +3460,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2980
3460
|
}, {
|
|
2981
3461
|
key: "loadProductsByScheduleDate",
|
|
2982
3462
|
value: (function () {
|
|
2983
|
-
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3463
|
+
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
2984
3464
|
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;
|
|
2985
3465
|
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
|
|
2986
|
-
return _regeneratorRuntime().wrap(function
|
|
2987
|
-
while (1) switch (
|
|
3466
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3467
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2988
3468
|
case 0:
|
|
2989
|
-
date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params,
|
|
3469
|
+
date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded3);
|
|
2990
3470
|
if (this.store.schedule) {
|
|
2991
|
-
|
|
3471
|
+
_context33.next = 3;
|
|
2992
3472
|
break;
|
|
2993
3473
|
}
|
|
2994
3474
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
@@ -2999,10 +3479,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2999
3479
|
});
|
|
3000
3480
|
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;
|
|
3001
3481
|
if (!(!hasCachedDate && !hasOtherProducts)) {
|
|
3002
|
-
|
|
3482
|
+
_context33.next = 9;
|
|
3003
3483
|
break;
|
|
3004
3484
|
}
|
|
3005
|
-
|
|
3485
|
+
_context33.next = 9;
|
|
3006
3486
|
return this.loadScheduleAvailableDate({
|
|
3007
3487
|
startDate: date,
|
|
3008
3488
|
endDate: date,
|
|
@@ -3022,45 +3502,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3022
3502
|
return !productIdFilter || productIdFilter.has(String(id));
|
|
3023
3503
|
});
|
|
3024
3504
|
if (availableProductIds.length) {
|
|
3025
|
-
|
|
3505
|
+
_context33.next = 17;
|
|
3026
3506
|
break;
|
|
3027
3507
|
}
|
|
3028
3508
|
this.unifiedProductCatalog = [];
|
|
3029
|
-
|
|
3509
|
+
_context33.next = 16;
|
|
3030
3510
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
|
|
3031
3511
|
case 16:
|
|
3032
|
-
return
|
|
3512
|
+
return _context33.abrupt("return", []);
|
|
3033
3513
|
case 17:
|
|
3034
|
-
|
|
3514
|
+
_context33.next = 19;
|
|
3035
3515
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
3036
3516
|
product_ids: availableProductIds,
|
|
3037
3517
|
schedule_date: date
|
|
3038
3518
|
}));
|
|
3039
3519
|
case 19:
|
|
3040
|
-
products =
|
|
3520
|
+
products = _context33.sent;
|
|
3041
3521
|
if (!(products.length || availableProductIds.length <= 1)) {
|
|
3042
|
-
|
|
3522
|
+
_context33.next = 22;
|
|
3043
3523
|
break;
|
|
3044
3524
|
}
|
|
3045
|
-
return
|
|
3525
|
+
return _context33.abrupt("return", products);
|
|
3046
3526
|
case 22:
|
|
3047
3527
|
fallbackProducts = [];
|
|
3048
3528
|
_iterator = _createForOfIteratorHelper(availableProductIds);
|
|
3049
|
-
|
|
3529
|
+
_context33.prev = 24;
|
|
3050
3530
|
_iterator.s();
|
|
3051
3531
|
case 26:
|
|
3052
3532
|
if ((_step = _iterator.n()).done) {
|
|
3053
|
-
|
|
3533
|
+
_context33.next = 34;
|
|
3054
3534
|
break;
|
|
3055
3535
|
}
|
|
3056
3536
|
productId = _step.value;
|
|
3057
|
-
|
|
3537
|
+
_context33.next = 30;
|
|
3058
3538
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
3059
3539
|
product_ids: [productId],
|
|
3060
3540
|
schedule_date: date
|
|
3061
3541
|
}));
|
|
3062
3542
|
case 30:
|
|
3063
|
-
result =
|
|
3543
|
+
result = _context33.sent;
|
|
3064
3544
|
result.forEach(function (product) {
|
|
3065
3545
|
var _id;
|
|
3066
3546
|
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;
|
|
@@ -3072,32 +3552,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3072
3552
|
}
|
|
3073
3553
|
});
|
|
3074
3554
|
case 32:
|
|
3075
|
-
|
|
3555
|
+
_context33.next = 26;
|
|
3076
3556
|
break;
|
|
3077
3557
|
case 34:
|
|
3078
|
-
|
|
3558
|
+
_context33.next = 39;
|
|
3079
3559
|
break;
|
|
3080
3560
|
case 36:
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
_iterator.e(
|
|
3561
|
+
_context33.prev = 36;
|
|
3562
|
+
_context33.t0 = _context33["catch"](24);
|
|
3563
|
+
_iterator.e(_context33.t0);
|
|
3084
3564
|
case 39:
|
|
3085
|
-
|
|
3565
|
+
_context33.prev = 39;
|
|
3086
3566
|
_iterator.f();
|
|
3087
|
-
return
|
|
3567
|
+
return _context33.finish(39);
|
|
3088
3568
|
case 42:
|
|
3089
3569
|
this.unifiedProductCatalog = [].concat(fallbackProducts);
|
|
3090
|
-
|
|
3570
|
+
_context33.next = 45;
|
|
3091
3571
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
|
|
3092
3572
|
case 45:
|
|
3093
|
-
return
|
|
3573
|
+
return _context33.abrupt("return", fallbackProducts);
|
|
3094
3574
|
case 46:
|
|
3095
3575
|
case "end":
|
|
3096
|
-
return
|
|
3576
|
+
return _context33.stop();
|
|
3097
3577
|
}
|
|
3098
|
-
},
|
|
3578
|
+
}, _callee33, this, [[24, 36, 39, 42]]);
|
|
3099
3579
|
}));
|
|
3100
|
-
function loadProductsByScheduleDate(
|
|
3580
|
+
function loadProductsByScheduleDate(_x18) {
|
|
3101
3581
|
return _loadProductsByScheduleDate.apply(this, arguments);
|
|
3102
3582
|
}
|
|
3103
3583
|
return loadProductsByScheduleDate;
|
|
@@ -3150,7 +3630,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3150
3630
|
}, {
|
|
3151
3631
|
key: "applyPlannerDiscounts",
|
|
3152
3632
|
value: (function () {
|
|
3153
|
-
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3633
|
+
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
3154
3634
|
var _params$customerId;
|
|
3155
3635
|
var params,
|
|
3156
3636
|
tempOrder,
|
|
@@ -3167,24 +3647,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3167
3647
|
discount,
|
|
3168
3648
|
discountId,
|
|
3169
3649
|
nextTempOrder,
|
|
3170
|
-
|
|
3171
|
-
return _regeneratorRuntime().wrap(function
|
|
3172
|
-
while (1) switch (
|
|
3650
|
+
_args34 = arguments;
|
|
3651
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3652
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3173
3653
|
case 0:
|
|
3174
|
-
params =
|
|
3654
|
+
params = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {};
|
|
3175
3655
|
tempOrder = this.getTempOrder();
|
|
3176
3656
|
requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
3177
3657
|
parsedCustomerId = Number(requestedCustomerId);
|
|
3178
3658
|
customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
|
|
3179
|
-
|
|
3659
|
+
_context34.next = 7;
|
|
3180
3660
|
return this.getSummary();
|
|
3181
3661
|
case 7:
|
|
3182
|
-
summaryBefore =
|
|
3662
|
+
summaryBefore = _context34.sent;
|
|
3183
3663
|
if (customerId) {
|
|
3184
|
-
|
|
3664
|
+
_context34.next = 10;
|
|
3185
3665
|
break;
|
|
3186
3666
|
}
|
|
3187
|
-
return
|
|
3667
|
+
return _context34.abrupt("return", buildPlannerDiscountResult({
|
|
3188
3668
|
customerId: null,
|
|
3189
3669
|
discountList: this.getDiscountList(),
|
|
3190
3670
|
products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
|
|
@@ -3193,7 +3673,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3193
3673
|
status: 'no_customer'
|
|
3194
3674
|
}));
|
|
3195
3675
|
case 10:
|
|
3196
|
-
|
|
3676
|
+
_context34.next = 12;
|
|
3197
3677
|
return this.loadDiscountConfig({
|
|
3198
3678
|
customerId: customerId,
|
|
3199
3679
|
action: 'create'
|
|
@@ -3205,7 +3685,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3205
3685
|
return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
|
|
3206
3686
|
});
|
|
3207
3687
|
if (!preferredDiscount) {
|
|
3208
|
-
|
|
3688
|
+
_context34.next = 40;
|
|
3209
3689
|
break;
|
|
3210
3690
|
}
|
|
3211
3691
|
// A requested card is an explicit UI choice, not a best-effort preference. Clear prior
|
|
@@ -3217,98 +3697,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3217
3697
|
return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
|
|
3218
3698
|
});
|
|
3219
3699
|
_iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
|
|
3220
|
-
|
|
3700
|
+
_context34.prev = 18;
|
|
3221
3701
|
_iterator2.s();
|
|
3222
3702
|
case 20:
|
|
3223
3703
|
if ((_step2 = _iterator2.n()).done) {
|
|
3224
|
-
|
|
3704
|
+
_context34.next = 28;
|
|
3225
3705
|
break;
|
|
3226
3706
|
}
|
|
3227
3707
|
discount = _step2.value;
|
|
3228
3708
|
discountId = Number(resolvePlannerDiscountId(discount));
|
|
3229
3709
|
if (!Number.isFinite(discountId)) {
|
|
3230
|
-
|
|
3710
|
+
_context34.next = 26;
|
|
3231
3711
|
break;
|
|
3232
3712
|
}
|
|
3233
|
-
|
|
3713
|
+
_context34.next = 26;
|
|
3234
3714
|
return this.setDiscountSelected({
|
|
3235
3715
|
discountId: discountId,
|
|
3236
3716
|
isSelected: false
|
|
3237
3717
|
});
|
|
3238
3718
|
case 26:
|
|
3239
|
-
|
|
3719
|
+
_context34.next = 20;
|
|
3240
3720
|
break;
|
|
3241
3721
|
case 28:
|
|
3242
|
-
|
|
3722
|
+
_context34.next = 33;
|
|
3243
3723
|
break;
|
|
3244
3724
|
case 30:
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
_iterator2.e(
|
|
3725
|
+
_context34.prev = 30;
|
|
3726
|
+
_context34.t0 = _context34["catch"](18);
|
|
3727
|
+
_iterator2.e(_context34.t0);
|
|
3248
3728
|
case 33:
|
|
3249
|
-
|
|
3729
|
+
_context34.prev = 33;
|
|
3250
3730
|
_iterator2.f();
|
|
3251
|
-
return
|
|
3731
|
+
return _context34.finish(33);
|
|
3252
3732
|
case 36:
|
|
3253
|
-
|
|
3733
|
+
_context34.next = 38;
|
|
3254
3734
|
return this.setDiscountSelected({
|
|
3255
3735
|
discountId: Number(preferredId),
|
|
3256
3736
|
isSelected: true
|
|
3257
3737
|
});
|
|
3258
3738
|
case 38:
|
|
3259
|
-
|
|
3739
|
+
_context34.next = 49;
|
|
3260
3740
|
break;
|
|
3261
3741
|
case 40:
|
|
3262
3742
|
if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
|
|
3263
|
-
|
|
3743
|
+
_context34.next = 46;
|
|
3264
3744
|
break;
|
|
3265
3745
|
}
|
|
3266
3746
|
if (!(params.applyBestDiscount !== false)) {
|
|
3267
|
-
|
|
3747
|
+
_context34.next = 44;
|
|
3268
3748
|
break;
|
|
3269
3749
|
}
|
|
3270
|
-
|
|
3750
|
+
_context34.next = 44;
|
|
3271
3751
|
return this.bestDiscount();
|
|
3272
3752
|
case 44:
|
|
3273
|
-
|
|
3753
|
+
_context34.next = 49;
|
|
3274
3754
|
break;
|
|
3275
3755
|
case 46:
|
|
3276
3756
|
if (!(params.applyBestDiscount !== false)) {
|
|
3277
|
-
|
|
3757
|
+
_context34.next = 49;
|
|
3278
3758
|
break;
|
|
3279
3759
|
}
|
|
3280
|
-
|
|
3760
|
+
_context34.next = 49;
|
|
3281
3761
|
return this.bestDiscount();
|
|
3282
3762
|
case 49:
|
|
3283
3763
|
nextTempOrder = this.getTempOrder();
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3764
|
+
_context34.t1 = buildPlannerDiscountResult;
|
|
3765
|
+
_context34.t2 = customerId;
|
|
3766
|
+
_context34.t3 = this.getDiscountList();
|
|
3767
|
+
_context34.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
|
|
3768
|
+
_context34.t5 = summaryBefore;
|
|
3769
|
+
_context34.next = 57;
|
|
3290
3770
|
return this.getSummary();
|
|
3291
3771
|
case 57:
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
customerId:
|
|
3298
|
-
discountList:
|
|
3299
|
-
products:
|
|
3300
|
-
summaryBefore:
|
|
3301
|
-
summaryAfter:
|
|
3302
|
-
status:
|
|
3303
|
-
preferredDiscountId:
|
|
3304
|
-
preferredDiscountFound:
|
|
3772
|
+
_context34.t6 = _context34.sent;
|
|
3773
|
+
_context34.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
|
|
3774
|
+
_context34.t8 = preferredDiscountId;
|
|
3775
|
+
_context34.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
|
|
3776
|
+
_context34.t10 = {
|
|
3777
|
+
customerId: _context34.t2,
|
|
3778
|
+
discountList: _context34.t3,
|
|
3779
|
+
products: _context34.t4,
|
|
3780
|
+
summaryBefore: _context34.t5,
|
|
3781
|
+
summaryAfter: _context34.t6,
|
|
3782
|
+
status: _context34.t7,
|
|
3783
|
+
preferredDiscountId: _context34.t8,
|
|
3784
|
+
preferredDiscountFound: _context34.t9
|
|
3305
3785
|
};
|
|
3306
|
-
return
|
|
3786
|
+
return _context34.abrupt("return", (0, _context34.t1)(_context34.t10));
|
|
3307
3787
|
case 63:
|
|
3308
3788
|
case "end":
|
|
3309
|
-
return
|
|
3789
|
+
return _context34.stop();
|
|
3310
3790
|
}
|
|
3311
|
-
},
|
|
3791
|
+
}, _callee34, this, [[18, 30, 33, 36]]);
|
|
3312
3792
|
}));
|
|
3313
3793
|
function applyPlannerDiscounts() {
|
|
3314
3794
|
return _applyPlannerDiscounts.apply(this, arguments);
|
|
@@ -3318,24 +3798,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3318
3798
|
}, {
|
|
3319
3799
|
key: "buildUnifiedOrderProduct",
|
|
3320
3800
|
value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
|
|
3321
|
-
var
|
|
3801
|
+
var _ref41, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref42, _sourceProduct$produc, _ref43, _ref44, _sourceProduct$quanti, _sourceProduct$price, _ref45, _ref46, _sourceProduct$sellin;
|
|
3322
3802
|
var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
|
|
3323
|
-
var quotationShelfId = (
|
|
3803
|
+
var quotationShelfId = (_ref41 = (_sourceProduct$_exten = (_sourceProduct$_exten2 = sourceProduct._extend) === null || _sourceProduct$_exten2 === void 0 ? void 0 : _sourceProduct$_exten2.quotation_shelf_id) !== null && _sourceProduct$_exten !== void 0 ? _sourceProduct$_exten : sourceProduct.quotation_shelf_id) !== null && _ref41 !== void 0 ? _ref41 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
|
|
3324
3804
|
var orderProduct = this.transformBaseProductToOrderProduct({
|
|
3325
3805
|
payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
|
|
3326
3806
|
id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
|
|
3327
|
-
product_id: (
|
|
3328
|
-
quantity: (
|
|
3807
|
+
product_id: (_ref42 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref42 !== void 0 ? _ref42 : product === null || product === void 0 ? void 0 : product.id,
|
|
3808
|
+
quantity: (_ref43 = (_ref44 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref44 !== void 0 ? _ref44 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref43 !== void 0 ? _ref43 : 1,
|
|
3329
3809
|
price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
|
|
3330
|
-
selling_price: (
|
|
3810
|
+
selling_price: (_ref45 = (_ref46 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref46 !== void 0 ? _ref46 : normalizedProductRaw.selling_price) !== null && _ref45 !== void 0 ? _ref45 : normalizedProductRaw.price,
|
|
3331
3811
|
metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
|
|
3332
3812
|
}),
|
|
3333
3813
|
sourceProduct: sourceProduct
|
|
3334
3814
|
});
|
|
3335
3815
|
if (orderProduct && _typeof(orderProduct) === 'object') {
|
|
3816
|
+
var venueMetadata = Object.fromEntries(['venue_booking_role', 'venue_booking_parent_uid', 'venue_booking_service_datetime', 'venue_booking_scope_key'].filter(function (key) {
|
|
3817
|
+
var _sourceProduct$metada2;
|
|
3818
|
+
return ((_sourceProduct$metada2 = sourceProduct.metadata) === null || _sourceProduct$metada2 === void 0 ? void 0 : _sourceProduct$metada2[key]) !== undefined;
|
|
3819
|
+
}).map(function (key) {
|
|
3820
|
+
return [key, sourceProduct.metadata[key]];
|
|
3821
|
+
}));
|
|
3336
3822
|
// BaseSales may rebuild metadata from its price source. Stamp ownership and the selected
|
|
3337
3823
|
// quotation shelf after that transform so neither booking adds nor edits lose quote identity.
|
|
3338
|
-
orderProduct.metadata = _objectSpread(_objectSpread({}, orderProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true), quotationShelfId !== undefined ? {
|
|
3824
|
+
orderProduct.metadata = _objectSpread(_objectSpread(_objectSpread({}, orderProduct.metadata || {}), venueMetadata), {}, _defineProperty({}, ownershipKey, true), quotationShelfId !== undefined ? {
|
|
3339
3825
|
quotation_shelf_id: quotationShelfId
|
|
3340
3826
|
} : {});
|
|
3341
3827
|
}
|
|
@@ -3346,29 +3832,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3346
3832
|
}, {
|
|
3347
3833
|
key: "removeExistingStagedLines",
|
|
3348
3834
|
value: (function () {
|
|
3349
|
-
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3350
|
-
var _this$
|
|
3835
|
+
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(ownershipKey) {
|
|
3836
|
+
var _this$getTempOrder2;
|
|
3351
3837
|
var existingLines;
|
|
3352
|
-
return _regeneratorRuntime().wrap(function
|
|
3353
|
-
while (1) switch (
|
|
3838
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3839
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3354
3840
|
case 0:
|
|
3355
|
-
existingLines = (((_this$
|
|
3356
|
-
var _product$
|
|
3357
|
-
return (product === null || product === void 0 || (_product$
|
|
3841
|
+
existingLines = (((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.products) || []).filter(function (product) {
|
|
3842
|
+
var _product$metadata5;
|
|
3843
|
+
return (product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5[ownershipKey]) === true;
|
|
3358
3844
|
});
|
|
3359
3845
|
if (!(existingLines.length > 0)) {
|
|
3360
|
-
|
|
3846
|
+
_context35.next = 4;
|
|
3361
3847
|
break;
|
|
3362
3848
|
}
|
|
3363
|
-
|
|
3849
|
+
_context35.next = 4;
|
|
3364
3850
|
return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
|
|
3365
3851
|
case 4:
|
|
3366
3852
|
case "end":
|
|
3367
|
-
return
|
|
3853
|
+
return _context35.stop();
|
|
3368
3854
|
}
|
|
3369
|
-
},
|
|
3855
|
+
}, _callee35, this);
|
|
3370
3856
|
}));
|
|
3371
|
-
function removeExistingStagedLines(
|
|
3857
|
+
function removeExistingStagedLines(_x19) {
|
|
3372
3858
|
return _removeExistingStagedLines.apply(this, arguments);
|
|
3373
3859
|
}
|
|
3374
3860
|
return removeExistingStagedLines;
|
|
@@ -3376,25 +3862,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3376
3862
|
}, {
|
|
3377
3863
|
key: "stageProducts",
|
|
3378
3864
|
value: function () {
|
|
3379
|
-
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3865
|
+
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params, ownershipKey) {
|
|
3380
3866
|
var _params$rawProducts;
|
|
3381
|
-
var productIds, existingIds, missingIds, productIdSet, selectedProducts,
|
|
3382
|
-
return _regeneratorRuntime().wrap(function
|
|
3383
|
-
while (1) switch (
|
|
3867
|
+
var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i3, _arr3, sourceProduct, productInput;
|
|
3868
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3869
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3384
3870
|
case 0:
|
|
3385
3871
|
productIds = params.productIds || [];
|
|
3386
3872
|
if (productIds.length) {
|
|
3387
|
-
|
|
3873
|
+
_context36.next = 3;
|
|
3388
3874
|
break;
|
|
3389
3875
|
}
|
|
3390
|
-
return
|
|
3876
|
+
return _context36.abrupt("return", this.getTempOrder());
|
|
3391
3877
|
case 3:
|
|
3392
3878
|
if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
|
|
3393
|
-
|
|
3879
|
+
_context36.next = 7;
|
|
3394
3880
|
break;
|
|
3395
3881
|
}
|
|
3396
3882
|
this.unifiedProductCatalog = params.rawProducts;
|
|
3397
|
-
|
|
3883
|
+
_context36.next = 12;
|
|
3398
3884
|
break;
|
|
3399
3885
|
case 7:
|
|
3400
3886
|
existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
|
|
@@ -3405,15 +3891,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3405
3891
|
return !existingIds.has(String(id));
|
|
3406
3892
|
});
|
|
3407
3893
|
if (!(missingIds.length || params.productLoadParams)) {
|
|
3408
|
-
|
|
3894
|
+
_context36.next = 12;
|
|
3409
3895
|
break;
|
|
3410
3896
|
}
|
|
3411
|
-
|
|
3897
|
+
_context36.next = 12;
|
|
3412
3898
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
3413
3899
|
product_ids: productIds.map(Number).filter(Number.isFinite)
|
|
3414
3900
|
}));
|
|
3415
3901
|
case 12:
|
|
3416
|
-
|
|
3902
|
+
_context36.next = 14;
|
|
3417
3903
|
return this.removeExistingStagedLines(ownershipKey);
|
|
3418
3904
|
case 14:
|
|
3419
3905
|
productIdSet = new Set(productIds.map(function (id) {
|
|
@@ -3423,33 +3909,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3423
3909
|
var _product$id2;
|
|
3424
3910
|
return productIdSet.has(String((_product$id2 = product.id) !== null && _product$id2 !== void 0 ? _product$id2 : product.product_id));
|
|
3425
3911
|
});
|
|
3426
|
-
|
|
3912
|
+
_i3 = 0, _arr3 = selectedProducts;
|
|
3427
3913
|
case 17:
|
|
3428
|
-
if (!(
|
|
3429
|
-
|
|
3914
|
+
if (!(_i3 < _arr3.length)) {
|
|
3915
|
+
_context36.next = 26;
|
|
3430
3916
|
break;
|
|
3431
3917
|
}
|
|
3432
|
-
sourceProduct =
|
|
3918
|
+
sourceProduct = _arr3[_i3];
|
|
3433
3919
|
productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
|
|
3434
3920
|
if (!productInput) {
|
|
3435
|
-
|
|
3921
|
+
_context36.next = 23;
|
|
3436
3922
|
break;
|
|
3437
3923
|
}
|
|
3438
|
-
|
|
3924
|
+
_context36.next = 23;
|
|
3439
3925
|
return this.addProductToOrder(productInput);
|
|
3440
3926
|
case 23:
|
|
3441
|
-
|
|
3442
|
-
|
|
3927
|
+
_i3++;
|
|
3928
|
+
_context36.next = 17;
|
|
3443
3929
|
break;
|
|
3444
3930
|
case 26:
|
|
3445
|
-
return
|
|
3931
|
+
return _context36.abrupt("return", this.getTempOrder());
|
|
3446
3932
|
case 27:
|
|
3447
3933
|
case "end":
|
|
3448
|
-
return
|
|
3934
|
+
return _context36.stop();
|
|
3449
3935
|
}
|
|
3450
|
-
},
|
|
3936
|
+
}, _callee36, this);
|
|
3451
3937
|
}));
|
|
3452
|
-
function stageProducts(
|
|
3938
|
+
function stageProducts(_x20, _x21) {
|
|
3453
3939
|
return _stageProducts.apply(this, arguments);
|
|
3454
3940
|
}
|
|
3455
3941
|
return stageProducts;
|
|
@@ -3461,18 +3947,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3461
3947
|
}, {
|
|
3462
3948
|
key: "stageRetailProducts",
|
|
3463
3949
|
value: (function () {
|
|
3464
|
-
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3465
|
-
return _regeneratorRuntime().wrap(function
|
|
3466
|
-
while (1) switch (
|
|
3950
|
+
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
3951
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3952
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3467
3953
|
case 0:
|
|
3468
|
-
return
|
|
3954
|
+
return _context37.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
|
|
3469
3955
|
case 1:
|
|
3470
3956
|
case "end":
|
|
3471
|
-
return
|
|
3957
|
+
return _context37.stop();
|
|
3472
3958
|
}
|
|
3473
|
-
},
|
|
3959
|
+
}, _callee37, this);
|
|
3474
3960
|
}));
|
|
3475
|
-
function stageRetailProducts(
|
|
3961
|
+
function stageRetailProducts(_x22) {
|
|
3476
3962
|
return _stageRetailProducts.apply(this, arguments);
|
|
3477
3963
|
}
|
|
3478
3964
|
return stageRetailProducts;
|
|
@@ -3486,20 +3972,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3486
3972
|
}, {
|
|
3487
3973
|
key: "addRetailProduct",
|
|
3488
3974
|
value: (function () {
|
|
3489
|
-
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3490
|
-
var _params$quantity,
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3975
|
+
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
3976
|
+
var _params$quantity,
|
|
3977
|
+
_ref47,
|
|
3978
|
+
_params$productId,
|
|
3979
|
+
_params$product,
|
|
3980
|
+
_params$product2,
|
|
3981
|
+
_metadata2,
|
|
3982
|
+
_this10 = this;
|
|
3983
|
+
var quantity, productId, sourceProduct, products, orderProduct, order, meta, parentUid, scopeKey, service, identity, isCurrentOrder, guard;
|
|
3984
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3985
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3494
3986
|
case 0:
|
|
3495
3987
|
quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
|
|
3496
3988
|
if (!(!Number.isFinite(quantity) || quantity <= 0)) {
|
|
3497
|
-
|
|
3989
|
+
_context38.next = 3;
|
|
3498
3990
|
break;
|
|
3499
3991
|
}
|
|
3500
3992
|
throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
|
|
3501
3993
|
case 3:
|
|
3502
|
-
productId = (
|
|
3994
|
+
productId = (_ref47 = (_params$productId = params.productId) !== null && _params$productId !== void 0 ? _params$productId : (_params$product = params.product) === null || _params$product === void 0 ? void 0 : _params$product.id) !== null && _ref47 !== void 0 ? _ref47 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
|
|
3503
3995
|
sourceProduct = params.product;
|
|
3504
3996
|
if (!sourceProduct && productId !== undefined && productId !== null) {
|
|
3505
3997
|
sourceProduct = this.unifiedProductCatalog.find(function (product) {
|
|
@@ -3508,22 +4000,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3508
4000
|
});
|
|
3509
4001
|
}
|
|
3510
4002
|
if (!(!sourceProduct && productId !== undefined && productId !== null)) {
|
|
3511
|
-
|
|
4003
|
+
_context38.next = 11;
|
|
3512
4004
|
break;
|
|
3513
4005
|
}
|
|
3514
|
-
|
|
4006
|
+
_context38.next = 9;
|
|
3515
4007
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
3516
4008
|
product_ids: [Number(productId)].filter(Number.isFinite)
|
|
3517
4009
|
}));
|
|
3518
4010
|
case 9:
|
|
3519
|
-
products =
|
|
4011
|
+
products = _context38.sent;
|
|
3520
4012
|
sourceProduct = products.find(function (product) {
|
|
3521
4013
|
var _product$id4;
|
|
3522
4014
|
return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
|
|
3523
4015
|
});
|
|
3524
4016
|
case 11:
|
|
3525
4017
|
if (sourceProduct) {
|
|
3526
|
-
|
|
4018
|
+
_context38.next = 13;
|
|
3527
4019
|
break;
|
|
3528
4020
|
}
|
|
3529
4021
|
throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
|
|
@@ -3532,19 +4024,55 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3532
4024
|
quantity: quantity
|
|
3533
4025
|
}), 'unified_booking_sales_retail');
|
|
3534
4026
|
if (orderProduct) {
|
|
3535
|
-
|
|
4027
|
+
_context38.next = 16;
|
|
3536
4028
|
break;
|
|
3537
4029
|
}
|
|
3538
4030
|
throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
|
|
3539
4031
|
case 16:
|
|
3540
|
-
|
|
3541
|
-
|
|
4032
|
+
if (!(((_metadata2 = orderProduct.metadata) === null || _metadata2 === void 0 ? void 0 : _metadata2.venue_booking_role) === 'party_extra')) {
|
|
4033
|
+
_context38.next = 29;
|
|
4034
|
+
break;
|
|
4035
|
+
}
|
|
4036
|
+
order = this.getTempOrder();
|
|
4037
|
+
meta = orderProduct.metadata;
|
|
4038
|
+
parentUid = String(meta.venue_booking_parent_uid || '');
|
|
4039
|
+
scopeKey = String(meta.venue_booking_scope_key || '');
|
|
4040
|
+
service = String(meta.venue_booking_service_datetime || '');
|
|
4041
|
+
identity = [order === null || order === void 0 ? void 0 : order.order_id, order === null || order === void 0 ? void 0 : order.external_sale_number];
|
|
4042
|
+
isCurrentOrder = function isCurrentOrder() {
|
|
4043
|
+
return _this10.getTempOrder() === order && (order === null || order === void 0 ? void 0 : order.order_id) === identity[0] && (order === null || order === void 0 ? void 0 : order.external_sale_number) === identity[1];
|
|
4044
|
+
};
|
|
4045
|
+
guard = function guard() {
|
|
4046
|
+
var _params$availabilityC, _parent$metadata, _parent$metadata2, _parent$metadata3;
|
|
4047
|
+
(_params$availabilityC = params.availabilityCommitGuard) === null || _params$availabilityC === void 0 || _params$availabilityC.call(params);
|
|
4048
|
+
var parent = ((order === null || order === void 0 ? void 0 : order.products) || []).find(function (line) {
|
|
4049
|
+
return getProductLineUid(line) === parentUid;
|
|
4050
|
+
});
|
|
4051
|
+
var parentService = String((parent === null || parent === void 0 || (_parent$metadata = parent.metadata) === null || _parent$metadata === void 0 ? void 0 : _parent$metadata.venue_booking_service_datetime) || '');
|
|
4052
|
+
if (!isCurrentOrder() || !order || order.order_id || !parentUid || !scopeKey || (parent === null || parent === void 0 || (_parent$metadata2 = parent.metadata) === null || _parent$metadata2 === void 0 ? void 0 : _parent$metadata2.venue_booking_role) !== 'party_main' || (parent === null || parent === void 0 || (_parent$metadata3 = parent.metadata) === null || _parent$metadata3 === void 0 ? void 0 : _parent$metadata3.venue_booking_scope_key) !== scopeKey || !service || !parentService || !dayjs(service).isValid() || !dayjs(parentService).isValid() || dayjs(service).format('YYYY-MM-DD HH:mm:ss') !== dayjs(parentService).format('YYYY-MM-DD HH:mm:ss')) throw _this10.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'Party 主商品或服务时间已变化,请重新确认附加商品');
|
|
4053
|
+
};
|
|
4054
|
+
guard();
|
|
4055
|
+
delete orderProduct.unique_identification_number;
|
|
4056
|
+
delete orderProduct.metadata.unique_identification_number;
|
|
4057
|
+
return _context38.abrupt("return", this.addProductToOrder(orderProduct, undefined, {
|
|
4058
|
+
disableMerge: true,
|
|
4059
|
+
availabilityCommitGuard: guard,
|
|
4060
|
+
availabilityCommitTargetGuard: isCurrentOrder,
|
|
4061
|
+
salesNotes: params.salesNotes
|
|
4062
|
+
}));
|
|
4063
|
+
case 29:
|
|
4064
|
+
return _context38.abrupt("return", this.addProductToOrder(orderProduct, undefined, _objectSpread(_objectSpread({}, params.availabilityCommitGuard ? {
|
|
4065
|
+
availabilityCommitGuard: params.availabilityCommitGuard
|
|
4066
|
+
} : {}), params.salesNotes ? {
|
|
4067
|
+
salesNotes: params.salesNotes
|
|
4068
|
+
} : {})));
|
|
4069
|
+
case 30:
|
|
3542
4070
|
case "end":
|
|
3543
|
-
return
|
|
4071
|
+
return _context38.stop();
|
|
3544
4072
|
}
|
|
3545
|
-
},
|
|
4073
|
+
}, _callee38, this);
|
|
3546
4074
|
}));
|
|
3547
|
-
function addRetailProduct(
|
|
4075
|
+
function addRetailProduct(_x23) {
|
|
3548
4076
|
return _addRetailProduct.apply(this, arguments);
|
|
3549
4077
|
}
|
|
3550
4078
|
return addRetailProduct;
|
|
@@ -3608,8 +4136,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3608
4136
|
params: params
|
|
3609
4137
|
});
|
|
3610
4138
|
}
|
|
3611
|
-
if (!hasProductAnchor && !params.catalogScope) {
|
|
3612
|
-
throw new AvailabilityError('MISSING_CATALOG_SCOPE', '缺少 productIds 时必须提供 catalogScope', {
|
|
4139
|
+
if (!hasProductAnchor && !params.catalogScope && !Array.isArray(params.rawProducts)) {
|
|
4140
|
+
throw new AvailabilityError('MISSING_CATALOG_SCOPE', '缺少 productIds 时必须提供 catalogScope 或 rawProducts', {
|
|
3613
4141
|
params: params
|
|
3614
4142
|
});
|
|
3615
4143
|
}
|
|
@@ -3644,7 +4172,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3644
4172
|
}, {
|
|
3645
4173
|
key: "buildAvailabilityOperatingHoursSnapshot",
|
|
3646
4174
|
value: function buildAvailabilityOperatingHoursSnapshot(params) {
|
|
3647
|
-
var
|
|
4175
|
+
var _this11 = this;
|
|
3648
4176
|
var descriptor = params.prepare._availabilityOperatingHours || {
|
|
3649
4177
|
source: params.prepare.businessHours ? 'prepare_business_hours' : 'default_business_hours',
|
|
3650
4178
|
scheduleIds: []
|
|
@@ -3654,7 +4182,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3654
4182
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3655
4183
|
startAt: "".concat(date, "T").concat(params.businessHours.startTime, ":00"),
|
|
3656
4184
|
endAt: "".concat(date, "T").concat(params.businessHours.endTime, ":00"),
|
|
3657
|
-
fixedOffsetMinutes:
|
|
4185
|
+
fixedOffsetMinutes: _this11.getAvailabilityRuntimeOffsetMinutes(),
|
|
3658
4186
|
rollOverEnd: true
|
|
3659
4187
|
});
|
|
3660
4188
|
return range ? [{
|
|
@@ -3689,7 +4217,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3689
4217
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3690
4218
|
startAt: slot.start_at,
|
|
3691
4219
|
endAt: slot.end_at,
|
|
3692
|
-
fixedOffsetMinutes:
|
|
4220
|
+
fixedOffsetMinutes: _this11.getAvailabilityRuntimeOffsetMinutes(),
|
|
3693
4221
|
rollOverEnd: true
|
|
3694
4222
|
});
|
|
3695
4223
|
return range ? [{
|
|
@@ -3705,7 +4233,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3705
4233
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3706
4234
|
startAt: slot.start_at,
|
|
3707
4235
|
endAt: slot.end_at,
|
|
3708
|
-
fixedOffsetMinutes:
|
|
4236
|
+
fixedOffsetMinutes: _this11.getAvailabilityRuntimeOffsetMinutes(),
|
|
3709
4237
|
rollOverEnd: true
|
|
3710
4238
|
});
|
|
3711
4239
|
return range ? [{
|
|
@@ -3732,53 +4260,58 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3732
4260
|
}, {
|
|
3733
4261
|
key: "loadAvailabilityProducts",
|
|
3734
4262
|
value: function () {
|
|
3735
|
-
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3736
|
-
var
|
|
3737
|
-
_prepare$
|
|
3738
|
-
|
|
4263
|
+
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
4264
|
+
var _this12 = this,
|
|
4265
|
+
_prepare$catalogScope3,
|
|
4266
|
+
_prepare$catalogScope4,
|
|
3739
4267
|
_prepare$resourceIds;
|
|
3740
|
-
var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
|
|
3741
|
-
return _regeneratorRuntime().wrap(function
|
|
3742
|
-
while (1) switch (
|
|
4268
|
+
var prepare, dateRange, explicitProductIds, publishCatalog, loadProducts, rawProducts, _prepare$catalogScope2, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
|
|
4269
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4270
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3743
4271
|
case 0:
|
|
3744
4272
|
prepare = params.prepare, dateRange = params.dateRange;
|
|
3745
4273
|
explicitProductIds = prepare.productIds || [];
|
|
4274
|
+
publishCatalog = prepare.publishCatalog !== false;
|
|
4275
|
+
loadProducts = function loadProducts(query) {
|
|
4276
|
+
var _prepare$catalogScope;
|
|
4277
|
+
return publishCatalog ? _this12.loadProducts(query) : ((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'productList' ? _this12.queryCatalogSnapshot(query) : _this12.loadCatalogProducts(query);
|
|
4278
|
+
};
|
|
3746
4279
|
rawProducts = [];
|
|
3747
4280
|
if (!Array.isArray(prepare.rawProducts)) {
|
|
3748
|
-
|
|
4281
|
+
_context39.next = 10;
|
|
3749
4282
|
break;
|
|
3750
4283
|
}
|
|
3751
4284
|
rawProducts = prepare.rawProducts;
|
|
3752
|
-
this.unifiedProductCatalog = _toConsumableArray(rawProducts);
|
|
3753
|
-
|
|
4285
|
+
if (publishCatalog) this.unifiedProductCatalog = _toConsumableArray(rawProducts);
|
|
4286
|
+
_context39.next = 36;
|
|
3754
4287
|
break;
|
|
3755
|
-
case
|
|
4288
|
+
case 10:
|
|
3756
4289
|
if (!(explicitProductIds.length > 0)) {
|
|
3757
|
-
|
|
4290
|
+
_context39.next = 16;
|
|
3758
4291
|
break;
|
|
3759
4292
|
}
|
|
3760
|
-
|
|
3761
|
-
return
|
|
4293
|
+
_context39.next = 13;
|
|
4294
|
+
return loadProducts(_objectSpread(_objectSpread({}, !publishCatalog && ((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList' ? prepare.catalogScope.params : {}), {}, {
|
|
3762
4295
|
product_ids: explicitProductIds,
|
|
3763
4296
|
schedule_date: dateRange.startDate
|
|
3764
|
-
});
|
|
3765
|
-
case
|
|
3766
|
-
rawProducts =
|
|
3767
|
-
|
|
4297
|
+
}));
|
|
4298
|
+
case 13:
|
|
4299
|
+
rawProducts = _context39.sent;
|
|
4300
|
+
_context39.next = 36;
|
|
3768
4301
|
break;
|
|
3769
|
-
case
|
|
3770
|
-
if (!(((_prepare$
|
|
3771
|
-
|
|
4302
|
+
case 16:
|
|
4303
|
+
if (!(((_prepare$catalogScope3 = prepare.catalogScope) === null || _prepare$catalogScope3 === void 0 ? void 0 : _prepare$catalogScope3.type) === 'schedule')) {
|
|
4304
|
+
_context39.next = 32;
|
|
3772
4305
|
break;
|
|
3773
4306
|
}
|
|
3774
|
-
|
|
4307
|
+
_context39.next = 19;
|
|
3775
4308
|
return this.loadScheduleAvailableDate({
|
|
3776
4309
|
startDate: dateRange.startDate,
|
|
3777
4310
|
endDate: dateRange.endDate,
|
|
3778
4311
|
custom_page_id: Number(prepare.catalogScope.customPageId) || undefined,
|
|
3779
4312
|
channel: prepare.catalogScope.channel
|
|
3780
4313
|
});
|
|
3781
|
-
case
|
|
4314
|
+
case 19:
|
|
3782
4315
|
dateSet = new Set(dateRangeDays(dateRange));
|
|
3783
4316
|
scheduleProductIds = (((_this$store$schedule$6 = (_this$store$schedule6 = this.store.schedule).getAvailabilityScheduleDateList) === null || _this$store$schedule$6 === void 0 ? void 0 : _this$store$schedule$6.call(_this$store$schedule6)) || []).filter(function (item) {
|
|
3784
4317
|
return dateSet.has(item.date);
|
|
@@ -3787,44 +4320,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3787
4320
|
});
|
|
3788
4321
|
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)) || [])));
|
|
3789
4322
|
if (!(productIds.length > 0)) {
|
|
3790
|
-
|
|
4323
|
+
_context39.next = 29;
|
|
3791
4324
|
break;
|
|
3792
4325
|
}
|
|
3793
4326
|
assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
|
|
3794
|
-
|
|
3795
|
-
return
|
|
4327
|
+
_context39.next = 26;
|
|
4328
|
+
return loadProducts({
|
|
3796
4329
|
product_ids: productIds,
|
|
3797
4330
|
schedule_date: dateRange.startDate
|
|
3798
4331
|
});
|
|
3799
|
-
case
|
|
3800
|
-
rawProducts =
|
|
3801
|
-
|
|
3802
|
-
break;
|
|
3803
|
-
case 27:
|
|
3804
|
-
this.unifiedProductCatalog = [];
|
|
3805
|
-
case 28:
|
|
3806
|
-
_context33.next = 34;
|
|
4332
|
+
case 26:
|
|
4333
|
+
rawProducts = _context39.sent;
|
|
4334
|
+
_context39.next = 30;
|
|
3807
4335
|
break;
|
|
4336
|
+
case 29:
|
|
4337
|
+
if (publishCatalog) this.unifiedProductCatalog = [];
|
|
3808
4338
|
case 30:
|
|
3809
|
-
|
|
3810
|
-
|
|
4339
|
+
_context39.next = 36;
|
|
4340
|
+
break;
|
|
4341
|
+
case 32:
|
|
4342
|
+
if (!(((_prepare$catalogScope4 = prepare.catalogScope) === null || _prepare$catalogScope4 === void 0 ? void 0 : _prepare$catalogScope4.type) === 'productList')) {
|
|
4343
|
+
_context39.next = 36;
|
|
3811
4344
|
break;
|
|
3812
4345
|
}
|
|
3813
|
-
|
|
3814
|
-
return
|
|
4346
|
+
_context39.next = 35;
|
|
4347
|
+
return loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
|
|
3815
4348
|
schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
|
|
3816
4349
|
}));
|
|
3817
|
-
case
|
|
3818
|
-
rawProducts =
|
|
3819
|
-
case
|
|
4350
|
+
case 35:
|
|
4351
|
+
rawProducts = _context39.sent;
|
|
4352
|
+
case 36:
|
|
3820
4353
|
normalized = rawProducts.map(function (product) {
|
|
3821
|
-
return normalizeProductForAvailability(product, params.scheduleList,
|
|
4354
|
+
return normalizeProductForAvailability(product, params.scheduleList, _this12.getAvailabilityRuntimeOffsetMinutes());
|
|
3822
4355
|
});
|
|
3823
4356
|
if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
|
|
3824
|
-
|
|
4357
|
+
_context39.next = 39;
|
|
3825
4358
|
break;
|
|
3826
4359
|
}
|
|
3827
|
-
return
|
|
4360
|
+
return _context39.abrupt("return", normalized.filter(function (product) {
|
|
3828
4361
|
var _product$requirementG2;
|
|
3829
4362
|
return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
|
|
3830
4363
|
var _group$resourceIds3;
|
|
@@ -3835,18 +4368,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3835
4368
|
});
|
|
3836
4369
|
});
|
|
3837
4370
|
}));
|
|
3838
|
-
case
|
|
4371
|
+
case 39:
|
|
3839
4372
|
productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
|
|
3840
|
-
return
|
|
4373
|
+
return _context39.abrupt("return", productIdSet ? normalized.filter(function (product) {
|
|
3841
4374
|
return productIdSet.has(String(product.id));
|
|
3842
4375
|
}) : normalized);
|
|
3843
|
-
case
|
|
4376
|
+
case 41:
|
|
3844
4377
|
case "end":
|
|
3845
|
-
return
|
|
4378
|
+
return _context39.stop();
|
|
3846
4379
|
}
|
|
3847
|
-
},
|
|
4380
|
+
}, _callee39, this);
|
|
3848
4381
|
}));
|
|
3849
|
-
function loadAvailabilityProducts(
|
|
4382
|
+
function loadAvailabilityProducts(_x24) {
|
|
3850
4383
|
return _loadAvailabilityProducts.apply(this, arguments);
|
|
3851
4384
|
}
|
|
3852
4385
|
return loadAvailabilityProducts;
|
|
@@ -3859,12 +4392,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3859
4392
|
}, {
|
|
3860
4393
|
key: "fetchAvailabilityResourcesV2",
|
|
3861
4394
|
value: (function () {
|
|
3862
|
-
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4395
|
+
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
3863
4396
|
var response, data;
|
|
3864
|
-
return _regeneratorRuntime().wrap(function
|
|
3865
|
-
while (1) switch (
|
|
4397
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4398
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3866
4399
|
case 0:
|
|
3867
|
-
|
|
4400
|
+
_context40.next = 2;
|
|
3868
4401
|
return this.request.get('/schedule/resource/list/v2', {
|
|
3869
4402
|
start_date: params.dateRange.startDate,
|
|
3870
4403
|
end_date: params.dateRange.endDate,
|
|
@@ -3874,28 +4407,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3874
4407
|
useCache: false
|
|
3875
4408
|
});
|
|
3876
4409
|
case 2:
|
|
3877
|
-
response =
|
|
4410
|
+
response = _context40.sent;
|
|
3878
4411
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
3879
4412
|
if (!Array.isArray(data)) {
|
|
3880
|
-
|
|
4413
|
+
_context40.next = 6;
|
|
3881
4414
|
break;
|
|
3882
4415
|
}
|
|
3883
|
-
return
|
|
4416
|
+
return _context40.abrupt("return", data);
|
|
3884
4417
|
case 6:
|
|
3885
4418
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
|
|
3886
|
-
|
|
4419
|
+
_context40.next = 8;
|
|
3887
4420
|
break;
|
|
3888
4421
|
}
|
|
3889
|
-
return
|
|
4422
|
+
return _context40.abrupt("return", data.list);
|
|
3890
4423
|
case 8:
|
|
3891
|
-
return
|
|
4424
|
+
return _context40.abrupt("return", []);
|
|
3892
4425
|
case 9:
|
|
3893
4426
|
case "end":
|
|
3894
|
-
return
|
|
4427
|
+
return _context40.stop();
|
|
3895
4428
|
}
|
|
3896
|
-
},
|
|
4429
|
+
}, _callee40, this);
|
|
3897
4430
|
}));
|
|
3898
|
-
function fetchAvailabilityResourcesV2(
|
|
4431
|
+
function fetchAvailabilityResourcesV2(_x25) {
|
|
3899
4432
|
return _fetchAvailabilityResourcesV.apply(this, arguments);
|
|
3900
4433
|
}
|
|
3901
4434
|
return fetchAvailabilityResourcesV2;
|
|
@@ -3903,17 +4436,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3903
4436
|
}, {
|
|
3904
4437
|
key: "fetchAndPublishAvailabilityResourcesV2",
|
|
3905
4438
|
value: function () {
|
|
3906
|
-
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4439
|
+
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
3907
4440
|
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
|
|
3908
|
-
return _regeneratorRuntime().wrap(function
|
|
3909
|
-
while (1) switch (
|
|
4441
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4442
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3910
4443
|
case 0:
|
|
3911
4444
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
3912
4445
|
if (!(normalizedResourceIds.length === 0)) {
|
|
3913
|
-
|
|
4446
|
+
_context41.next = 3;
|
|
3914
4447
|
break;
|
|
3915
4448
|
}
|
|
3916
|
-
return
|
|
4449
|
+
return _context41.abrupt("return", []);
|
|
3917
4450
|
case 3:
|
|
3918
4451
|
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
3919
4452
|
cacheParams = {
|
|
@@ -3923,7 +4456,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3923
4456
|
};
|
|
3924
4457
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
3925
4458
|
if (!cachedRawResources) {
|
|
3926
|
-
|
|
4459
|
+
_context41.next = 9;
|
|
3927
4460
|
break;
|
|
3928
4461
|
}
|
|
3929
4462
|
if (params.useCacheOnHit) {
|
|
@@ -3935,23 +4468,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3935
4468
|
console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
|
|
3936
4469
|
});
|
|
3937
4470
|
}
|
|
3938
|
-
return
|
|
4471
|
+
return _context41.abrupt("return", cachedRawResources);
|
|
3939
4472
|
case 9:
|
|
3940
|
-
|
|
4473
|
+
_context41.next = 11;
|
|
3941
4474
|
return this.refreshAvailabilityRemoteResourceQuery({
|
|
3942
4475
|
timezone: params.timezone,
|
|
3943
4476
|
dateRange: params.dateRange,
|
|
3944
4477
|
resourceIds: normalizedResourceIds
|
|
3945
4478
|
});
|
|
3946
4479
|
case 11:
|
|
3947
|
-
return
|
|
4480
|
+
return _context41.abrupt("return", _context41.sent);
|
|
3948
4481
|
case 12:
|
|
3949
4482
|
case "end":
|
|
3950
|
-
return
|
|
4483
|
+
return _context41.stop();
|
|
3951
4484
|
}
|
|
3952
|
-
},
|
|
4485
|
+
}, _callee41, this);
|
|
3953
4486
|
}));
|
|
3954
|
-
function fetchAndPublishAvailabilityResourcesV2(
|
|
4487
|
+
function fetchAndPublishAvailabilityResourcesV2(_x26) {
|
|
3955
4488
|
return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
|
|
3956
4489
|
}
|
|
3957
4490
|
return fetchAndPublishAvailabilityResourcesV2;
|
|
@@ -3959,17 +4492,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3959
4492
|
}, {
|
|
3960
4493
|
key: "refreshAvailabilityRemoteResourceQuery",
|
|
3961
4494
|
value: function () {
|
|
3962
|
-
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4495
|
+
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
|
|
3963
4496
|
var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
|
|
3964
|
-
return _regeneratorRuntime().wrap(function
|
|
3965
|
-
while (1) switch (
|
|
4497
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4498
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3966
4499
|
case 0:
|
|
3967
4500
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
3968
4501
|
if (!(normalizedResourceIds.length === 0)) {
|
|
3969
|
-
|
|
4502
|
+
_context42.next = 3;
|
|
3970
4503
|
break;
|
|
3971
4504
|
}
|
|
3972
|
-
return
|
|
4505
|
+
return _context42.abrupt("return", []);
|
|
3973
4506
|
case 3:
|
|
3974
4507
|
queryKey = this.buildAvailabilityRemoteResourceQueryKey({
|
|
3975
4508
|
timezone: params.timezone,
|
|
@@ -3979,13 +4512,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3979
4512
|
epoch = this.availabilityRemoteResourceEpoch;
|
|
3980
4513
|
existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
3981
4514
|
if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
|
|
3982
|
-
|
|
4515
|
+
_context42.next = 10;
|
|
3983
4516
|
break;
|
|
3984
4517
|
}
|
|
3985
|
-
|
|
4518
|
+
_context42.next = 9;
|
|
3986
4519
|
return existing.promise;
|
|
3987
4520
|
case 9:
|
|
3988
|
-
return
|
|
4521
|
+
return _context42.abrupt("return", _context42.sent);
|
|
3989
4522
|
case 10:
|
|
3990
4523
|
this.availabilityRemoteResourceQuerySequence += 1;
|
|
3991
4524
|
writeVersion = this.availabilityRemoteResourceQuerySequence;
|
|
@@ -3997,11 +4530,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3997
4530
|
epoch: epoch,
|
|
3998
4531
|
promise: promise
|
|
3999
4532
|
});
|
|
4000
|
-
|
|
4001
|
-
|
|
4533
|
+
_context42.prev = 14;
|
|
4534
|
+
_context42.next = 17;
|
|
4002
4535
|
return promise;
|
|
4003
4536
|
case 17:
|
|
4004
|
-
rawResources =
|
|
4537
|
+
rawResources = _context42.sent;
|
|
4005
4538
|
if (epoch === this.availabilityRemoteResourceEpoch) {
|
|
4006
4539
|
this.availabilityRemoteOccupancyCache.publish({
|
|
4007
4540
|
scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
|
|
@@ -4012,21 +4545,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4012
4545
|
version: writeVersion
|
|
4013
4546
|
});
|
|
4014
4547
|
}
|
|
4015
|
-
return
|
|
4548
|
+
return _context42.abrupt("return", rawResources);
|
|
4016
4549
|
case 20:
|
|
4017
|
-
|
|
4550
|
+
_context42.prev = 20;
|
|
4018
4551
|
current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4019
4552
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4020
4553
|
this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
|
|
4021
4554
|
}
|
|
4022
|
-
return
|
|
4555
|
+
return _context42.finish(20);
|
|
4023
4556
|
case 24:
|
|
4024
4557
|
case "end":
|
|
4025
|
-
return
|
|
4558
|
+
return _context42.stop();
|
|
4026
4559
|
}
|
|
4027
|
-
},
|
|
4560
|
+
}, _callee42, this, [[14,, 20, 24]]);
|
|
4028
4561
|
}));
|
|
4029
|
-
function refreshAvailabilityRemoteResourceQuery(
|
|
4562
|
+
function refreshAvailabilityRemoteResourceQuery(_x27) {
|
|
4030
4563
|
return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
|
|
4031
4564
|
}
|
|
4032
4565
|
return refreshAvailabilityRemoteResourceQuery;
|
|
@@ -4034,26 +4567,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4034
4567
|
}, {
|
|
4035
4568
|
key: "loadAvailabilityResources",
|
|
4036
4569
|
value: function () {
|
|
4037
|
-
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4038
|
-
var resourceIds, cachedRawResources, rawResources;
|
|
4039
|
-
return _regeneratorRuntime().wrap(function
|
|
4040
|
-
while (1) switch (
|
|
4570
|
+
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
4571
|
+
var resourceIds, cachedRawResources, remoteQuery, rawResources;
|
|
4572
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4573
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4041
4574
|
case 0:
|
|
4042
4575
|
resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
|
|
4043
4576
|
if (!(resourceIds.length === 0)) {
|
|
4044
|
-
|
|
4577
|
+
_context43.next = 3;
|
|
4045
4578
|
break;
|
|
4046
4579
|
}
|
|
4047
|
-
return
|
|
4580
|
+
return _context43.abrupt("return", {
|
|
4048
4581
|
resources: [],
|
|
4049
4582
|
resourceOccupancies: []
|
|
4050
4583
|
});
|
|
4051
4584
|
case 3:
|
|
4052
|
-
if (!Array.isArray(params.rawResources)) {
|
|
4053
|
-
|
|
4585
|
+
if (!(Array.isArray(params.rawResources) && params.fetchPolicy !== 'refresh')) {
|
|
4586
|
+
_context43.next = 5;
|
|
4054
4587
|
break;
|
|
4055
4588
|
}
|
|
4056
|
-
return
|
|
4589
|
+
return _context43.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4057
4590
|
rawResources: params.rawResources,
|
|
4058
4591
|
scheduleList: params.scheduleList,
|
|
4059
4592
|
dateRange: params.dateRange,
|
|
@@ -4061,7 +4594,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4061
4594
|
}));
|
|
4062
4595
|
case 5:
|
|
4063
4596
|
if (!(params.fetchPolicy === 'cache_only')) {
|
|
4064
|
-
|
|
4597
|
+
_context43.next = 10;
|
|
4065
4598
|
break;
|
|
4066
4599
|
}
|
|
4067
4600
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read({
|
|
@@ -4070,43 +4603,58 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4070
4603
|
dateRange: params.dateRange
|
|
4071
4604
|
});
|
|
4072
4605
|
if (!cachedRawResources) {
|
|
4073
|
-
|
|
4606
|
+
_context43.next = 9;
|
|
4074
4607
|
break;
|
|
4075
4608
|
}
|
|
4076
|
-
return
|
|
4609
|
+
return _context43.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4077
4610
|
rawResources: cachedRawResources,
|
|
4078
4611
|
scheduleList: params.scheduleList,
|
|
4079
4612
|
dateRange: params.dateRange,
|
|
4080
4613
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4081
4614
|
}));
|
|
4082
4615
|
case 9:
|
|
4083
|
-
return
|
|
4616
|
+
return _context43.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
|
|
4084
4617
|
resources: [],
|
|
4085
4618
|
resourceOccupancies: []
|
|
4086
4619
|
});
|
|
4087
4620
|
case 10:
|
|
4088
|
-
|
|
4089
|
-
return this.fetchAndPublishAvailabilityResourcesV2({
|
|
4621
|
+
remoteQuery = {
|
|
4090
4622
|
timezone: params.timezone,
|
|
4091
4623
|
dateRange: params.dateRange,
|
|
4092
|
-
resourceIds: resourceIds
|
|
4624
|
+
resourceIds: resourceIds
|
|
4625
|
+
};
|
|
4626
|
+
if (!(params.fetchPolicy === 'refresh')) {
|
|
4627
|
+
_context43.next = 17;
|
|
4628
|
+
break;
|
|
4629
|
+
}
|
|
4630
|
+
_context43.next = 14;
|
|
4631
|
+
return this.refreshAvailabilityRemoteResourceQuery(remoteQuery);
|
|
4632
|
+
case 14:
|
|
4633
|
+
_context43.t0 = _context43.sent;
|
|
4634
|
+
_context43.next = 20;
|
|
4635
|
+
break;
|
|
4636
|
+
case 17:
|
|
4637
|
+
_context43.next = 19;
|
|
4638
|
+
return this.fetchAndPublishAvailabilityResourcesV2(_objectSpread(_objectSpread({}, remoteQuery), {}, {
|
|
4093
4639
|
useCacheOnHit: true
|
|
4094
|
-
});
|
|
4095
|
-
case
|
|
4096
|
-
|
|
4097
|
-
|
|
4640
|
+
}));
|
|
4641
|
+
case 19:
|
|
4642
|
+
_context43.t0 = _context43.sent;
|
|
4643
|
+
case 20:
|
|
4644
|
+
rawResources = _context43.t0;
|
|
4645
|
+
return _context43.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4098
4646
|
rawResources: rawResources,
|
|
4099
4647
|
scheduleList: params.scheduleList,
|
|
4100
4648
|
dateRange: params.dateRange,
|
|
4101
4649
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4102
4650
|
}));
|
|
4103
|
-
case
|
|
4651
|
+
case 22:
|
|
4104
4652
|
case "end":
|
|
4105
|
-
return
|
|
4653
|
+
return _context43.stop();
|
|
4106
4654
|
}
|
|
4107
|
-
},
|
|
4655
|
+
}, _callee43, this);
|
|
4108
4656
|
}));
|
|
4109
|
-
function loadAvailabilityResources(
|
|
4657
|
+
function loadAvailabilityResources(_x28) {
|
|
4110
4658
|
return _loadAvailabilityResources.apply(this, arguments);
|
|
4111
4659
|
}
|
|
4112
4660
|
return loadAvailabilityResources;
|
|
@@ -4126,7 +4674,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4126
4674
|
var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
|
|
4127
4675
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
4128
4676
|
productLineUids.forEach(function (requestedUid) {
|
|
4129
|
-
var
|
|
4677
|
+
var _ref48, _product$booking_uid2, _product$metadata6;
|
|
4130
4678
|
var product = products.find(function (line) {
|
|
4131
4679
|
return getProductLineUid(line) === String(requestedUid);
|
|
4132
4680
|
});
|
|
@@ -4136,7 +4684,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4136
4684
|
});
|
|
4137
4685
|
}
|
|
4138
4686
|
var productUid = getProductLineUid(product);
|
|
4139
|
-
var linkedBookingUid = String((
|
|
4687
|
+
var linkedBookingUid = String((_ref48 = (_product$booking_uid2 = product.booking_uid) !== null && _product$booking_uid2 !== void 0 ? _product$booking_uid2 : (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid) !== null && _ref48 !== void 0 ? _ref48 : '');
|
|
4140
4688
|
var linkedBookings = bookings.filter(function (booking) {
|
|
4141
4689
|
var _booking$product_uid;
|
|
4142
4690
|
return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
|
|
@@ -4179,24 +4727,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4179
4727
|
}, {
|
|
4180
4728
|
key: "collectCartResourceOccupancies",
|
|
4181
4729
|
value: function collectCartResourceOccupancies(tempOrder, exclusions) {
|
|
4182
|
-
var
|
|
4730
|
+
var _this13 = this;
|
|
4183
4731
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
4184
4732
|
return bookings.flatMap(function (booking) {
|
|
4185
|
-
var
|
|
4733
|
+
var _ref49, _booking$product_uid2, _booking$metadata2;
|
|
4186
4734
|
var bookingUid = getBookingUid(booking);
|
|
4187
|
-
var productUid = String((
|
|
4735
|
+
var productUid = String((_ref49 = (_booking$product_uid2 = booking.product_uid) !== null && _booking$product_uid2 !== void 0 ? _booking$product_uid2 : (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid) !== null && _ref49 !== void 0 ? _ref49 : '');
|
|
4188
4736
|
var scheduleEventId = toNumberId(booking.schedule_event_id);
|
|
4189
4737
|
var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
|
|
4190
4738
|
var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
|
|
4191
4739
|
var resources = Array.isArray(booking.resources) ? booking.resources : [];
|
|
4192
4740
|
return resources.flatMap(function (resource) {
|
|
4193
|
-
var
|
|
4194
|
-
var resourceId = (
|
|
4741
|
+
var _ref50, _resource$resource_id, _ref51, _resource$capacity;
|
|
4742
|
+
var resourceId = (_ref50 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref50 !== void 0 ? _ref50 : resource.id;
|
|
4195
4743
|
if (resourceId == null || !startAt || !endAt) return [];
|
|
4196
4744
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4197
4745
|
startAt: startAt,
|
|
4198
4746
|
endAt: endAt,
|
|
4199
|
-
fixedOffsetMinutes:
|
|
4747
|
+
fixedOffsetMinutes: _this13.getAvailabilityRuntimeOffsetMinutes(),
|
|
4200
4748
|
rollOverEnd: false
|
|
4201
4749
|
});
|
|
4202
4750
|
if (!range) return [];
|
|
@@ -4204,7 +4752,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4204
4752
|
resourceId: resourceId,
|
|
4205
4753
|
startAt: range.startAt,
|
|
4206
4754
|
endAt: range.endAt,
|
|
4207
|
-
pax: Math.max(1, Number((
|
|
4755
|
+
pax: Math.max(1, Number((_ref51 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref51 !== void 0 ? _ref51 : 1) || 1),
|
|
4208
4756
|
source: 'cart',
|
|
4209
4757
|
scheduleEventId: scheduleEventId,
|
|
4210
4758
|
bookingUid: bookingUid || undefined,
|
|
@@ -4214,7 +4762,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4214
4762
|
resource: resource
|
|
4215
4763
|
}
|
|
4216
4764
|
};
|
|
4217
|
-
return
|
|
4765
|
+
return _this13.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
|
|
4218
4766
|
});
|
|
4219
4767
|
});
|
|
4220
4768
|
}
|
|
@@ -4281,16 +4829,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4281
4829
|
}, {
|
|
4282
4830
|
key: "assertContextualQueryFreshness",
|
|
4283
4831
|
value: function assertContextualQueryFreshness(context, request) {
|
|
4284
|
-
var
|
|
4832
|
+
var _this14 = this;
|
|
4285
4833
|
if (request.target === 'time') {
|
|
4286
4834
|
request.candidates.forEach(function (candidate) {
|
|
4287
|
-
|
|
4835
|
+
_this14.assertAvailabilityCandidateFreshness(context, candidate);
|
|
4288
4836
|
});
|
|
4289
4837
|
return;
|
|
4290
4838
|
}
|
|
4291
4839
|
if (request.target === 'resource') {
|
|
4292
4840
|
request.selectedRanges.forEach(function (candidate) {
|
|
4293
|
-
|
|
4841
|
+
_this14.assertAvailabilityCandidateFreshness(context, candidate);
|
|
4294
4842
|
});
|
|
4295
4843
|
}
|
|
4296
4844
|
}
|
|
@@ -4337,8 +4885,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4337
4885
|
}, {
|
|
4338
4886
|
key: "buildAvailabilityProjectionSnapshot",
|
|
4339
4887
|
value: function () {
|
|
4340
|
-
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4341
|
-
var
|
|
4888
|
+
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
4889
|
+
var _this15 = this;
|
|
4342
4890
|
var options,
|
|
4343
4891
|
normalizedPrepareParams,
|
|
4344
4892
|
timezoneLabel,
|
|
@@ -4359,11 +4907,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4359
4907
|
durationCandidateAnchorAt,
|
|
4360
4908
|
orderRevision,
|
|
4361
4909
|
projection,
|
|
4362
|
-
|
|
4363
|
-
return _regeneratorRuntime().wrap(function
|
|
4364
|
-
while (1) switch (
|
|
4910
|
+
_args44 = arguments;
|
|
4911
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4912
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4365
4913
|
case 0:
|
|
4366
|
-
options =
|
|
4914
|
+
options = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {};
|
|
4367
4915
|
normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
4368
4916
|
timezoneLabel = String(normalizedPrepareParams.timezone);
|
|
4369
4917
|
dateRange = normalizedPrepareParams.dateRange;
|
|
@@ -4377,15 +4925,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4377
4925
|
scheduleList: scheduleList,
|
|
4378
4926
|
businessHours: businessHours
|
|
4379
4927
|
});
|
|
4380
|
-
|
|
4928
|
+
_context44.next = 11;
|
|
4381
4929
|
return this.loadAvailabilityProducts({
|
|
4382
4930
|
prepare: normalizedPrepareParams,
|
|
4383
4931
|
dateRange: dateRange,
|
|
4384
4932
|
scheduleList: scheduleList
|
|
4385
4933
|
});
|
|
4386
4934
|
case 11:
|
|
4387
|
-
products =
|
|
4388
|
-
|
|
4935
|
+
products = _context44.sent;
|
|
4936
|
+
_context44.next = 14;
|
|
4389
4937
|
return this.loadAvailabilityResources({
|
|
4390
4938
|
timezone: timezoneLabel,
|
|
4391
4939
|
dateRange: dateRange,
|
|
@@ -4393,18 +4941,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4393
4941
|
products: products,
|
|
4394
4942
|
rawResources: normalizedPrepareParams.rawResources,
|
|
4395
4943
|
scheduleList: scheduleList,
|
|
4396
|
-
|
|
4944
|
+
// An explicit internal policy (notably commit's cache_only) remains authoritative.
|
|
4945
|
+
fetchPolicy: options.resourceFetchPolicy || (normalizedPrepareParams.refreshOccupancies ? 'refresh' : 'default'),
|
|
4397
4946
|
fallbackResources: options.fallbackResources
|
|
4398
4947
|
});
|
|
4399
4948
|
case 14:
|
|
4400
|
-
loadedResources =
|
|
4949
|
+
loadedResources = _context44.sent;
|
|
4401
4950
|
tempOrder = this.getTempOrder();
|
|
4402
4951
|
exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
|
|
4403
4952
|
injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
|
|
4404
4953
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4405
4954
|
startAt: occupancy.startAt,
|
|
4406
4955
|
endAt: occupancy.endAt,
|
|
4407
|
-
fixedOffsetMinutes:
|
|
4956
|
+
fixedOffsetMinutes: _this15.getAvailabilityRuntimeOffsetMinutes(),
|
|
4408
4957
|
rollOverEnd: false
|
|
4409
4958
|
});
|
|
4410
4959
|
if (!range) return [];
|
|
@@ -4414,7 +4963,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4414
4963
|
})];
|
|
4415
4964
|
});
|
|
4416
4965
|
remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
|
|
4417
|
-
return !
|
|
4966
|
+
return !_this15.occupancyIsExcluded(occupancy, exclusions);
|
|
4418
4967
|
});
|
|
4419
4968
|
cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
|
|
4420
4969
|
preparedAt = this.getAvailabilityRuntimeDateTime();
|
|
@@ -4443,18 +4992,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4443
4992
|
prepareParams: normalizedPrepareParams,
|
|
4444
4993
|
durationCandidateAnchorAt: durationCandidateAnchorAt
|
|
4445
4994
|
});
|
|
4446
|
-
return
|
|
4995
|
+
return _context44.abrupt("return", {
|
|
4447
4996
|
projection: projection,
|
|
4448
4997
|
prepareParams: normalizedPrepareParams,
|
|
4449
4998
|
orderRevision: orderRevision
|
|
4450
4999
|
});
|
|
4451
5000
|
case 26:
|
|
4452
5001
|
case "end":
|
|
4453
|
-
return
|
|
5002
|
+
return _context44.stop();
|
|
4454
5003
|
}
|
|
4455
|
-
},
|
|
5004
|
+
}, _callee44, this);
|
|
4456
5005
|
}));
|
|
4457
|
-
function buildAvailabilityProjectionSnapshot(
|
|
5006
|
+
function buildAvailabilityProjectionSnapshot(_x29) {
|
|
4458
5007
|
return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
|
|
4459
5008
|
}
|
|
4460
5009
|
return buildAvailabilityProjectionSnapshot;
|
|
@@ -4462,10 +5011,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4462
5011
|
}, {
|
|
4463
5012
|
key: "getSharedPreparedAvailabilitySnapshot",
|
|
4464
5013
|
value: function () {
|
|
4465
|
-
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5014
|
+
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
4466
5015
|
var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
|
|
4467
|
-
return _regeneratorRuntime().wrap(function
|
|
4468
|
-
while (1) switch (
|
|
5016
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
5017
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4469
5018
|
case 0:
|
|
4470
5019
|
lifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
4471
5020
|
normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
@@ -4484,15 +5033,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4484
5033
|
}
|
|
4485
5034
|
})) : this.buildAvailabilityPrepareKey(normalizedParams);
|
|
4486
5035
|
if (!hasRawInputs) {
|
|
4487
|
-
|
|
5036
|
+
_context45.next = 11;
|
|
4488
5037
|
break;
|
|
4489
5038
|
}
|
|
4490
|
-
|
|
5039
|
+
_context45.next = 7;
|
|
4491
5040
|
return this.buildAvailabilityProjectionSnapshot(normalizedParams);
|
|
4492
5041
|
case 7:
|
|
4493
|
-
snapshot =
|
|
5042
|
+
snapshot = _context45.sent;
|
|
4494
5043
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
4495
|
-
|
|
5044
|
+
_context45.next = 10;
|
|
4496
5045
|
break;
|
|
4497
5046
|
}
|
|
4498
5047
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -4501,7 +5050,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4501
5050
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
4502
5051
|
});
|
|
4503
5052
|
case 10:
|
|
4504
|
-
return
|
|
5053
|
+
return _context45.abrupt("return", {
|
|
4505
5054
|
prepareKey: prepareKey,
|
|
4506
5055
|
snapshot: snapshot
|
|
4507
5056
|
});
|
|
@@ -4515,13 +5064,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4515
5064
|
promise: promise
|
|
4516
5065
|
});
|
|
4517
5066
|
}
|
|
4518
|
-
|
|
4519
|
-
|
|
5067
|
+
_context45.prev = 14;
|
|
5068
|
+
_context45.next = 17;
|
|
4520
5069
|
return promise;
|
|
4521
5070
|
case 17:
|
|
4522
|
-
_snapshot =
|
|
5071
|
+
_snapshot = _context45.sent;
|
|
4523
5072
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
4524
|
-
|
|
5073
|
+
_context45.next = 20;
|
|
4525
5074
|
break;
|
|
4526
5075
|
}
|
|
4527
5076
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -4530,24 +5079,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4530
5079
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
4531
5080
|
});
|
|
4532
5081
|
case 20:
|
|
4533
|
-
return
|
|
5082
|
+
return _context45.abrupt("return", {
|
|
4534
5083
|
prepareKey: prepareKey,
|
|
4535
5084
|
snapshot: _snapshot
|
|
4536
5085
|
});
|
|
4537
5086
|
case 21:
|
|
4538
|
-
|
|
5087
|
+
_context45.prev = 21;
|
|
4539
5088
|
current = this.availabilityPrepareInFlight.get(prepareKey);
|
|
4540
5089
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4541
5090
|
this.availabilityPrepareInFlight.delete(prepareKey);
|
|
4542
5091
|
}
|
|
4543
|
-
return
|
|
5092
|
+
return _context45.finish(21);
|
|
4544
5093
|
case 25:
|
|
4545
5094
|
case "end":
|
|
4546
|
-
return
|
|
5095
|
+
return _context45.stop();
|
|
4547
5096
|
}
|
|
4548
|
-
},
|
|
5097
|
+
}, _callee45, this, [[14,, 21, 25]]);
|
|
4549
5098
|
}));
|
|
4550
|
-
function getSharedPreparedAvailabilitySnapshot(
|
|
5099
|
+
function getSharedPreparedAvailabilitySnapshot(_x30) {
|
|
4551
5100
|
return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
|
|
4552
5101
|
}
|
|
4553
5102
|
return getSharedPreparedAvailabilitySnapshot;
|
|
@@ -4555,51 +5104,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4555
5104
|
}, {
|
|
4556
5105
|
key: "refreshAvailabilityContextProjection",
|
|
4557
5106
|
value: function () {
|
|
4558
|
-
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4559
|
-
var
|
|
5107
|
+
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
5108
|
+
var _this16 = this;
|
|
4560
5109
|
var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
|
|
4561
|
-
return _regeneratorRuntime().wrap(function
|
|
4562
|
-
while (1) switch (
|
|
5110
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
5111
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4563
5112
|
case 0:
|
|
4564
5113
|
existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
4565
5114
|
if (!existingInFlight) {
|
|
4566
|
-
|
|
5115
|
+
_context47.next = 5;
|
|
4567
5116
|
break;
|
|
4568
5117
|
}
|
|
4569
|
-
|
|
5118
|
+
_context47.next = 4;
|
|
4570
5119
|
return existingInFlight;
|
|
4571
5120
|
case 4:
|
|
4572
|
-
return
|
|
5121
|
+
return _context47.abrupt("return", _context47.sent);
|
|
4573
5122
|
case 5:
|
|
4574
5123
|
context = this.getAvailabilityContextEntry(params.contextId);
|
|
4575
5124
|
expectedVersion = context.activeVersion;
|
|
4576
5125
|
expectedRefreshNonce = context.refreshNonce;
|
|
4577
5126
|
expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
4578
|
-
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5127
|
+
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
|
|
4579
5128
|
var snapshot, currentContext, projectionEntry;
|
|
4580
|
-
return _regeneratorRuntime().wrap(function
|
|
4581
|
-
while (1) switch (
|
|
5129
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
5130
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4582
5131
|
case 0:
|
|
4583
|
-
|
|
4584
|
-
return
|
|
5132
|
+
_context46.next = 2;
|
|
5133
|
+
return _this16.buildAvailabilityProjectionSnapshot(_this16.cloneAvailabilityPrepareParams(context.prepareParams), {
|
|
4585
5134
|
durationCandidateAnchorAt: context.durationCandidateAnchorAt
|
|
4586
5135
|
});
|
|
4587
5136
|
case 2:
|
|
4588
|
-
snapshot =
|
|
4589
|
-
currentContext =
|
|
5137
|
+
snapshot = _context46.sent;
|
|
5138
|
+
currentContext = _this16.availabilityContextRegistry.get(params.contextId);
|
|
4590
5139
|
if (currentContext) {
|
|
4591
|
-
|
|
5140
|
+
_context46.next = 6;
|
|
4592
5141
|
break;
|
|
4593
5142
|
}
|
|
4594
|
-
return
|
|
5143
|
+
return _context46.abrupt("return", null);
|
|
4595
5144
|
case 6:
|
|
4596
|
-
if (!(expectedLifecycleGeneration !==
|
|
4597
|
-
|
|
5145
|
+
if (!(expectedLifecycleGeneration !== _this16.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
|
|
5146
|
+
_context46.next = 8;
|
|
4598
5147
|
break;
|
|
4599
5148
|
}
|
|
4600
|
-
return
|
|
5149
|
+
return _context46.abrupt("return", null);
|
|
4601
5150
|
case 8:
|
|
4602
|
-
projectionEntry =
|
|
5151
|
+
projectionEntry = _this16.storeAvailabilityProjectionEntry({
|
|
4603
5152
|
contextId: currentContext.contextId,
|
|
4604
5153
|
prepareParams: snapshot.prepareParams,
|
|
4605
5154
|
prepareKey: currentContext.prepareKey,
|
|
@@ -4607,8 +5156,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4607
5156
|
orderRevision: snapshot.orderRevision,
|
|
4608
5157
|
incrementVersion: true
|
|
4609
5158
|
});
|
|
4610
|
-
|
|
4611
|
-
return
|
|
5159
|
+
_context46.next = 11;
|
|
5160
|
+
return _this16.emitAvailabilityDiagnostic({
|
|
4612
5161
|
action: 'refresh',
|
|
4613
5162
|
contextId: currentContext.contextId,
|
|
4614
5163
|
contextVersion: projectionEntry.contextVersion,
|
|
@@ -4619,33 +5168,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4619
5168
|
reason: params.reason
|
|
4620
5169
|
});
|
|
4621
5170
|
case 11:
|
|
4622
|
-
return
|
|
5171
|
+
return _context46.abrupt("return", projectionEntry);
|
|
4623
5172
|
case 12:
|
|
4624
5173
|
case "end":
|
|
4625
|
-
return
|
|
5174
|
+
return _context46.stop();
|
|
4626
5175
|
}
|
|
4627
|
-
},
|
|
5176
|
+
}, _callee46);
|
|
4628
5177
|
}))();
|
|
4629
5178
|
this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
|
|
4630
|
-
|
|
4631
|
-
|
|
5179
|
+
_context47.prev = 11;
|
|
5180
|
+
_context47.next = 14;
|
|
4632
5181
|
return refreshPromise;
|
|
4633
5182
|
case 14:
|
|
4634
|
-
return
|
|
5183
|
+
return _context47.abrupt("return", _context47.sent);
|
|
4635
5184
|
case 15:
|
|
4636
|
-
|
|
5185
|
+
_context47.prev = 15;
|
|
4637
5186
|
current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
4638
5187
|
if (current === refreshPromise) {
|
|
4639
5188
|
this.availabilityProjectionRefreshInFlight.delete(params.contextId);
|
|
4640
5189
|
}
|
|
4641
|
-
return
|
|
5190
|
+
return _context47.finish(15);
|
|
4642
5191
|
case 19:
|
|
4643
5192
|
case "end":
|
|
4644
|
-
return
|
|
5193
|
+
return _context47.stop();
|
|
4645
5194
|
}
|
|
4646
|
-
},
|
|
5195
|
+
}, _callee47, this, [[11,, 15, 19]]);
|
|
4647
5196
|
}));
|
|
4648
|
-
function refreshAvailabilityContextProjection(
|
|
5197
|
+
function refreshAvailabilityContextProjection(_x31) {
|
|
4649
5198
|
return _refreshAvailabilityContextProjection.apply(this, arguments);
|
|
4650
5199
|
}
|
|
4651
5200
|
return refreshAvailabilityContextProjection;
|
|
@@ -4653,53 +5202,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4653
5202
|
}, {
|
|
4654
5203
|
key: "ensureAvailabilityContextProjection",
|
|
4655
5204
|
value: function () {
|
|
4656
|
-
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5205
|
+
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId, reason) {
|
|
4657
5206
|
var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
|
|
4658
|
-
return _regeneratorRuntime().wrap(function
|
|
4659
|
-
while (1) switch (
|
|
5207
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5208
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4660
5209
|
case 0:
|
|
4661
5210
|
retries = 0;
|
|
4662
5211
|
case 1:
|
|
4663
5212
|
if (!(retries < 3)) {
|
|
4664
|
-
|
|
5213
|
+
_context48.next = 19;
|
|
4665
5214
|
break;
|
|
4666
5215
|
}
|
|
4667
5216
|
context = this.getAvailabilityContextEntry(contextId);
|
|
4668
5217
|
currentOrderRevision = this.getCurrentOrderRevision();
|
|
4669
5218
|
projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
|
|
4670
5219
|
if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
|
|
4671
|
-
|
|
5220
|
+
_context48.next = 7;
|
|
4672
5221
|
break;
|
|
4673
5222
|
}
|
|
4674
|
-
return
|
|
5223
|
+
return _context48.abrupt("return", {
|
|
4675
5224
|
context: context,
|
|
4676
5225
|
projectionEntry: projectionEntry,
|
|
4677
5226
|
refreshed: false
|
|
4678
5227
|
});
|
|
4679
5228
|
case 7:
|
|
4680
|
-
|
|
5229
|
+
_context48.next = 9;
|
|
4681
5230
|
return this.refreshAvailabilityContextProjection({
|
|
4682
5231
|
contextId: contextId,
|
|
4683
5232
|
reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
|
|
4684
5233
|
previousOrderRevision: context.lastKnownOrderRevision
|
|
4685
5234
|
});
|
|
4686
5235
|
case 9:
|
|
4687
|
-
refreshedProjectionEntry =
|
|
5236
|
+
refreshedProjectionEntry = _context48.sent;
|
|
4688
5237
|
if (refreshedProjectionEntry) {
|
|
4689
|
-
|
|
5238
|
+
_context48.next = 13;
|
|
4690
5239
|
break;
|
|
4691
5240
|
}
|
|
4692
5241
|
retries += 1;
|
|
4693
|
-
return
|
|
5242
|
+
return _context48.abrupt("continue", 1);
|
|
4694
5243
|
case 13:
|
|
4695
5244
|
if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
4696
|
-
|
|
5245
|
+
_context48.next = 16;
|
|
4697
5246
|
break;
|
|
4698
5247
|
}
|
|
4699
5248
|
retries += 1;
|
|
4700
|
-
return
|
|
5249
|
+
return _context48.abrupt("continue", 1);
|
|
4701
5250
|
case 16:
|
|
4702
|
-
return
|
|
5251
|
+
return _context48.abrupt("return", {
|
|
4703
5252
|
context: this.getAvailabilityContextEntry(contextId),
|
|
4704
5253
|
projectionEntry: refreshedProjectionEntry,
|
|
4705
5254
|
refreshed: true
|
|
@@ -4711,11 +5260,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4711
5260
|
});
|
|
4712
5261
|
case 20:
|
|
4713
5262
|
case "end":
|
|
4714
|
-
return
|
|
5263
|
+
return _context48.stop();
|
|
4715
5264
|
}
|
|
4716
|
-
},
|
|
5265
|
+
}, _callee48, this);
|
|
4717
5266
|
}));
|
|
4718
|
-
function ensureAvailabilityContextProjection(
|
|
5267
|
+
function ensureAvailabilityContextProjection(_x32, _x33) {
|
|
4719
5268
|
return _ensureAvailabilityContextProjection.apply(this, arguments);
|
|
4720
5269
|
}
|
|
4721
5270
|
return ensureAvailabilityContextProjection;
|
|
@@ -4723,18 +5272,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4723
5272
|
}, {
|
|
4724
5273
|
key: "tryAcquireAvailabilityCommitLock",
|
|
4725
5274
|
value: function () {
|
|
4726
|
-
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5275
|
+
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(contextId) {
|
|
4727
5276
|
var _currentContext$activ;
|
|
4728
5277
|
var _waitingContext$activ, waitingContext, currentContext;
|
|
4729
|
-
return _regeneratorRuntime().wrap(function
|
|
4730
|
-
while (1) switch (
|
|
5278
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
5279
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4731
5280
|
case 0:
|
|
4732
5281
|
if (!this.availabilityCommitLocks.has(contextId)) {
|
|
4733
|
-
|
|
5282
|
+
_context49.next = 5;
|
|
4734
5283
|
break;
|
|
4735
5284
|
}
|
|
4736
5285
|
waitingContext = this.availabilityContextRegistry.get(contextId);
|
|
4737
|
-
|
|
5286
|
+
_context49.next = 4;
|
|
4738
5287
|
return this.emitAvailabilityDiagnostic({
|
|
4739
5288
|
action: 'commit_lock_wait',
|
|
4740
5289
|
contextId: contextId,
|
|
@@ -4751,7 +5300,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4751
5300
|
case 5:
|
|
4752
5301
|
this.availabilityCommitLocks.add(contextId);
|
|
4753
5302
|
currentContext = this.availabilityContextRegistry.get(contextId);
|
|
4754
|
-
|
|
5303
|
+
_context49.next = 9;
|
|
4755
5304
|
return this.emitAvailabilityDiagnostic({
|
|
4756
5305
|
action: 'commit_lock_acquired',
|
|
4757
5306
|
contextId: contextId,
|
|
@@ -4763,11 +5312,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4763
5312
|
});
|
|
4764
5313
|
case 9:
|
|
4765
5314
|
case "end":
|
|
4766
|
-
return
|
|
5315
|
+
return _context49.stop();
|
|
4767
5316
|
}
|
|
4768
|
-
},
|
|
5317
|
+
}, _callee49, this);
|
|
4769
5318
|
}));
|
|
4770
|
-
function tryAcquireAvailabilityCommitLock(
|
|
5319
|
+
function tryAcquireAvailabilityCommitLock(_x34) {
|
|
4771
5320
|
return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
|
|
4772
5321
|
}
|
|
4773
5322
|
return tryAcquireAvailabilityCommitLock;
|
|
@@ -4775,15 +5324,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4775
5324
|
}, {
|
|
4776
5325
|
key: "releaseAvailabilityCommitLock",
|
|
4777
5326
|
value: function () {
|
|
4778
|
-
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5327
|
+
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(contextId) {
|
|
4779
5328
|
var _releasedContext$acti;
|
|
4780
5329
|
var releasedContext;
|
|
4781
|
-
return _regeneratorRuntime().wrap(function
|
|
4782
|
-
while (1) switch (
|
|
5330
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
5331
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4783
5332
|
case 0:
|
|
4784
5333
|
this.availabilityCommitLocks.delete(contextId);
|
|
4785
5334
|
releasedContext = this.availabilityContextRegistry.get(contextId);
|
|
4786
|
-
|
|
5335
|
+
_context50.next = 4;
|
|
4787
5336
|
return this.emitAvailabilityDiagnostic({
|
|
4788
5337
|
action: 'commit_lock_released',
|
|
4789
5338
|
contextId: contextId,
|
|
@@ -4795,11 +5344,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4795
5344
|
});
|
|
4796
5345
|
case 4:
|
|
4797
5346
|
case "end":
|
|
4798
|
-
return
|
|
5347
|
+
return _context50.stop();
|
|
4799
5348
|
}
|
|
4800
|
-
},
|
|
5349
|
+
}, _callee50, this);
|
|
4801
5350
|
}));
|
|
4802
|
-
function releaseAvailabilityCommitLock(
|
|
5351
|
+
function releaseAvailabilityCommitLock(_x35) {
|
|
4803
5352
|
return _releaseAvailabilityCommitLock.apply(this, arguments);
|
|
4804
5353
|
}
|
|
4805
5354
|
return releaseAvailabilityCommitLock;
|
|
@@ -4807,20 +5356,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4807
5356
|
}, {
|
|
4808
5357
|
key: "prepareAvailabilityProjection",
|
|
4809
5358
|
value: (function () {
|
|
4810
|
-
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5359
|
+
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
|
|
4811
5360
|
var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
|
|
4812
|
-
return _regeneratorRuntime().wrap(function
|
|
4813
|
-
while (1) switch (
|
|
5361
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
5362
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
4814
5363
|
case 0:
|
|
4815
5364
|
this.assertAvailabilityPrepareParams(params);
|
|
4816
|
-
|
|
5365
|
+
_context51.next = 3;
|
|
4817
5366
|
return this.resolveAvailabilityPrepareDefaults(params);
|
|
4818
5367
|
case 3:
|
|
4819
|
-
paramsWithDefaults =
|
|
4820
|
-
|
|
5368
|
+
paramsWithDefaults = _context51.sent;
|
|
5369
|
+
_context51.next = 6;
|
|
4821
5370
|
return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
|
|
4822
5371
|
case 6:
|
|
4823
|
-
_yield$this$getShared =
|
|
5372
|
+
_yield$this$getShared = _context51.sent;
|
|
4824
5373
|
prepareKey = _yield$this$getShared.prepareKey;
|
|
4825
5374
|
snapshot = _yield$this$getShared.snapshot;
|
|
4826
5375
|
contextId = this.createAvailabilityContextId();
|
|
@@ -4841,7 +5390,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4841
5390
|
refreshed: false,
|
|
4842
5391
|
reason: 'prepare'
|
|
4843
5392
|
};
|
|
4844
|
-
|
|
5393
|
+
_context51.next = 16;
|
|
4845
5394
|
return this.emitAvailabilityDiagnostic({
|
|
4846
5395
|
action: 'prepare',
|
|
4847
5396
|
contextId: contextId,
|
|
@@ -4852,17 +5401,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4852
5401
|
reason: 'prepare'
|
|
4853
5402
|
});
|
|
4854
5403
|
case 16:
|
|
4855
|
-
|
|
5404
|
+
_context51.next = 18;
|
|
4856
5405
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
|
|
4857
5406
|
case 18:
|
|
4858
|
-
return
|
|
5407
|
+
return _context51.abrupt("return", handle);
|
|
4859
5408
|
case 19:
|
|
4860
5409
|
case "end":
|
|
4861
|
-
return
|
|
5410
|
+
return _context51.stop();
|
|
4862
5411
|
}
|
|
4863
|
-
},
|
|
5412
|
+
}, _callee51, this);
|
|
4864
5413
|
}));
|
|
4865
|
-
function prepareAvailabilityProjection(
|
|
5414
|
+
function prepareAvailabilityProjection(_x36) {
|
|
4866
5415
|
return _prepareAvailabilityProjection.apply(this, arguments);
|
|
4867
5416
|
}
|
|
4868
5417
|
return prepareAvailabilityProjection;
|
|
@@ -4870,54 +5419,58 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4870
5419
|
}, {
|
|
4871
5420
|
key: "getProductTimeRanges",
|
|
4872
5421
|
value: (function () {
|
|
4873
|
-
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5422
|
+
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(contextId) {
|
|
4874
5423
|
var _this$otherParams$pla,
|
|
4875
|
-
_this$
|
|
4876
|
-
|
|
5424
|
+
_this$otherParams36,
|
|
5425
|
+
_this17 = this;
|
|
4877
5426
|
var request,
|
|
4878
5427
|
_yield$this$ensureAva,
|
|
4879
5428
|
context,
|
|
4880
5429
|
projectionEntry,
|
|
4881
5430
|
contextVersion,
|
|
5431
|
+
strictAvailability,
|
|
4882
5432
|
isPosAvailabilityRequest,
|
|
4883
5433
|
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
4884
|
-
|
|
4885
|
-
return _regeneratorRuntime().wrap(function
|
|
4886
|
-
while (1) switch (
|
|
5434
|
+
_args52 = arguments;
|
|
5435
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
5436
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
4887
5437
|
case 0:
|
|
4888
|
-
request =
|
|
4889
|
-
|
|
5438
|
+
request = _args52.length > 1 && _args52[1] !== undefined ? _args52[1] : {};
|
|
5439
|
+
_context52.next = 3;
|
|
4890
5440
|
return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
|
|
4891
5441
|
case 3:
|
|
4892
|
-
_yield$this$ensureAva =
|
|
5442
|
+
_yield$this$ensureAva = _context52.sent;
|
|
4893
5443
|
context = _yield$this$ensureAva.context;
|
|
4894
5444
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
4895
5445
|
contextVersion = context.activeVersion;
|
|
4896
|
-
|
|
4897
|
-
|
|
5446
|
+
strictAvailability = context.prepareParams.strictAvailability === true;
|
|
5447
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase() === 'pos';
|
|
5448
|
+
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && !strictAvailability && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
4898
5449
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
4899
5450
|
});
|
|
4900
|
-
return
|
|
5451
|
+
return _context52.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
|
|
4901
5452
|
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
5453
|
+
} : {}), strictAvailability ? {
|
|
5454
|
+
allowOutsideOperatingHoursForRequestedStartTimes: false
|
|
4902
5455
|
} : {}), {
|
|
4903
5456
|
evaluatedAt: this.getAvailabilityRuntimeDateTime(),
|
|
4904
|
-
useExactDurationCandidateMinute: isPosAvailabilityRequest,
|
|
4905
|
-
allowSessionCustomRanges: isPosAvailabilityRequest,
|
|
4906
|
-
allowExcludedScheduleDateOverride: isPosAvailabilityRequest
|
|
5457
|
+
useExactDurationCandidateMinute: isPosAvailabilityRequest && !strictAvailability,
|
|
5458
|
+
allowSessionCustomRanges: isPosAvailabilityRequest && !strictAvailability,
|
|
5459
|
+
allowExcludedScheduleDateOverride: isPosAvailabilityRequest && !strictAvailability
|
|
4907
5460
|
}).map(function (group) {
|
|
4908
5461
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
4909
5462
|
ranges: group.ranges.map(function (candidate) {
|
|
4910
|
-
return
|
|
5463
|
+
return _this17.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
|
|
4911
5464
|
})
|
|
4912
5465
|
});
|
|
4913
5466
|
}));
|
|
4914
|
-
case
|
|
5467
|
+
case 11:
|
|
4915
5468
|
case "end":
|
|
4916
|
-
return
|
|
5469
|
+
return _context52.stop();
|
|
4917
5470
|
}
|
|
4918
|
-
},
|
|
5471
|
+
}, _callee52, this);
|
|
4919
5472
|
}));
|
|
4920
|
-
function getProductTimeRanges(
|
|
5473
|
+
function getProductTimeRanges(_x37) {
|
|
4921
5474
|
return _getProductTimeRanges.apply(this, arguments);
|
|
4922
5475
|
}
|
|
4923
5476
|
return getProductTimeRanges;
|
|
@@ -4925,24 +5478,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4925
5478
|
}, {
|
|
4926
5479
|
key: "queryBookingAvailability",
|
|
4927
5480
|
value: (function () {
|
|
4928
|
-
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4929
|
-
var _this$otherParams$pla2, _this$
|
|
4930
|
-
var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, result, contextVersion, contextualResult;
|
|
4931
|
-
return _regeneratorRuntime().wrap(function
|
|
4932
|
-
while (1) switch (
|
|
5481
|
+
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(contextId, request) {
|
|
5482
|
+
var _this$otherParams$pla2, _this$otherParams37;
|
|
5483
|
+
var _yield$this$ensureAva2, context, projectionEntry, refreshed, strictAvailability, isPosAvailabilityRequest, result, contextVersion, contextualResult;
|
|
5484
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5485
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
4933
5486
|
case 0:
|
|
4934
|
-
|
|
5487
|
+
_context53.next = 2;
|
|
4935
5488
|
return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
|
|
4936
5489
|
case 2:
|
|
4937
|
-
_yield$this$ensureAva2 =
|
|
5490
|
+
_yield$this$ensureAva2 = _context53.sent;
|
|
4938
5491
|
context = _yield$this$ensureAva2.context;
|
|
4939
5492
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
4940
5493
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
4941
5494
|
this.assertContextualQueryFreshness(context, request);
|
|
4942
|
-
|
|
5495
|
+
strictAvailability = context.prepareParams.strictAvailability === true;
|
|
5496
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
4943
5497
|
result = queryAvailabilityProjection(projectionEntry.projection, request, {
|
|
4944
|
-
useExactDurationCandidateMinute: isPosAvailabilityRequest,
|
|
4945
|
-
allowExcludedScheduleDateOverride: isPosAvailabilityRequest
|
|
5498
|
+
useExactDurationCandidateMinute: isPosAvailabilityRequest && !strictAvailability,
|
|
5499
|
+
allowExcludedScheduleDateOverride: isPosAvailabilityRequest && !strictAvailability
|
|
4946
5500
|
});
|
|
4947
5501
|
contextVersion = context.activeVersion;
|
|
4948
5502
|
contextualResult = result.target === 'time' ? _objectSpread(_objectSpread({}, result), {}, {
|
|
@@ -4970,22 +5524,36 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4970
5524
|
});
|
|
4971
5525
|
})
|
|
4972
5526
|
}) : result;
|
|
4973
|
-
return
|
|
5527
|
+
return _context53.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
|
|
4974
5528
|
contextId: context.contextId,
|
|
4975
5529
|
contextVersion: contextVersion,
|
|
4976
5530
|
refreshed: refreshed
|
|
4977
5531
|
}));
|
|
4978
|
-
case
|
|
5532
|
+
case 13:
|
|
4979
5533
|
case "end":
|
|
4980
|
-
return
|
|
5534
|
+
return _context53.stop();
|
|
4981
5535
|
}
|
|
4982
|
-
},
|
|
5536
|
+
}, _callee53, this);
|
|
4983
5537
|
}));
|
|
4984
|
-
function queryBookingAvailability(
|
|
5538
|
+
function queryBookingAvailability(_x38, _x39) {
|
|
4985
5539
|
return _queryBookingAvailability.apply(this, arguments);
|
|
4986
5540
|
}
|
|
4987
5541
|
return queryBookingAvailability;
|
|
4988
|
-
}())
|
|
5542
|
+
}() /** Reads detached resource metadata from the current context; never refreshes or performs I/O. */)
|
|
5543
|
+
}, {
|
|
5544
|
+
key: "getAvailabilityResources",
|
|
5545
|
+
value: function getAvailabilityResources(contextId, expectedVersion) {
|
|
5546
|
+
var context = this.getAvailabilityContextEntry(contextId);
|
|
5547
|
+
var entry = this.getActiveAvailabilityProjectionEntry(context);
|
|
5548
|
+
if (!entry || entry.contextVersion !== context.activeVersion || entry.orderRevision !== this.getCurrentOrderRevision() || expectedVersion !== undefined && context.activeVersion !== expectedVersion) {
|
|
5549
|
+
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '资源上下文已变化,请重新查询当前候选', {
|
|
5550
|
+
contextId: contextId,
|
|
5551
|
+
expectedVersion: expectedVersion,
|
|
5552
|
+
currentContextVersion: context.activeVersion
|
|
5553
|
+
});
|
|
5554
|
+
}
|
|
5555
|
+
return cloneDeep(_toConsumableArray(entry.projection.resources));
|
|
5556
|
+
}
|
|
4989
5557
|
}, {
|
|
4990
5558
|
key: "releaseAvailabilityContext",
|
|
4991
5559
|
value: function releaseAvailabilityContext(contextId) {
|
|
@@ -5030,18 +5598,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5030
5598
|
}, {
|
|
5031
5599
|
key: "findProductLineByUid",
|
|
5032
5600
|
value: function findProductLineByUid(productLineUid) {
|
|
5033
|
-
var _this$
|
|
5034
|
-
return (((_this$
|
|
5601
|
+
var _this$getTempOrder3;
|
|
5602
|
+
return (((_this$getTempOrder3 = this.getTempOrder()) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.products) || []).find(function (product) {
|
|
5035
5603
|
return getProductLineUid(product) === String(productLineUid);
|
|
5036
5604
|
});
|
|
5037
5605
|
}
|
|
5038
5606
|
}, {
|
|
5039
5607
|
key: "findLinkedBooking",
|
|
5040
5608
|
value: function findLinkedBooking(product) {
|
|
5041
|
-
var
|
|
5609
|
+
var _ref53, _product$booking_uid3, _product$metadata7, _this$getTempOrder4;
|
|
5042
5610
|
var productUid = getProductLineUid(product);
|
|
5043
|
-
var bookingUid = String((
|
|
5044
|
-
return (((_this$
|
|
5611
|
+
var bookingUid = String((_ref53 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.booking_uid) !== null && _ref53 !== void 0 ? _ref53 : '');
|
|
5612
|
+
return (((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.bookings) || []).find(function (booking) {
|
|
5045
5613
|
var _booking$product_uid3;
|
|
5046
5614
|
return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
|
|
5047
5615
|
});
|
|
@@ -5051,69 +5619,103 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5051
5619
|
}, {
|
|
5052
5620
|
key: "commitAvailabilitySelection",
|
|
5053
5621
|
value: (function () {
|
|
5054
|
-
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5055
|
-
var
|
|
5056
|
-
|
|
5057
|
-
|
|
5622
|
+
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(contextId, params) {
|
|
5623
|
+
var _this$availabilityCon,
|
|
5624
|
+
_params$availabilityC2,
|
|
5625
|
+
_this$store$order11,
|
|
5626
|
+
_this$store$order11$e,
|
|
5627
|
+
_this18 = this;
|
|
5628
|
+
var normalizedContextId, isEditingSelection, isPartyReplacement, strictAvailability, hasCommitGuard, guardedOrder, getGuardedCommitIdentity, guardedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref54, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla3, _this$otherParams38, _params$orderProduct$3, _params$orderProduct6, _existingBooking$hold, _existingBooking$meta, _ref55, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$meta3, _existingBooking$hold2, _transformed$metadata, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, relatedRetailProducts, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref56, _transformed$product_4, update, _this$getTempOrder5, _this$getTempOrder6, _params$salesNotes, _params$salesNotes2, _ref57, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
|
|
5629
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5630
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
5058
5631
|
case 0:
|
|
5059
5632
|
normalizedContextId = String(contextId || '').trim();
|
|
5060
5633
|
if (normalizedContextId) {
|
|
5061
|
-
|
|
5634
|
+
_context54.next = 3;
|
|
5062
5635
|
break;
|
|
5063
5636
|
}
|
|
5064
5637
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
|
|
5065
5638
|
candidate: params.candidate
|
|
5066
5639
|
});
|
|
5067
5640
|
case 3:
|
|
5068
|
-
|
|
5641
|
+
isEditingSelection = params.mode === 'edit' || params.mode === 'replace';
|
|
5642
|
+
isPartyReplacement = params.mode === 'replace' || params.relatedRetailProducts !== undefined;
|
|
5643
|
+
if (!(isPartyReplacement && (!isEditingSelection || !Array.isArray(params.relatedRetailProducts)))) {
|
|
5644
|
+
_context54.next = 7;
|
|
5645
|
+
break;
|
|
5646
|
+
}
|
|
5647
|
+
throw new AvailabilityError('INVALID_TARGET_FILTER', 'Party replacement requires edit/replace mode and the confirmed complete extras array');
|
|
5648
|
+
case 7:
|
|
5649
|
+
strictAvailability = ((_this$availabilityCon = this.availabilityContextRegistry.get(normalizedContextId)) === null || _this$availabilityCon === void 0 ? void 0 : _this$availabilityCon.prepareParams.strictAvailability) === true;
|
|
5650
|
+
hasCommitGuard = strictAvailability || isPartyReplacement || Boolean(params.availabilityCommitGuard);
|
|
5651
|
+
(_params$availabilityC2 = params.availabilityCommitGuard) === null || _params$availabilityC2 === void 0 || _params$availabilityC2.call(params);
|
|
5652
|
+
// Stabilize the locally generated sale identity before taking the guard snapshot.
|
|
5653
|
+
if (hasCommitGuard) (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$e = _this$store$order11.ensureTempOrder) === null || _this$store$order11$e === void 0 || _this$store$order11$e.call(_this$store$order11);
|
|
5654
|
+
guardedOrder = hasCommitGuard ? this.getTempOrder() : null;
|
|
5655
|
+
getGuardedCommitIdentity = function getGuardedCommitIdentity() {
|
|
5656
|
+
var _this18$otherParams$s, _this18$otherParams, _this18$otherParams2, _this18$core, _this18$getTempOrder, _this18$getTempOrder2;
|
|
5657
|
+
return JSON.stringify(stableValue({
|
|
5658
|
+
scope: _this18.getAvailabilityScopeDescriptor(),
|
|
5659
|
+
shopId: (_this18$otherParams$s = (_this18$otherParams = _this18.otherParams) === null || _this18$otherParams === void 0 ? void 0 : _this18$otherParams.shop_id) !== null && _this18$otherParams$s !== void 0 ? _this18$otherParams$s : (_this18$otherParams2 = _this18.otherParams) === null || _this18$otherParams2 === void 0 ? void 0 : _this18$otherParams2.shopId,
|
|
5660
|
+
contextShopId: (_this18$core = _this18.core) === null || _this18$core === void 0 || (_this18$core = _this18$core.context) === null || _this18$core === void 0 ? void 0 : _this18$core.shop_id,
|
|
5661
|
+
orderId: (_this18$getTempOrder = _this18.getTempOrder()) === null || _this18$getTempOrder === void 0 ? void 0 : _this18$getTempOrder.order_id,
|
|
5662
|
+
externalSaleNumber: (_this18$getTempOrder2 = _this18.getTempOrder()) === null || _this18$getTempOrder2 === void 0 ? void 0 : _this18$getTempOrder2.external_sale_number
|
|
5663
|
+
}));
|
|
5664
|
+
};
|
|
5665
|
+
guardedCommitIdentity = hasCommitGuard ? getGuardedCommitIdentity() : '';
|
|
5666
|
+
availabilityCommitTargetGuard = function availabilityCommitTargetGuard() {
|
|
5667
|
+
return _this18.getTempOrder() === guardedOrder && getGuardedCommitIdentity() === guardedCommitIdentity;
|
|
5668
|
+
};
|
|
5669
|
+
guardedCommitPublished = false;
|
|
5670
|
+
_context54.next = 18;
|
|
5069
5671
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
5070
|
-
case
|
|
5071
|
-
|
|
5672
|
+
case 18:
|
|
5673
|
+
_context54.prev = 18;
|
|
5072
5674
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
5073
5675
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
5074
|
-
|
|
5676
|
+
_context54.next = 22;
|
|
5075
5677
|
break;
|
|
5076
5678
|
}
|
|
5077
5679
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
5078
5680
|
bookingCount: params.bookingCount
|
|
5079
5681
|
});
|
|
5080
|
-
case
|
|
5081
|
-
if (!(
|
|
5082
|
-
|
|
5682
|
+
case 22:
|
|
5683
|
+
if (!(isEditingSelection && bookingCount !== 1)) {
|
|
5684
|
+
_context54.next = 24;
|
|
5083
5685
|
break;
|
|
5084
5686
|
}
|
|
5085
5687
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
5086
5688
|
bookingCount: bookingCount
|
|
5087
5689
|
});
|
|
5088
|
-
case
|
|
5089
|
-
orderProductQuantity = (
|
|
5690
|
+
case 24:
|
|
5691
|
+
orderProductQuantity = (_ref54 = (_params$orderProduct$ = (_params$orderProduct = params.orderProduct) === null || _params$orderProduct === void 0 ? void 0 : _params$orderProduct.num) !== null && _params$orderProduct$ !== void 0 ? _params$orderProduct$ : (_params$orderProduct2 = params.orderProduct) === null || _params$orderProduct2 === void 0 ? void 0 : _params$orderProduct2.quantity) !== null && _ref54 !== void 0 ? _ref54 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
|
|
5090
5692
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
5091
|
-
|
|
5693
|
+
_context54.next = 27;
|
|
5092
5694
|
break;
|
|
5093
5695
|
}
|
|
5094
5696
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
5095
5697
|
bookingCount: bookingCount,
|
|
5096
5698
|
orderProductQuantity: orderProductQuantity
|
|
5097
5699
|
});
|
|
5098
|
-
case
|
|
5700
|
+
case 27:
|
|
5099
5701
|
partySize = Number(params.partySize);
|
|
5100
5702
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
5101
|
-
|
|
5703
|
+
_context54.next = 30;
|
|
5102
5704
|
break;
|
|
5103
5705
|
}
|
|
5104
5706
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
5105
5707
|
partySize: params.partySize
|
|
5106
5708
|
});
|
|
5107
|
-
case
|
|
5108
|
-
|
|
5709
|
+
case 30:
|
|
5710
|
+
_context54.next = 32;
|
|
5109
5711
|
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
5110
|
-
case
|
|
5111
|
-
_yield$this$ensureAva3 =
|
|
5712
|
+
case 32:
|
|
5713
|
+
_yield$this$ensureAva3 = _context54.sent;
|
|
5112
5714
|
context = _yield$this$ensureAva3.context;
|
|
5113
5715
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
5114
5716
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
5115
5717
|
if (!refreshed) {
|
|
5116
|
-
|
|
5718
|
+
_context54.next = 38;
|
|
5117
5719
|
break;
|
|
5118
5720
|
}
|
|
5119
5721
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5121,14 +5723,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5121
5723
|
currentContextVersion: context.activeVersion,
|
|
5122
5724
|
candidateContextVersion: params.candidate.availabilityContextVersion
|
|
5123
5725
|
});
|
|
5124
|
-
case
|
|
5726
|
+
case 38:
|
|
5125
5727
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
5126
|
-
if (!
|
|
5127
|
-
|
|
5728
|
+
if (!isEditingSelection) {
|
|
5729
|
+
_context54.next = 44;
|
|
5128
5730
|
break;
|
|
5129
5731
|
}
|
|
5130
5732
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
5131
|
-
|
|
5733
|
+
_context54.next = 42;
|
|
5132
5734
|
break;
|
|
5133
5735
|
}
|
|
5134
5736
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -5136,21 +5738,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5136
5738
|
productLineUid: params.productLineUid,
|
|
5137
5739
|
editingProductLineUids: boundEditingUids
|
|
5138
5740
|
});
|
|
5139
|
-
case
|
|
5140
|
-
|
|
5741
|
+
case 42:
|
|
5742
|
+
_context54.next = 46;
|
|
5141
5743
|
break;
|
|
5142
|
-
case
|
|
5744
|
+
case 44:
|
|
5143
5745
|
if (!(boundEditingUids.length > 0)) {
|
|
5144
|
-
|
|
5746
|
+
_context54.next = 46;
|
|
5145
5747
|
break;
|
|
5146
5748
|
}
|
|
5147
5749
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
5148
5750
|
contextId: normalizedContextId,
|
|
5149
5751
|
editingProductLineUids: boundEditingUids
|
|
5150
5752
|
});
|
|
5151
|
-
case
|
|
5753
|
+
case 46:
|
|
5152
5754
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
5153
|
-
|
|
5755
|
+
_context54.next = 48;
|
|
5154
5756
|
break;
|
|
5155
5757
|
}
|
|
5156
5758
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5158,9 +5760,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5158
5760
|
currentContextVersion: context.activeVersion,
|
|
5159
5761
|
projectionContextVersion: projectionEntry.contextVersion
|
|
5160
5762
|
});
|
|
5161
|
-
case
|
|
5763
|
+
case 48:
|
|
5162
5764
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
5163
|
-
|
|
5765
|
+
_context54.next = 50;
|
|
5164
5766
|
break;
|
|
5165
5767
|
}
|
|
5166
5768
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -5169,9 +5771,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5169
5771
|
projectionOrderRevision: projectionEntry.orderRevision,
|
|
5170
5772
|
currentOrderRevision: this.getCurrentOrderRevision()
|
|
5171
5773
|
});
|
|
5172
|
-
case
|
|
5774
|
+
case 50:
|
|
5173
5775
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
5174
|
-
|
|
5776
|
+
_context54.next = 52;
|
|
5175
5777
|
break;
|
|
5176
5778
|
}
|
|
5177
5779
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -5179,35 +5781,35 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5179
5781
|
candidateContextVersion: params.candidate.availabilityContextVersion,
|
|
5180
5782
|
currentContextVersion: context.activeVersion
|
|
5181
5783
|
});
|
|
5182
|
-
case
|
|
5784
|
+
case 52:
|
|
5183
5785
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
5184
5786
|
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;
|
|
5185
5787
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
5186
|
-
|
|
5788
|
+
_context54.next = 56;
|
|
5187
5789
|
break;
|
|
5188
5790
|
}
|
|
5189
5791
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
5190
5792
|
orderProductId: orderProductId,
|
|
5191
5793
|
candidateProductId: params.candidate.productId
|
|
5192
5794
|
});
|
|
5193
|
-
case
|
|
5194
|
-
if (!(
|
|
5195
|
-
|
|
5795
|
+
case 56:
|
|
5796
|
+
if (!(isEditingSelection && !params.productLineUid)) {
|
|
5797
|
+
_context54.next = 58;
|
|
5196
5798
|
break;
|
|
5197
5799
|
}
|
|
5198
5800
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
5199
|
-
case
|
|
5200
|
-
editingLine =
|
|
5201
|
-
if (!(
|
|
5202
|
-
|
|
5801
|
+
case 58:
|
|
5802
|
+
editingLine = isEditingSelection ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
5803
|
+
if (!(isEditingSelection && !editingLine)) {
|
|
5804
|
+
_context54.next = 61;
|
|
5203
5805
|
break;
|
|
5204
5806
|
}
|
|
5205
5807
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
5206
5808
|
productLineUid: params.productLineUid
|
|
5207
5809
|
});
|
|
5208
|
-
case
|
|
5209
|
-
if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
5210
|
-
|
|
5810
|
+
case 61:
|
|
5811
|
+
if (!(editingLine && params.mode !== 'replace' && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
5812
|
+
_context54.next = 63;
|
|
5211
5813
|
break;
|
|
5212
5814
|
}
|
|
5213
5815
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -5215,15 +5817,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5215
5817
|
productLineProductId: (_editingLine$product_2 = editingLine.product_id) !== null && _editingLine$product_2 !== void 0 ? _editingLine$product_2 : editingLine.id,
|
|
5216
5818
|
candidateProductId: params.candidate.productId
|
|
5217
5819
|
});
|
|
5218
|
-
case
|
|
5820
|
+
case 63:
|
|
5219
5821
|
if (Array.isArray(params.requirementSelections)) {
|
|
5220
|
-
|
|
5822
|
+
_context54.next = 65;
|
|
5221
5823
|
break;
|
|
5222
5824
|
}
|
|
5223
5825
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
5224
5826
|
requirementSelections: params.requirementSelections
|
|
5225
5827
|
});
|
|
5226
|
-
case
|
|
5828
|
+
case 65:
|
|
5227
5829
|
baseProjection = projectionEntry.projection;
|
|
5228
5830
|
commitWriteGuard = {
|
|
5229
5831
|
contextId: normalizedContextId,
|
|
@@ -5234,11 +5836,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5234
5836
|
};
|
|
5235
5837
|
prepareParams = baseProjection.meta.prepareParams;
|
|
5236
5838
|
if (prepareParams) {
|
|
5237
|
-
|
|
5839
|
+
_context54.next = 70;
|
|
5238
5840
|
break;
|
|
5239
5841
|
}
|
|
5240
5842
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
5241
|
-
case
|
|
5843
|
+
case 70:
|
|
5242
5844
|
fallbackResources = {
|
|
5243
5845
|
resources: cloneDeep(_toConsumableArray(baseProjection.resources || [])),
|
|
5244
5846
|
resourceOccupancies: cloneDeep(_toConsumableArray(baseProjection.resourceOccupancies || []).filter(function (occupancy) {
|
|
@@ -5246,28 +5848,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5246
5848
|
})),
|
|
5247
5849
|
includesInjectedRawOccupancies: true
|
|
5248
5850
|
};
|
|
5249
|
-
|
|
5851
|
+
_context54.next = 73;
|
|
5250
5852
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
5251
|
-
editingProductLineUids:
|
|
5853
|
+
editingProductLineUids: isEditingSelection && params.productLineUid ? [params.productLineUid] : []
|
|
5252
5854
|
}), {
|
|
5253
5855
|
resourceFetchPolicy: 'cache_only',
|
|
5254
5856
|
fallbackResources: fallbackResources,
|
|
5255
5857
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
5256
5858
|
});
|
|
5257
|
-
case
|
|
5258
|
-
commitSnapshot =
|
|
5859
|
+
case 73:
|
|
5860
|
+
commitSnapshot = _context54.sent;
|
|
5259
5861
|
refreshedProjection = commitSnapshot.projection;
|
|
5260
5862
|
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 : ''))) {
|
|
5261
|
-
|
|
5863
|
+
_context54.next = 80;
|
|
5262
5864
|
break;
|
|
5263
5865
|
}
|
|
5264
|
-
|
|
5866
|
+
_context54.next = 78;
|
|
5265
5867
|
return this.refreshAvailabilityContextProjection({
|
|
5266
5868
|
contextId: normalizedContextId,
|
|
5267
5869
|
reason: 'commit_order_revision_changed',
|
|
5268
5870
|
previousOrderRevision: String((_baseProjection$meta$3 = baseProjection.meta.orderRevision) !== null && _baseProjection$meta$3 !== void 0 ? _baseProjection$meta$3 : '')
|
|
5269
5871
|
});
|
|
5270
|
-
case
|
|
5872
|
+
case 78:
|
|
5271
5873
|
latestContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
5272
5874
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '最终缓存重校验期间购物车已变化,请重新获取候选', {
|
|
5273
5875
|
contextId: normalizedContextId,
|
|
@@ -5278,11 +5880,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5278
5880
|
snapshotId: baseProjection.meta.snapshotId,
|
|
5279
5881
|
refreshedSnapshotId: refreshedProjection.meta.snapshotId
|
|
5280
5882
|
});
|
|
5281
|
-
case
|
|
5883
|
+
case 80:
|
|
5282
5884
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
5283
5885
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
5284
5886
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
5285
|
-
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$
|
|
5887
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos' && !strictAvailability;
|
|
5286
5888
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
5287
5889
|
productIds: [params.candidate.productId],
|
|
5288
5890
|
dateRange: {
|
|
@@ -5295,18 +5897,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5295
5897
|
durationStartTimesByProductId: _defineProperty({}, String(params.candidate.productId), [candidateStartTime])
|
|
5296
5898
|
}, allowPosAvailabilityOverride ? {
|
|
5297
5899
|
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
5298
|
-
} : {}) : {}) : {}), {
|
|
5900
|
+
} : {}) : {}) : {}), _objectSpread(_objectSpread({}, strictAvailability ? {
|
|
5901
|
+
evaluatedAt: this.getAvailabilityRuntimeDateTime()
|
|
5902
|
+
} : {}), {}, {
|
|
5299
5903
|
useExactDurationCandidateMinute: allowPosAvailabilityOverride,
|
|
5300
5904
|
allowSessionCustomRanges: allowPosAvailabilityOverride,
|
|
5301
5905
|
allowExcludedScheduleDateOverride: allowPosAvailabilityOverride
|
|
5302
|
-
}).flatMap(function (group) {
|
|
5906
|
+
})).flatMap(function (group) {
|
|
5303
5907
|
return group.ranges;
|
|
5304
5908
|
});
|
|
5305
5909
|
refreshedCandidateBase = refreshedRanges.find(function (candidate) {
|
|
5306
5910
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
5307
5911
|
});
|
|
5308
5912
|
if (refreshedCandidateBase) {
|
|
5309
|
-
|
|
5913
|
+
_context54.next = 88;
|
|
5310
5914
|
break;
|
|
5311
5915
|
}
|
|
5312
5916
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -5314,18 +5918,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5314
5918
|
candidate: params.candidate,
|
|
5315
5919
|
refreshedSnapshotId: refreshedProjection.meta.snapshotId
|
|
5316
5920
|
});
|
|
5317
|
-
case
|
|
5921
|
+
case 88:
|
|
5318
5922
|
product = refreshedProjection.products.find(function (item) {
|
|
5319
5923
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
5320
5924
|
});
|
|
5321
5925
|
if (product) {
|
|
5322
|
-
|
|
5926
|
+
_context54.next = 91;
|
|
5323
5927
|
break;
|
|
5324
5928
|
}
|
|
5325
5929
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
5326
5930
|
productId: refreshedCandidateBase.productId
|
|
5327
5931
|
});
|
|
5328
|
-
case
|
|
5932
|
+
case 91:
|
|
5329
5933
|
validation = validateAvailabilitySelection(refreshedProjection, {
|
|
5330
5934
|
candidate: refreshedCandidateBase,
|
|
5331
5935
|
requirementSelections: params.requirementSelections,
|
|
@@ -5356,7 +5960,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5356
5960
|
});
|
|
5357
5961
|
}
|
|
5358
5962
|
if (validation.ok) {
|
|
5359
|
-
|
|
5963
|
+
_context54.next = 96;
|
|
5360
5964
|
break;
|
|
5361
5965
|
}
|
|
5362
5966
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -5366,7 +5970,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5366
5970
|
validation: validation,
|
|
5367
5971
|
refreshedSnapshotId: refreshedProjection.meta.snapshotId
|
|
5368
5972
|
});
|
|
5369
|
-
case
|
|
5973
|
+
case 96:
|
|
5370
5974
|
// Revalidation failure must leave the caller's candidate reusable. Only publish the
|
|
5371
5975
|
// refreshed projection/version after candidate and resource validation has passed;
|
|
5372
5976
|
// otherwise a second Confirm from the still-open modal would incorrectly become stale.
|
|
@@ -5379,7 +5983,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5379
5983
|
incrementVersion: true
|
|
5380
5984
|
});
|
|
5381
5985
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
5382
|
-
|
|
5986
|
+
_context54.next = 100;
|
|
5383
5987
|
return this.emitAvailabilityDiagnostic({
|
|
5384
5988
|
action: 'refresh',
|
|
5385
5989
|
contextId: normalizedContextId,
|
|
@@ -5390,7 +5994,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5390
5994
|
previousOrderRevision: baseProjection.meta.orderRevision,
|
|
5391
5995
|
reason: 'commit_cached_occupancy_revalidation'
|
|
5392
5996
|
});
|
|
5393
|
-
case
|
|
5997
|
+
case 100:
|
|
5394
5998
|
commitWriteGuard = {
|
|
5395
5999
|
contextId: normalizedContextId,
|
|
5396
6000
|
expectedVersion: revalidatedContext.activeVersion,
|
|
@@ -5398,17 +6002,38 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5398
6002
|
expectedLifecycleGeneration: this.availabilityLifecycleGeneration,
|
|
5399
6003
|
expectedOrderRevision: revalidationEntry.orderRevision
|
|
5400
6004
|
};
|
|
5401
|
-
refreshedCandidate = this.decorateAvailabilityCandidate(normalizedContextId, revalidatedContext.activeVersion, refreshedCandidateBase);
|
|
6005
|
+
refreshedCandidate = this.decorateAvailabilityCandidate(normalizedContextId, revalidatedContext.activeVersion, refreshedCandidateBase); // Order may await line/runtime setup. Its guarded transaction invokes this
|
|
6006
|
+
// again immediately before publishing, while the live cart is unchanged.
|
|
6007
|
+
availabilityCommitGuard = hasCommitGuard ? function () {
|
|
6008
|
+
var _params$availabilityC3;
|
|
6009
|
+
(_params$availabilityC3 = params.availabilityCommitGuard) === null || _params$availabilityC3 === void 0 || _params$availabilityC3.call(params);
|
|
6010
|
+
_this18.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
6011
|
+
if (!availabilityCommitTargetGuard()) {
|
|
6012
|
+
throw _this18.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '预约加购期间订单或业务已变化');
|
|
6013
|
+
}
|
|
6014
|
+
if (!strictAvailability) return;
|
|
6015
|
+
var currentValidation = validateAvailabilitySelection(refreshedProjection, {
|
|
6016
|
+
candidate: refreshedCandidateBase,
|
|
6017
|
+
requirementSelections: params.requirementSelections,
|
|
6018
|
+
partySize: partySize,
|
|
6019
|
+
bookingCount: bookingCount
|
|
6020
|
+
});
|
|
6021
|
+
if (!currentValidation.ok) {
|
|
6022
|
+
throw new AvailabilityError('REVALIDATION_FAILED', '所选时间在加购前已不可用,请重新选择', {
|
|
6023
|
+
validation: currentValidation
|
|
6024
|
+
});
|
|
6025
|
+
}
|
|
6026
|
+
} : undefined;
|
|
5402
6027
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
5403
6028
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
5404
|
-
if (!(
|
|
5405
|
-
|
|
6029
|
+
if (!(isEditingSelection && !existingBookingUid)) {
|
|
6030
|
+
_context54.next = 107;
|
|
5406
6031
|
break;
|
|
5407
6032
|
}
|
|
5408
6033
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
5409
6034
|
productLineUid: params.productLineUid
|
|
5410
6035
|
});
|
|
5411
|
-
case
|
|
6036
|
+
case 107:
|
|
5412
6037
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
5413
6038
|
booking = buildBookingFromAvailabilitySelection({
|
|
5414
6039
|
assignments: validation.assignments,
|
|
@@ -5416,34 +6041,75 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5416
6041
|
product: product,
|
|
5417
6042
|
resources: refreshedProjection.resources,
|
|
5418
6043
|
bookingUid: existingBookingUid || undefined,
|
|
5419
|
-
holder: (
|
|
5420
|
-
holderIds: (_ref55 = (
|
|
6044
|
+
holder: (_params$orderProduct$3 = (_params$orderProduct6 = params.orderProduct) === null || _params$orderProduct6 === void 0 || (_params$orderProduct6 = _params$orderProduct6._extend) === null || _params$orderProduct6 === void 0 ? void 0 : _params$orderProduct6.holder) !== null && _params$orderProduct$3 !== void 0 ? _params$orderProduct$3 : params.mode === 'replace' ? undefined : (_existingBooking$hold = existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _existingBooking$hold !== void 0 ? _existingBooking$hold : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
|
|
6045
|
+
holderIds: (_ref55 = (_params$orderProduct$4 = (_params$orderProduct7 = params.orderProduct) === null || _params$orderProduct7 === void 0 || (_params$orderProduct7 = _params$orderProduct7._extend) === null || _params$orderProduct7 === void 0 ? void 0 : _params$orderProduct7.holder_id) !== null && _params$orderProduct$4 !== void 0 ? _params$orderProduct$4 : (_params$orderProduct8 = params.orderProduct) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8._extend) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8.holder) === null || _params$orderProduct8 === void 0 ? void 0 : _params$orderProduct8.form_record) !== null && _ref55 !== void 0 ? _ref55 : params.mode === 'replace' ? undefined : (_existingBooking$meta2 = existingBooking === null || existingBooking === void 0 || (_existingBooking$meta3 = existingBooking.metadata) === null || _existingBooking$meta3 === void 0 ? void 0 : _existingBooking$meta3.holder_id) !== null && _existingBooking$meta2 !== void 0 ? _existingBooking$meta2 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold2 = existingBooking.holder) === null || _existingBooking$hold2 === void 0 ? void 0 : _existingBooking$hold2.form_record
|
|
5421
6046
|
});
|
|
6047
|
+
if (params.mode === 'replace') {
|
|
6048
|
+
// A different product must not inherit the previous product/resource's completed forms.
|
|
6049
|
+
booking.holder = booking.holder || null;
|
|
6050
|
+
booking.relation_forms = [];
|
|
6051
|
+
}
|
|
5422
6052
|
transformed = this.buildUnifiedOrderProduct(_objectSpread(_objectSpread({}, params.orderProduct), {}, {
|
|
5423
6053
|
num: bookingCount,
|
|
5424
6054
|
quantity: bookingCount
|
|
5425
6055
|
}), 'unified_booking_sales', product);
|
|
5426
6056
|
if (transformed) {
|
|
5427
|
-
|
|
6057
|
+
_context54.next = 113;
|
|
5428
6058
|
break;
|
|
5429
6059
|
}
|
|
5430
6060
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
5431
6061
|
orderProduct: params.orderProduct
|
|
5432
6062
|
});
|
|
5433
|
-
case
|
|
6063
|
+
case 113:
|
|
5434
6064
|
transformed.num = bookingCount;
|
|
5435
6065
|
transformed.metadata = _objectSpread(_objectSpread({}, transformed.metadata || {}), {}, {
|
|
5436
6066
|
unified_booking_sales: true,
|
|
5437
6067
|
availability_candidate_key: refreshedCandidate.key,
|
|
5438
6068
|
availability_context_id: normalizedContextId,
|
|
5439
6069
|
availability_context_version: refreshedCandidate.availabilityContextVersion
|
|
5440
|
-
})
|
|
6070
|
+
}, ['tickets', 'party_main'].includes((_transformed$metadata = transformed.metadata) === null || _transformed$metadata === void 0 ? void 0 : _transformed$metadata.venue_booking_role) ? {
|
|
6071
|
+
venue_booking_service_datetime: "".concat(booking.start_date, " ").concat(booking.start_time)
|
|
6072
|
+
} : {});
|
|
5441
6073
|
productLineUid = '';
|
|
5442
6074
|
bookingUid = '';
|
|
5443
6075
|
productLineUids = [];
|
|
5444
6076
|
bookingUids = [];
|
|
6077
|
+
if (!(isPartyReplacement && editingLine && params.productLineUid)) {
|
|
6078
|
+
_context54.next = 130;
|
|
6079
|
+
break;
|
|
6080
|
+
}
|
|
6081
|
+
relatedRetailProducts = params.relatedRetailProducts.map(function (source) {
|
|
6082
|
+
var line = _this18.buildUnifiedOrderProduct(source, 'unified_booking_sales_retail');
|
|
6083
|
+
if (!line) throw new AvailabilityError('INVALID_TARGET_FILTER', '无法生成附加商品订单行');
|
|
6084
|
+
// This is the only replacement-specific UID restore. Order checks ownership/collisions.
|
|
6085
|
+
var sourceUid = getProductLineUid(source);
|
|
6086
|
+
if (sourceUid) {
|
|
6087
|
+
line.metadata = _objectSpread(_objectSpread({}, line.metadata || {}), {}, {
|
|
6088
|
+
unique_identification_number: sourceUid
|
|
6089
|
+
});
|
|
6090
|
+
}
|
|
6091
|
+
return line;
|
|
6092
|
+
});
|
|
6093
|
+
_context54.next = 123;
|
|
6094
|
+
return this.store.order.replaceBookingProductWithRelatedRetail({
|
|
6095
|
+
productLineUid: params.productLineUid,
|
|
6096
|
+
product: transformed,
|
|
6097
|
+
booking: booking,
|
|
6098
|
+
relatedRetailProducts: relatedRetailProducts,
|
|
6099
|
+
availabilityCommitGuard: availabilityCommitGuard,
|
|
6100
|
+
availabilityCommitTargetGuard: availabilityCommitTargetGuard
|
|
6101
|
+
});
|
|
6102
|
+
case 123:
|
|
6103
|
+
guardedCommitPublished = true;
|
|
6104
|
+
productLineUid = params.productLineUid;
|
|
6105
|
+
bookingUid = existingBookingUid;
|
|
6106
|
+
productLineUids = [productLineUid];
|
|
6107
|
+
bookingUids = [bookingUid];
|
|
6108
|
+
_context54.next = 164;
|
|
6109
|
+
break;
|
|
6110
|
+
case 130:
|
|
5445
6111
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
5446
|
-
|
|
6112
|
+
_context54.next = 150;
|
|
5447
6113
|
break;
|
|
5448
6114
|
}
|
|
5449
6115
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -5453,10 +6119,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5453
6119
|
unique_identification_number: params.productLineUid,
|
|
5454
6120
|
booking_uid: existingBookingUid
|
|
5455
6121
|
});
|
|
5456
|
-
|
|
5457
|
-
return this.updateOrderProduct(_objectSpread(_objectSpread({
|
|
6122
|
+
update = _objectSpread(_objectSpread({
|
|
5458
6123
|
product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
|
|
5459
|
-
product_variant_id: (
|
|
6124
|
+
product_variant_id: (_ref56 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref56 !== void 0 ? _ref56 : 0,
|
|
5460
6125
|
unique_identification_number: params.productLineUid,
|
|
5461
6126
|
updates: transformed,
|
|
5462
6127
|
booking: booking
|
|
@@ -5464,27 +6129,48 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5464
6129
|
allow_booking_reprice: params.allowBookingReprice
|
|
5465
6130
|
} : {}), params.allowBookingDiscountReapply !== undefined ? {
|
|
5466
6131
|
allow_booking_discount_reapply: params.allowBookingDiscountReapply
|
|
5467
|
-
} : {})
|
|
5468
|
-
|
|
6132
|
+
} : {});
|
|
6133
|
+
if (!availabilityCommitGuard) {
|
|
6134
|
+
_context54.next = 142;
|
|
6135
|
+
break;
|
|
6136
|
+
}
|
|
6137
|
+
_context54.next = 139;
|
|
6138
|
+
return this.updateOrderProducts([update], {
|
|
6139
|
+
beforeApply: availabilityCommitGuard,
|
|
6140
|
+
isCurrentOrder: availabilityCommitTargetGuard
|
|
6141
|
+
});
|
|
6142
|
+
case 139:
|
|
6143
|
+
guardedCommitPublished = true;
|
|
6144
|
+
_context54.next = 144;
|
|
6145
|
+
break;
|
|
6146
|
+
case 142:
|
|
6147
|
+
_context54.next = 144;
|
|
6148
|
+
return this.updateOrderProduct(update);
|
|
6149
|
+
case 144:
|
|
5469
6150
|
productLineUid = params.productLineUid;
|
|
5470
6151
|
bookingUid = existingBookingUid;
|
|
5471
6152
|
productLineUids = [productLineUid];
|
|
5472
6153
|
bookingUids = [bookingUid];
|
|
5473
|
-
|
|
6154
|
+
_context54.next = 164;
|
|
5474
6155
|
break;
|
|
5475
|
-
case
|
|
5476
|
-
beforeProductLineUids = new Set((((_this$
|
|
6156
|
+
case 150:
|
|
6157
|
+
beforeProductLineUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || []).map(function (line) {
|
|
5477
6158
|
return getProductLineUid(line);
|
|
5478
6159
|
}).filter(Boolean));
|
|
5479
|
-
beforeBookingUids = new Set((((_this$
|
|
6160
|
+
beforeBookingUids = new Set((((_this$getTempOrder6 = this.getTempOrder()) === null || _this$getTempOrder6 === void 0 ? void 0 : _this$getTempOrder6.bookings) || []).map(function (item) {
|
|
5480
6161
|
return getBookingUid(item);
|
|
5481
6162
|
}).filter(Boolean));
|
|
5482
|
-
|
|
5483
|
-
|
|
6163
|
+
availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
|
|
6164
|
+
_context54.next = 155;
|
|
6165
|
+
return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length || availabilityCommitGuard ? _objectSpread(_objectSpread({}, (_params$salesNotes2 = params.salesNotes) !== null && _params$salesNotes2 !== void 0 && _params$salesNotes2.length ? {
|
|
5484
6166
|
salesNotes: params.salesNotes
|
|
5485
|
-
} :
|
|
5486
|
-
|
|
5487
|
-
|
|
6167
|
+
} : {}), availabilityCommitGuard ? {
|
|
6168
|
+
availabilityCommitGuard: availabilityCommitGuard,
|
|
6169
|
+
availabilityCommitTargetGuard: availabilityCommitTargetGuard
|
|
6170
|
+
} : {}) : undefined);
|
|
6171
|
+
case 155:
|
|
6172
|
+
products = _context54.sent;
|
|
6173
|
+
guardedCommitPublished = hasCommitGuard;
|
|
5488
6174
|
addedLines = products.filter(function (line) {
|
|
5489
6175
|
var _line$product_id, _line$metadata;
|
|
5490
6176
|
return sameAvailabilityId((_line$product_id = line.product_id) !== null && _line$product_id !== void 0 ? _line$product_id : line.id, refreshedCandidate.productId) && ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeProductLineUids.has(getProductLineUid(line));
|
|
@@ -5492,7 +6178,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5492
6178
|
productLineUids = addedLines.map(function (line) {
|
|
5493
6179
|
return getProductLineUid(line);
|
|
5494
6180
|
}).filter(Boolean);
|
|
5495
|
-
addedBookings = (((
|
|
6181
|
+
addedBookings = (((_ref57 = hasCommitGuard ? guardedOrder : this.getTempOrder()) === null || _ref57 === void 0 ? void 0 : _ref57.bookings) || []).filter(function (item) {
|
|
5496
6182
|
var _item$metadata;
|
|
5497
6183
|
return ((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeBookingUids.has(getBookingUid(item));
|
|
5498
6184
|
});
|
|
@@ -5507,13 +6193,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5507
6193
|
}
|
|
5508
6194
|
productLineUid = productLineUids[productLineUids.length - 1] || '';
|
|
5509
6195
|
bookingUid = bookingUids[bookingUids.length - 1] || '';
|
|
5510
|
-
case
|
|
5511
|
-
|
|
5512
|
-
|
|
6196
|
+
case 164:
|
|
6197
|
+
targetStillCurrent = !hasCommitGuard || availabilityCommitTargetGuard();
|
|
6198
|
+
if (targetStillCurrent) this.invalidateAvailabilityContextsAfterCommit();else this.removeAvailabilityContext(normalizedContextId);
|
|
6199
|
+
nextContext = hasCommitGuard ? this.availabilityContextRegistry.get(normalizedContextId) : this.getAvailabilityContextEntry(normalizedContextId);
|
|
5513
6200
|
result = {
|
|
5514
6201
|
contextId: normalizedContextId,
|
|
5515
|
-
contextVersion: nextContext.activeVersion,
|
|
5516
|
-
tempOrder: this.getTempOrder(),
|
|
6202
|
+
contextVersion: (_nextContext$activeVe = nextContext === null || nextContext === void 0 ? void 0 : nextContext.activeVersion) !== null && _nextContext$activeVe !== void 0 ? _nextContext$activeVe : refreshedCandidate.availabilityContextVersion,
|
|
6203
|
+
tempOrder: hasCommitGuard ? guardedOrder : this.getTempOrder(),
|
|
5517
6204
|
validation: validation,
|
|
5518
6205
|
candidate: refreshedCandidate,
|
|
5519
6206
|
productLineUid: productLineUid,
|
|
@@ -5521,23 +6208,61 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5521
6208
|
productLineUids: productLineUids,
|
|
5522
6209
|
bookingUids: bookingUids
|
|
5523
6210
|
};
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
6211
|
+
if (!targetStillCurrent) {
|
|
6212
|
+
_context54.next = 182;
|
|
6213
|
+
break;
|
|
6214
|
+
}
|
|
6215
|
+
// A notification failure after publication must not invite a duplicate add.
|
|
6216
|
+
emit = function emit() {
|
|
6217
|
+
return _this18.core.effects.emit("".concat(_this18.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
6218
|
+
};
|
|
6219
|
+
if (!guardedCommitPublished) {
|
|
6220
|
+
_context54.next = 180;
|
|
6221
|
+
break;
|
|
6222
|
+
}
|
|
6223
|
+
_context54.prev = 171;
|
|
6224
|
+
_context54.next = 174;
|
|
6225
|
+
return emit();
|
|
6226
|
+
case 174:
|
|
6227
|
+
_context54.next = 178;
|
|
6228
|
+
break;
|
|
6229
|
+
case 176:
|
|
6230
|
+
_context54.prev = 176;
|
|
6231
|
+
_context54.t0 = _context54["catch"](171);
|
|
6232
|
+
case 178:
|
|
6233
|
+
_context54.next = 182;
|
|
6234
|
+
break;
|
|
6235
|
+
case 180:
|
|
6236
|
+
_context54.next = 182;
|
|
6237
|
+
return emit();
|
|
6238
|
+
case 182:
|
|
6239
|
+
return _context54.abrupt("return", result);
|
|
6240
|
+
case 183:
|
|
6241
|
+
_context54.prev = 183;
|
|
6242
|
+
release = this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
6243
|
+
if (!guardedCommitPublished) {
|
|
6244
|
+
_context54.next = 190;
|
|
6245
|
+
break;
|
|
6246
|
+
}
|
|
6247
|
+
_context54.next = 188;
|
|
6248
|
+
return release.catch(function () {
|
|
6249
|
+
return undefined;
|
|
6250
|
+
});
|
|
6251
|
+
case 188:
|
|
6252
|
+
_context54.next = 192;
|
|
6253
|
+
break;
|
|
6254
|
+
case 190:
|
|
6255
|
+
_context54.next = 192;
|
|
6256
|
+
return release;
|
|
6257
|
+
case 192:
|
|
6258
|
+
return _context54.finish(183);
|
|
6259
|
+
case 193:
|
|
5535
6260
|
case "end":
|
|
5536
|
-
return
|
|
6261
|
+
return _context54.stop();
|
|
5537
6262
|
}
|
|
5538
|
-
},
|
|
6263
|
+
}, _callee54, this, [[18,, 183, 193], [171, 176]]);
|
|
5539
6264
|
}));
|
|
5540
|
-
function commitAvailabilitySelection(
|
|
6265
|
+
function commitAvailabilitySelection(_x40, _x41) {
|
|
5541
6266
|
return _commitAvailabilitySelection.apply(this, arguments);
|
|
5542
6267
|
}
|
|
5543
6268
|
return commitAvailabilitySelection;
|