@pisell/pisellos 2.3.171 → 2.3.173
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/model/strategy/adapter/promotion/index.js +0 -9
- 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/Payment/walletpass.js +32 -6
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +22 -1
- package/dist/solution/UnifiedBookingSales/index.js +910 -650
- package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- 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/Payment/walletpass.js +23 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.d.ts +22 -1
- package/lib/solution/UnifiedBookingSales/index.js +128 -1
- package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
- package/package.json +1 -1
|
@@ -38,8 +38,9 @@ import { cloneDeep } from 'lodash-es';
|
|
|
38
38
|
import { OpenDataModule } from "../../modules";
|
|
39
39
|
import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
|
|
40
40
|
import { cacheItemToBookingInput } from "../../modules/BookingContext/utils/cacheItemToBookingInput";
|
|
41
|
-
import { flexibleObj, getServiceTimes, getUsableTime, isProductFlexibleDuration, isSessionProduct } from "../../modules/BookingContext/utils";
|
|
42
|
-
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings } from "../../modules/OpenData";
|
|
41
|
+
import { flexibleObj, getServiceTimes, getUsableTime, isProductFlexibleDuration, isSessionProduct, isBookingProduct, isMultiDayProduct } from "../../modules/BookingContext/utils";
|
|
42
|
+
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeSalesSettings } from "../../modules/OpenData";
|
|
43
|
+
import { getBookingBoundary, getBookingHolderIds, normalizeBookingDateTime, resolveDefaultBookingStart } from "./salesSettings";
|
|
43
44
|
import { getScheduleStartEndTimePoints } from "../../modules/Schedule/getDateIsInSchedule";
|
|
44
45
|
import { AvailabilityError, createAvailabilityProjection, getDurationBusinessDate, getProductTimeRanges as getProjectionProductTimeRanges, queryAvailabilityProjection, validateAvailabilitySelection } from "../../modules/ResourcePlanner";
|
|
45
46
|
import { UnifiedBookingSalesHooks } from "./types";
|
|
@@ -50,8 +51,9 @@ import { addLocalCalendarDays, captureRuntimeOffsetMinutes, extractFixedOffsetMi
|
|
|
50
51
|
import { isCustomerUserPlatform, normalizeRuntimePlatform } from "../../utils/platform";
|
|
51
52
|
import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
52
53
|
export * from "./types";
|
|
54
|
+
export * from "./salesSettings";
|
|
53
55
|
export { AvailabilityError } from "../../modules/ResourcePlanner";
|
|
54
|
-
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability'];
|
|
56
|
+
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability', 'interface'];
|
|
55
57
|
function normalizePositiveInteger(value) {
|
|
56
58
|
var normalized = Number(value);
|
|
57
59
|
if (!Number.isInteger(normalized) || normalized <= 0) return undefined;
|
|
@@ -2774,39 +2776,297 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2774
2776
|
return _getOpenData.apply(this, arguments);
|
|
2775
2777
|
}
|
|
2776
2778
|
return getOpenData;
|
|
2777
|
-
}()
|
|
2779
|
+
}() /** One policy snapshot for all Sales 2.0 consumers. Network errors must reach the caller. */
|
|
2780
|
+
}, {
|
|
2781
|
+
key: "getSalesSettings",
|
|
2782
|
+
value: (function () {
|
|
2783
|
+
var _getSalesSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
2784
|
+
var _this$otherParams18;
|
|
2785
|
+
var config;
|
|
2786
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
2787
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2788
|
+
case 0:
|
|
2789
|
+
_context18.next = 2;
|
|
2790
|
+
return this.getOpenData();
|
|
2791
|
+
case 2:
|
|
2792
|
+
config = _context18.sent;
|
|
2793
|
+
if (config) {
|
|
2794
|
+
_context18.next = 5;
|
|
2795
|
+
break;
|
|
2796
|
+
}
|
|
2797
|
+
throw new Error('Sales settings are unavailable without a business context.');
|
|
2798
|
+
case 5:
|
|
2799
|
+
return _context18.abrupt("return", normalizeSalesSettings(config, (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform));
|
|
2800
|
+
case 6:
|
|
2801
|
+
case "end":
|
|
2802
|
+
return _context18.stop();
|
|
2803
|
+
}
|
|
2804
|
+
}, _callee18, this);
|
|
2805
|
+
}));
|
|
2806
|
+
function getSalesSettings() {
|
|
2807
|
+
return _getSalesSettings.apply(this, arguments);
|
|
2808
|
+
}
|
|
2809
|
+
return getSalesSettings;
|
|
2810
|
+
}())
|
|
2811
|
+
}, {
|
|
2812
|
+
key: "getLoadedSalesSettings",
|
|
2813
|
+
value: function getLoadedSalesSettings() {
|
|
2814
|
+
var _this$otherParams19;
|
|
2815
|
+
if (!this.runtimeOpenDataSnapshot) {
|
|
2816
|
+
throw new Error('Sales settings are not loaded. Call getSalesSettings before preparing a booking.');
|
|
2817
|
+
}
|
|
2818
|
+
return normalizeSalesSettings(this.runtimeOpenDataSnapshot, (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.platform);
|
|
2819
|
+
}
|
|
2820
|
+
}, {
|
|
2821
|
+
key: "getProductBookingsForScheduling",
|
|
2822
|
+
value: function getProductBookingsForScheduling() {
|
|
2823
|
+
var _this$getTempOrder,
|
|
2824
|
+
_this6 = this;
|
|
2825
|
+
var seen = new Set();
|
|
2826
|
+
return (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).flatMap(function (product) {
|
|
2827
|
+
var _product$metadata4;
|
|
2828
|
+
if (((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.product_add_schedule_time) != null || product.deleted_at) return [];
|
|
2829
|
+
var booking = _this6.findLinkedBooking(product);
|
|
2830
|
+
if (!booking || isFulfillmentTimingBooking(booking) || seen.has(booking)) return [];
|
|
2831
|
+
seen.add(booking);
|
|
2832
|
+
return [booking];
|
|
2833
|
+
});
|
|
2834
|
+
}
|
|
2835
|
+
}, {
|
|
2836
|
+
key: "shouldApplyMultipleBookingScheduling",
|
|
2837
|
+
value: function shouldApplyMultipleBookingScheduling() {
|
|
2838
|
+
var _this$otherParams20;
|
|
2839
|
+
var platform = normalizeRuntimePlatform((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.platform);
|
|
2840
|
+
return platform === 'pos' || platform === 'webpos';
|
|
2841
|
+
}
|
|
2842
|
+
}, {
|
|
2843
|
+
key: "resolveLoadedDefaultBookingStart",
|
|
2844
|
+
value: function resolveLoadedDefaultBookingStart(holderIds, fallback) {
|
|
2845
|
+
// Customer channels keep their entry default instead of following cart bookings.
|
|
2846
|
+
// Keep this callback installed so BookingContext cannot fall back to Board.
|
|
2847
|
+
if (!this.shouldApplyMultipleBookingScheduling()) return normalizeBookingDateTime(fallback);
|
|
2848
|
+
var settings = this.getLoadedSalesSettings();
|
|
2849
|
+
return resolveDefaultBookingStart({
|
|
2850
|
+
bookings: this.getProductBookingsForScheduling(),
|
|
2851
|
+
holderIds: holderIds,
|
|
2852
|
+
mode: settings.reservation.multipleBookingScheduling,
|
|
2853
|
+
fallback: fallback
|
|
2854
|
+
});
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
/** Used by the SKU flow after Holder changes, without changing an explicit user-selected time. */
|
|
2858
|
+
}, {
|
|
2859
|
+
key: "resolveDefaultBookingStart",
|
|
2860
|
+
value: (function () {
|
|
2861
|
+
var _resolveDefaultBookingStart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
|
|
2862
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
2863
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2864
|
+
case 0:
|
|
2865
|
+
if (this.shouldApplyMultipleBookingScheduling()) {
|
|
2866
|
+
_context19.next = 2;
|
|
2867
|
+
break;
|
|
2868
|
+
}
|
|
2869
|
+
return _context19.abrupt("return", normalizeBookingDateTime(params.fallback));
|
|
2870
|
+
case 2:
|
|
2871
|
+
_context19.next = 4;
|
|
2872
|
+
return this.getSalesSettings();
|
|
2873
|
+
case 4:
|
|
2874
|
+
return _context19.abrupt("return", this.resolveLoadedDefaultBookingStart(params.holderIds, params.fallback));
|
|
2875
|
+
case 5:
|
|
2876
|
+
case "end":
|
|
2877
|
+
return _context19.stop();
|
|
2878
|
+
}
|
|
2879
|
+
}, _callee19, this);
|
|
2880
|
+
}));
|
|
2881
|
+
function resolveDefaultBookingStart(_x10) {
|
|
2882
|
+
return _resolveDefaultBookingStart.apply(this, arguments);
|
|
2883
|
+
}
|
|
2884
|
+
return resolveDefaultBookingStart;
|
|
2885
|
+
}())
|
|
2886
|
+
}, {
|
|
2887
|
+
key: "buildBookingCalcContext",
|
|
2888
|
+
value: function buildBookingCalcContext(extra) {
|
|
2889
|
+
var _this7 = this;
|
|
2890
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "buildBookingCalcContext", this).call(this, extra)), {}, {
|
|
2891
|
+
resolveDefaultBookingStart: function resolveDefaultBookingStart(cacheItem, fallback) {
|
|
2892
|
+
var _extra$holderIds;
|
|
2893
|
+
return _this7.resolveLoadedDefaultBookingStart((_extra$holderIds = extra === null || extra === void 0 ? void 0 : extra.holderIds) !== null && _extra$holderIds !== void 0 ? _extra$holderIds : getBookingHolderIds(cacheItem), fallback);
|
|
2894
|
+
}
|
|
2895
|
+
});
|
|
2896
|
+
}
|
|
2897
|
+
}, {
|
|
2898
|
+
key: "buildAddProductCtx",
|
|
2899
|
+
value: function buildAddProductCtx(extra) {
|
|
2900
|
+
var _this8 = this;
|
|
2901
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "buildAddProductCtx", this).call(this, extra)), {}, {
|
|
2902
|
+
resolveDefaultBookingStart: function resolveDefaultBookingStart(cacheItem, fallback) {
|
|
2903
|
+
var _extra$holderIds2;
|
|
2904
|
+
return _this8.resolveLoadedDefaultBookingStart((_extra$holderIds2 = extra === null || extra === void 0 ? void 0 : extra.holderIds) !== null && _extra$holderIds2 !== void 0 ? _extra$holderIds2 : getBookingHolderIds(cacheItem), fallback);
|
|
2905
|
+
}
|
|
2906
|
+
});
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
/** Re-evaluate an automatic default after Holder enrichment, or restore a known explicit TimeBar start. */
|
|
2910
|
+
}, {
|
|
2911
|
+
key: "applyDefaultBookingStart",
|
|
2912
|
+
value: (function () {
|
|
2913
|
+
var _applyDefaultBookingStart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(cacheItem) {
|
|
2914
|
+
var _cacheItem$_extend, _cacheItem$_data, _options$holderIds, _ref34, _normalizeBookingDate, _cacheItem$_data2;
|
|
2915
|
+
var options,
|
|
2916
|
+
extend,
|
|
2917
|
+
currentStart,
|
|
2918
|
+
automaticStart,
|
|
2919
|
+
explicitStart,
|
|
2920
|
+
holderIds,
|
|
2921
|
+
fallback,
|
|
2922
|
+
nextStart,
|
|
2923
|
+
data,
|
|
2924
|
+
nextExtend,
|
|
2925
|
+
_i,
|
|
2926
|
+
_arr,
|
|
2927
|
+
key,
|
|
2928
|
+
shiftDays,
|
|
2929
|
+
_args20 = arguments;
|
|
2930
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2931
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2932
|
+
case 0:
|
|
2933
|
+
options = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
|
|
2934
|
+
if (this.shouldApplyMultipleBookingScheduling()) {
|
|
2935
|
+
_context20.next = 3;
|
|
2936
|
+
break;
|
|
2937
|
+
}
|
|
2938
|
+
return _context20.abrupt("return", cacheItem);
|
|
2939
|
+
case 3:
|
|
2940
|
+
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)) {
|
|
2941
|
+
_context20.next = 5;
|
|
2942
|
+
break;
|
|
2943
|
+
}
|
|
2944
|
+
return _context20.abrupt("return", cacheItem);
|
|
2945
|
+
case 5:
|
|
2946
|
+
extend = cacheItem._extend || {};
|
|
2947
|
+
currentStart = getBookingBoundary(extend, 'start');
|
|
2948
|
+
automaticStart = normalizeBookingDateTime((_cacheItem$_data = cacheItem._data) === null || _cacheItem$_data === void 0 ? void 0 : _cacheItem$_data.salesDefaultBookingStart);
|
|
2949
|
+
if (!(extend.start_time && (!automaticStart || !currentStart || dayjs(currentStart).valueOf() !== dayjs(automaticStart).valueOf()))) {
|
|
2950
|
+
_context20.next = 10;
|
|
2951
|
+
break;
|
|
2952
|
+
}
|
|
2953
|
+
return _context20.abrupt("return", cacheItem);
|
|
2954
|
+
case 10:
|
|
2955
|
+
explicitStart = normalizeBookingDateTime(options.explicitStart);
|
|
2956
|
+
if (!(options.explicitStart !== undefined && !explicitStart)) {
|
|
2957
|
+
_context20.next = 13;
|
|
2958
|
+
break;
|
|
2959
|
+
}
|
|
2960
|
+
throw new Error('The explicit booking start must be a valid date and time.');
|
|
2961
|
+
case 13:
|
|
2962
|
+
holderIds = (_options$holderIds = options.holderIds) !== null && _options$holderIds !== void 0 ? _options$holderIds : getBookingHolderIds(cacheItem);
|
|
2963
|
+
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() || ''));
|
|
2964
|
+
if (!(explicitStart !== null && explicitStart !== void 0)) {
|
|
2965
|
+
_context20.next = 19;
|
|
2966
|
+
break;
|
|
2967
|
+
}
|
|
2968
|
+
_context20.t0 = explicitStart;
|
|
2969
|
+
_context20.next = 22;
|
|
2970
|
+
break;
|
|
2971
|
+
case 19:
|
|
2972
|
+
_context20.next = 21;
|
|
2973
|
+
return this.resolveDefaultBookingStart({
|
|
2974
|
+
holderIds: holderIds,
|
|
2975
|
+
fallback: fallback
|
|
2976
|
+
});
|
|
2977
|
+
case 21:
|
|
2978
|
+
_context20.t0 = _context20.sent;
|
|
2979
|
+
case 22:
|
|
2980
|
+
nextStart = _context20.t0;
|
|
2981
|
+
if (nextStart) {
|
|
2982
|
+
_context20.next = 25;
|
|
2983
|
+
break;
|
|
2984
|
+
}
|
|
2985
|
+
return _context20.abrupt("return", cacheItem);
|
|
2986
|
+
case 25:
|
|
2987
|
+
if (!(currentStart && dayjs(nextStart).valueOf() === dayjs(currentStart).valueOf())) {
|
|
2988
|
+
_context20.next = 32;
|
|
2989
|
+
break;
|
|
2990
|
+
}
|
|
2991
|
+
if (explicitStart) {
|
|
2992
|
+
_context20.next = 28;
|
|
2993
|
+
break;
|
|
2994
|
+
}
|
|
2995
|
+
return _context20.abrupt("return", cacheItem);
|
|
2996
|
+
case 28:
|
|
2997
|
+
data = _objectSpread({}, cacheItem._data);
|
|
2998
|
+
delete data.salesDefaultBookingStart;
|
|
2999
|
+
delete data.salesDefaultBookingFallback;
|
|
3000
|
+
return _context20.abrupt("return", _objectSpread(_objectSpread({}, cacheItem), {}, {
|
|
3001
|
+
_data: data
|
|
3002
|
+
}));
|
|
3003
|
+
case 32:
|
|
3004
|
+
nextExtend = _objectSpread(_objectSpread({}, extend), {}, {
|
|
3005
|
+
start_date: nextStart.slice(0, 10),
|
|
3006
|
+
start_time: nextStart.slice(11)
|
|
3007
|
+
});
|
|
3008
|
+
for (_i = 0, _arr = ['startDate', 'endDate', 'end_time', 'resource', 'resources', 'availabilitySelection']; _i < _arr.length; _i++) {
|
|
3009
|
+
key = _arr[_i];
|
|
3010
|
+
delete nextExtend[key];
|
|
3011
|
+
}
|
|
3012
|
+
if (isMultiDayProduct(cacheItem) && currentStart && extend.end_date) {
|
|
3013
|
+
shiftDays = dayjs(nextStart.slice(0, 10)).diff(dayjs(currentStart.slice(0, 10)), 'day');
|
|
3014
|
+
nextExtend.end_date = dayjs(extend.end_date).add(shiftDays, 'day').format('YYYY-MM-DD');
|
|
3015
|
+
} else {
|
|
3016
|
+
delete nextExtend.end_date;
|
|
3017
|
+
}
|
|
3018
|
+
return _context20.abrupt("return", this.getProductExtend(_objectSpread(_objectSpread({}, cacheItem), {}, {
|
|
3019
|
+
_extend: nextExtend,
|
|
3020
|
+
_data: explicitStart ? {} : {
|
|
3021
|
+
salesDefaultBookingStart: nextStart,
|
|
3022
|
+
salesDefaultBookingFallback: fallback
|
|
3023
|
+
}
|
|
3024
|
+
}), {
|
|
3025
|
+
holderIds: holderIds
|
|
3026
|
+
}));
|
|
3027
|
+
case 36:
|
|
3028
|
+
case "end":
|
|
3029
|
+
return _context20.stop();
|
|
3030
|
+
}
|
|
3031
|
+
}, _callee20, this);
|
|
3032
|
+
}));
|
|
3033
|
+
function applyDefaultBookingStart(_x11) {
|
|
3034
|
+
return _applyDefaultBookingStart.apply(this, arguments);
|
|
3035
|
+
}
|
|
3036
|
+
return applyDefaultBookingStart;
|
|
3037
|
+
}())
|
|
2778
3038
|
}, {
|
|
2779
3039
|
key: "loadPickupTimingOpenData",
|
|
2780
3040
|
value: function () {
|
|
2781
|
-
var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2782
|
-
var
|
|
3041
|
+
var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(_force) {
|
|
3042
|
+
var _ref35, _this$otherParams$bus2, _this$otherParams21, _this$otherParams22;
|
|
2783
3043
|
var scope, businessCode, config;
|
|
2784
|
-
return _regeneratorRuntime().wrap(function
|
|
2785
|
-
while (1) switch (
|
|
3044
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
3045
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2786
3046
|
case 0:
|
|
2787
3047
|
scope = this.getPickupTimingScope();
|
|
2788
|
-
businessCode = String((
|
|
2789
|
-
|
|
3048
|
+
businessCode = String((_ref35 = (_this$otherParams$bus2 = (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.business_code) !== null && _ref35 !== void 0 ? _ref35 : '').trim();
|
|
3049
|
+
_context21.next = 4;
|
|
2790
3050
|
return this.loadOpenData({
|
|
2791
3051
|
businessCode: businessCode,
|
|
2792
3052
|
channel: this.getSubmitOrderSalesChannel()
|
|
2793
3053
|
});
|
|
2794
3054
|
case 4:
|
|
2795
|
-
config =
|
|
3055
|
+
config = _context21.sent;
|
|
2796
3056
|
if (!(scope !== this.getPickupTimingScope())) {
|
|
2797
|
-
|
|
3057
|
+
_context21.next = 7;
|
|
2798
3058
|
break;
|
|
2799
3059
|
}
|
|
2800
3060
|
throw new Error('Store settings changed. Please try again.');
|
|
2801
3061
|
case 7:
|
|
2802
|
-
return
|
|
3062
|
+
return _context21.abrupt("return", config);
|
|
2803
3063
|
case 8:
|
|
2804
3064
|
case "end":
|
|
2805
|
-
return
|
|
3065
|
+
return _context21.stop();
|
|
2806
3066
|
}
|
|
2807
|
-
},
|
|
3067
|
+
}, _callee21, this);
|
|
2808
3068
|
}));
|
|
2809
|
-
function loadPickupTimingOpenData(
|
|
3069
|
+
function loadPickupTimingOpenData(_x12) {
|
|
2810
3070
|
return _loadPickupTimingOpenData.apply(this, arguments);
|
|
2811
3071
|
}
|
|
2812
3072
|
return loadPickupTimingOpenData;
|
|
@@ -2821,19 +3081,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2821
3081
|
}, {
|
|
2822
3082
|
key: "fetchAllergyItemRuleConfigs",
|
|
2823
3083
|
value: function () {
|
|
2824
|
-
var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3084
|
+
var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(strategyModelIds) {
|
|
2825
3085
|
var _response$data, response, list;
|
|
2826
|
-
return _regeneratorRuntime().wrap(function
|
|
2827
|
-
while (1) switch (
|
|
3086
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
3087
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2828
3088
|
case 0:
|
|
2829
3089
|
if (strategyModelIds.length) {
|
|
2830
|
-
|
|
3090
|
+
_context22.next = 2;
|
|
2831
3091
|
break;
|
|
2832
3092
|
}
|
|
2833
|
-
return
|
|
3093
|
+
return _context22.abrupt("return", []);
|
|
2834
3094
|
case 2:
|
|
2835
|
-
|
|
2836
|
-
|
|
3095
|
+
_context22.prev = 2;
|
|
3096
|
+
_context22.next = 5;
|
|
2837
3097
|
return this.request.get('/promotion', {
|
|
2838
3098
|
skip: 1,
|
|
2839
3099
|
num: 99,
|
|
@@ -2841,28 +3101,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2841
3101
|
ids: strategyModelIds
|
|
2842
3102
|
});
|
|
2843
3103
|
case 5:
|
|
2844
|
-
response =
|
|
3104
|
+
response = _context22.sent;
|
|
2845
3105
|
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))) {
|
|
2846
|
-
|
|
3106
|
+
_context22.next = 8;
|
|
2847
3107
|
break;
|
|
2848
3108
|
}
|
|
2849
3109
|
throw new Error('[UnifiedBookingSales] 商品过敏策略加载失败');
|
|
2850
3110
|
case 8:
|
|
2851
3111
|
list = response.data.list;
|
|
2852
|
-
return
|
|
3112
|
+
return _context22.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
|
|
2853
3113
|
return item === null || item === void 0 ? void 0 : item.metadata;
|
|
2854
3114
|
})));
|
|
2855
3115
|
case 12:
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
throw
|
|
3116
|
+
_context22.prev = 12;
|
|
3117
|
+
_context22.t0 = _context22["catch"](2);
|
|
3118
|
+
throw _context22.t0;
|
|
2859
3119
|
case 15:
|
|
2860
3120
|
case "end":
|
|
2861
|
-
return
|
|
3121
|
+
return _context22.stop();
|
|
2862
3122
|
}
|
|
2863
|
-
},
|
|
3123
|
+
}, _callee22, this, [[2, 12]]);
|
|
2864
3124
|
}));
|
|
2865
|
-
function fetchAllergyItemRuleConfigs(
|
|
3125
|
+
function fetchAllergyItemRuleConfigs(_x13) {
|
|
2866
3126
|
return _fetchAllergyItemRuleConfigs.apply(this, arguments);
|
|
2867
3127
|
}
|
|
2868
3128
|
return fetchAllergyItemRuleConfigs;
|
|
@@ -2870,72 +3130,72 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2870
3130
|
}, {
|
|
2871
3131
|
key: "ensureAllergyItemRuleConfigsLoaded",
|
|
2872
3132
|
value: function () {
|
|
2873
|
-
var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2874
|
-
var
|
|
2875
|
-
return _regeneratorRuntime().wrap(function
|
|
2876
|
-
while (1) switch (
|
|
3133
|
+
var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
3134
|
+
var _this9 = this;
|
|
3135
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
3136
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2877
3137
|
case 0:
|
|
2878
3138
|
if (!(this.allergyItemRuleConfigs.length > 0)) {
|
|
2879
|
-
|
|
3139
|
+
_context24.next = 2;
|
|
2880
3140
|
break;
|
|
2881
3141
|
}
|
|
2882
|
-
return
|
|
3142
|
+
return _context24.abrupt("return", this.allergyItemRuleConfigs);
|
|
2883
3143
|
case 2:
|
|
2884
3144
|
if (!this.allergyItemRuleConfigsPromise) {
|
|
2885
|
-
|
|
3145
|
+
_context24.next = 4;
|
|
2886
3146
|
break;
|
|
2887
3147
|
}
|
|
2888
|
-
return
|
|
3148
|
+
return _context24.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
2889
3149
|
case 4:
|
|
2890
|
-
this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2891
|
-
var
|
|
3150
|
+
this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
3151
|
+
var _this9$otherParams;
|
|
2892
3152
|
var staticConfigs, openData, enabled, strategyModelIds, loaded;
|
|
2893
|
-
return _regeneratorRuntime().wrap(function
|
|
2894
|
-
while (1) switch (
|
|
3153
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
3154
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2895
3155
|
case 0:
|
|
2896
|
-
staticConfigs = normalizeItemRuleStrategyConfigs((
|
|
3156
|
+
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);
|
|
2897
3157
|
if (!(staticConfigs.length > 0)) {
|
|
2898
|
-
|
|
3158
|
+
_context23.next = 5;
|
|
2899
3159
|
break;
|
|
2900
3160
|
}
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
return
|
|
3161
|
+
_this9.allergyItemRuleConfigs = staticConfigs;
|
|
3162
|
+
_this9.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
3163
|
+
return _context23.abrupt("return", staticConfigs);
|
|
2904
3164
|
case 5:
|
|
2905
|
-
|
|
2906
|
-
return
|
|
3165
|
+
_context23.next = 7;
|
|
3166
|
+
return _this9.getOpenData();
|
|
2907
3167
|
case 7:
|
|
2908
|
-
openData =
|
|
3168
|
+
openData = _context23.sent;
|
|
2909
3169
|
enabled = toConfiguredBoolean(openData === null || openData === void 0 ? void 0 : openData['sale.enable_item_rules']);
|
|
2910
3170
|
strategyModelIds = normalizePositiveIntegerList(openData === null || openData === void 0 ? void 0 : openData['sale.enabled_item_rules']);
|
|
2911
3171
|
if (!(!enabled || !strategyModelIds.length)) {
|
|
2912
|
-
|
|
3172
|
+
_context23.next = 13;
|
|
2913
3173
|
break;
|
|
2914
3174
|
}
|
|
2915
|
-
|
|
2916
|
-
return
|
|
3175
|
+
_this9.allergyItemRuleEvaluator.setStrategyConfigs([]);
|
|
3176
|
+
return _context23.abrupt("return", []);
|
|
2917
3177
|
case 13:
|
|
2918
|
-
|
|
2919
|
-
return
|
|
3178
|
+
_context23.next = 15;
|
|
3179
|
+
return _this9.fetchAllergyItemRuleConfigs(strategyModelIds);
|
|
2920
3180
|
case 15:
|
|
2921
|
-
loaded =
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
return
|
|
3181
|
+
loaded = _context23.sent;
|
|
3182
|
+
_this9.allergyItemRuleConfigs = loaded;
|
|
3183
|
+
_this9.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
|
|
3184
|
+
return _context23.abrupt("return", loaded);
|
|
2925
3185
|
case 19:
|
|
2926
3186
|
case "end":
|
|
2927
|
-
return
|
|
3187
|
+
return _context23.stop();
|
|
2928
3188
|
}
|
|
2929
|
-
},
|
|
3189
|
+
}, _callee23);
|
|
2930
3190
|
}))().catch(function () {
|
|
2931
3191
|
return [];
|
|
2932
3192
|
});
|
|
2933
|
-
return
|
|
3193
|
+
return _context24.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
2934
3194
|
case 6:
|
|
2935
3195
|
case "end":
|
|
2936
|
-
return
|
|
3196
|
+
return _context24.stop();
|
|
2937
3197
|
}
|
|
2938
|
-
},
|
|
3198
|
+
}, _callee24, this);
|
|
2939
3199
|
}));
|
|
2940
3200
|
function ensureAllergyItemRuleConfigsLoaded() {
|
|
2941
3201
|
return _ensureAllergyItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -2949,51 +3209,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2949
3209
|
}, {
|
|
2950
3210
|
key: "resolveProductAllergyRequirement",
|
|
2951
3211
|
value: (function () {
|
|
2952
|
-
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2953
|
-
var _this$
|
|
3212
|
+
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
3213
|
+
var _this$otherParams23, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref38, _runtimeConfig$servic, _this$otherParams24, _ref39, _ref40, _params$channel, _this$otherParams25, _this$otherParams26, _runtimeConfig$submis;
|
|
2954
3214
|
var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
|
|
2955
|
-
return _regeneratorRuntime().wrap(function
|
|
2956
|
-
while (1) switch (
|
|
3215
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
3216
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2957
3217
|
case 0:
|
|
2958
3218
|
productId = normalizePositiveInteger(params.productId);
|
|
2959
3219
|
if (productId) {
|
|
2960
|
-
|
|
3220
|
+
_context25.next = 3;
|
|
2961
3221
|
break;
|
|
2962
3222
|
}
|
|
2963
|
-
return
|
|
3223
|
+
return _context25.abrupt("return", null);
|
|
2964
3224
|
case 3:
|
|
2965
|
-
|
|
3225
|
+
_context25.next = 5;
|
|
2966
3226
|
return this.ensureAllergyItemRuleConfigsLoaded();
|
|
2967
3227
|
case 5:
|
|
2968
|
-
strategyConfigs =
|
|
3228
|
+
strategyConfigs = _context25.sent;
|
|
2969
3229
|
if (strategyConfigs.length) {
|
|
2970
|
-
|
|
3230
|
+
_context25.next = 8;
|
|
2971
3231
|
break;
|
|
2972
3232
|
}
|
|
2973
|
-
return
|
|
3233
|
+
return _context25.abrupt("return", null);
|
|
2974
3234
|
case 8:
|
|
2975
3235
|
productVariantId = normalizePositiveInteger(params.productVariantId);
|
|
2976
|
-
runtimeConfig = ((_this$
|
|
3236
|
+
runtimeConfig = ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.itemRule) || {};
|
|
2977
3237
|
runtimePax = runtimeConfig.pax || {};
|
|
2978
3238
|
cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
|
|
2979
|
-
var _item$product_id, _item$product_variant,
|
|
3239
|
+
var _item$product_id, _item$product_variant, _ref37, _item$num;
|
|
2980
3240
|
return {
|
|
2981
3241
|
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),
|
|
2982
3242
|
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,
|
|
2983
|
-
quantity: Number((
|
|
3243
|
+
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)
|
|
2984
3244
|
};
|
|
2985
3245
|
}).filter(function (item) {
|
|
2986
3246
|
return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
|
|
2987
3247
|
});
|
|
2988
|
-
return
|
|
3248
|
+
return _context25.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
|
|
2989
3249
|
pax: {
|
|
2990
3250
|
total: Number((_runtimePax$total = runtimePax.total) !== null && _runtimePax$total !== void 0 ? _runtimePax$total : 0) || 0,
|
|
2991
3251
|
adult: Number((_runtimePax$adult = runtimePax.adult) !== null && _runtimePax$adult !== void 0 ? _runtimePax$adult : 0) || 0,
|
|
2992
3252
|
child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
|
|
2993
3253
|
},
|
|
2994
3254
|
cartItems: cartItems,
|
|
2995
|
-
serviceType: String((
|
|
2996
|
-
channel: String((
|
|
3255
|
+
serviceType: String((_ref38 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.serviceType) !== null && _ref38 !== void 0 ? _ref38 : ''),
|
|
3256
|
+
channel: String((_ref39 = (_ref40 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.channel) !== null && _ref40 !== void 0 ? _ref40 : (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform) !== null && _ref39 !== void 0 ? _ref39 : ''),
|
|
2997
3257
|
currentProduct: _objectSpread({
|
|
2998
3258
|
product_id: productId
|
|
2999
3259
|
}, productVariantId ? {
|
|
@@ -3005,11 +3265,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3005
3265
|
}));
|
|
3006
3266
|
case 13:
|
|
3007
3267
|
case "end":
|
|
3008
|
-
return
|
|
3268
|
+
return _context25.stop();
|
|
3009
3269
|
}
|
|
3010
|
-
},
|
|
3270
|
+
}, _callee25, this);
|
|
3011
3271
|
}));
|
|
3012
|
-
function resolveProductAllergyRequirement(
|
|
3272
|
+
function resolveProductAllergyRequirement(_x14) {
|
|
3013
3273
|
return _resolveProductAllergyRequirement.apply(this, arguments);
|
|
3014
3274
|
}
|
|
3015
3275
|
return resolveProductAllergyRequirement;
|
|
@@ -3023,27 +3283,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3023
3283
|
}, {
|
|
3024
3284
|
key: "getInvoiceLayoutConfig",
|
|
3025
3285
|
value: function () {
|
|
3026
|
-
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3286
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
3027
3287
|
var openData;
|
|
3028
|
-
return _regeneratorRuntime().wrap(function
|
|
3029
|
-
while (1) switch (
|
|
3288
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3289
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
3030
3290
|
case 0:
|
|
3031
|
-
|
|
3291
|
+
_context26.next = 2;
|
|
3032
3292
|
return this.getOpenData();
|
|
3033
3293
|
case 2:
|
|
3034
|
-
openData =
|
|
3294
|
+
openData = _context26.sent;
|
|
3035
3295
|
if (!(!openData || !this.store.openData)) {
|
|
3036
|
-
|
|
3296
|
+
_context26.next = 5;
|
|
3037
3297
|
break;
|
|
3038
3298
|
}
|
|
3039
|
-
return
|
|
3299
|
+
return _context26.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
3040
3300
|
case 5:
|
|
3041
|
-
return
|
|
3301
|
+
return _context26.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
3042
3302
|
case 6:
|
|
3043
3303
|
case "end":
|
|
3044
|
-
return
|
|
3304
|
+
return _context26.stop();
|
|
3045
3305
|
}
|
|
3046
|
-
},
|
|
3306
|
+
}, _callee26, this);
|
|
3047
3307
|
}));
|
|
3048
3308
|
function getInvoiceLayoutConfig() {
|
|
3049
3309
|
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
@@ -3053,27 +3313,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3053
3313
|
}, {
|
|
3054
3314
|
key: "getInvoiceTemplateSettings",
|
|
3055
3315
|
value: function () {
|
|
3056
|
-
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3316
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
3057
3317
|
var openData;
|
|
3058
|
-
return _regeneratorRuntime().wrap(function
|
|
3059
|
-
while (1) switch (
|
|
3318
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3319
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
3060
3320
|
case 0:
|
|
3061
|
-
|
|
3321
|
+
_context27.next = 2;
|
|
3062
3322
|
return this.getOpenData();
|
|
3063
3323
|
case 2:
|
|
3064
|
-
openData =
|
|
3324
|
+
openData = _context27.sent;
|
|
3065
3325
|
if (!(!openData || !this.store.openData)) {
|
|
3066
|
-
|
|
3326
|
+
_context27.next = 5;
|
|
3067
3327
|
break;
|
|
3068
3328
|
}
|
|
3069
|
-
return
|
|
3329
|
+
return _context27.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
3070
3330
|
case 5:
|
|
3071
|
-
return
|
|
3331
|
+
return _context27.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
3072
3332
|
case 6:
|
|
3073
3333
|
case "end":
|
|
3074
|
-
return
|
|
3334
|
+
return _context27.stop();
|
|
3075
3335
|
}
|
|
3076
|
-
},
|
|
3336
|
+
}, _callee27, this);
|
|
3077
3337
|
}));
|
|
3078
3338
|
function getInvoiceTemplateSettings() {
|
|
3079
3339
|
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
@@ -3083,9 +3343,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3083
3343
|
}, {
|
|
3084
3344
|
key: "isInvoiceOpenDataCacheCurrent",
|
|
3085
3345
|
value: function isInvoiceOpenDataCacheCurrent() {
|
|
3086
|
-
var _this$
|
|
3087
|
-
var businessCode = String(((_this$
|
|
3088
|
-
var channel = String(((_this$
|
|
3346
|
+
var _this$otherParams27, _this$otherParams28;
|
|
3347
|
+
var businessCode = String(((_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.businessCode) || '').trim();
|
|
3348
|
+
var channel = String(((_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.channel) || '').trim();
|
|
3089
3349
|
if (!businessCode || !channel) return false;
|
|
3090
3350
|
return this.openDataTarget === "".concat(businessCode, "+").concat(channel) && this.runtimeOpenDataScope === this.getRuntimeOpenDataScope();
|
|
3091
3351
|
}
|
|
@@ -3096,14 +3356,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3096
3356
|
}, {
|
|
3097
3357
|
key: "getProtocol",
|
|
3098
3358
|
value: (function () {
|
|
3099
|
-
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3359
|
+
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(policyId) {
|
|
3100
3360
|
var normalizedPolicyId, policyUrl;
|
|
3101
|
-
return _regeneratorRuntime().wrap(function
|
|
3102
|
-
while (1) switch (
|
|
3361
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3362
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3103
3363
|
case 0:
|
|
3104
3364
|
normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
|
|
3105
3365
|
if (normalizedPolicyId) {
|
|
3106
|
-
|
|
3366
|
+
_context28.next = 3;
|
|
3107
3367
|
break;
|
|
3108
3368
|
}
|
|
3109
3369
|
throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
|
|
@@ -3112,14 +3372,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3112
3372
|
if (this.otherParams.platform === 'kiosk' || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
|
|
3113
3373
|
policyUrl = 'policy';
|
|
3114
3374
|
}
|
|
3115
|
-
return
|
|
3375
|
+
return _context28.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
|
|
3116
3376
|
case 6:
|
|
3117
3377
|
case "end":
|
|
3118
|
-
return
|
|
3378
|
+
return _context28.stop();
|
|
3119
3379
|
}
|
|
3120
|
-
},
|
|
3380
|
+
}, _callee28, this);
|
|
3121
3381
|
}));
|
|
3122
|
-
function getProtocol(
|
|
3382
|
+
function getProtocol(_x15) {
|
|
3123
3383
|
return _getProtocol.apply(this, arguments);
|
|
3124
3384
|
}
|
|
3125
3385
|
return getProtocol;
|
|
@@ -3132,27 +3392,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3132
3392
|
}, {
|
|
3133
3393
|
key: "loadProducts",
|
|
3134
3394
|
value: (function () {
|
|
3135
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3395
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
3136
3396
|
var params,
|
|
3137
3397
|
options,
|
|
3138
3398
|
schedule_date,
|
|
3139
3399
|
schedule_datetime,
|
|
3140
3400
|
result,
|
|
3141
|
-
|
|
3142
|
-
return _regeneratorRuntime().wrap(function
|
|
3143
|
-
while (1) switch (
|
|
3401
|
+
_args29 = arguments;
|
|
3402
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3403
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3144
3404
|
case 0:
|
|
3145
|
-
params =
|
|
3146
|
-
options =
|
|
3405
|
+
params = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
|
|
3406
|
+
options = _args29.length > 1 ? _args29[1] : undefined;
|
|
3147
3407
|
if (this.store.products) {
|
|
3148
|
-
|
|
3408
|
+
_context29.next = 4;
|
|
3149
3409
|
break;
|
|
3150
3410
|
}
|
|
3151
3411
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
3152
3412
|
case 4:
|
|
3153
3413
|
schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
3154
3414
|
schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
3155
|
-
|
|
3415
|
+
_context29.next = 8;
|
|
3156
3416
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
3157
3417
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
3158
3418
|
with_schedule: 1
|
|
@@ -3162,17 +3422,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3162
3422
|
cacheId: this.cacheId
|
|
3163
3423
|
}), options);
|
|
3164
3424
|
case 8:
|
|
3165
|
-
result =
|
|
3425
|
+
result = _context29.sent;
|
|
3166
3426
|
this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
3167
|
-
|
|
3427
|
+
_context29.next = 12;
|
|
3168
3428
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
|
|
3169
3429
|
case 12:
|
|
3170
|
-
return
|
|
3430
|
+
return _context29.abrupt("return", result);
|
|
3171
3431
|
case 13:
|
|
3172
3432
|
case "end":
|
|
3173
|
-
return
|
|
3433
|
+
return _context29.stop();
|
|
3174
3434
|
}
|
|
3175
|
-
},
|
|
3435
|
+
}, _callee29, this);
|
|
3176
3436
|
}));
|
|
3177
3437
|
function loadProducts() {
|
|
3178
3438
|
return _loadProducts.apply(this, arguments);
|
|
@@ -3182,25 +3442,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3182
3442
|
}, {
|
|
3183
3443
|
key: "queryProducts",
|
|
3184
3444
|
value: function () {
|
|
3185
|
-
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3445
|
+
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
3186
3446
|
var params,
|
|
3187
|
-
|
|
3188
|
-
return _regeneratorRuntime().wrap(function
|
|
3189
|
-
while (1) switch (
|
|
3447
|
+
_args30 = arguments;
|
|
3448
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3449
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3190
3450
|
case 0:
|
|
3191
|
-
params =
|
|
3451
|
+
params = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
|
|
3192
3452
|
if (this.store.products) {
|
|
3193
|
-
|
|
3453
|
+
_context30.next = 3;
|
|
3194
3454
|
break;
|
|
3195
3455
|
}
|
|
3196
3456
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
3197
3457
|
case 3:
|
|
3198
|
-
return
|
|
3458
|
+
return _context30.abrupt("return", this.store.products.queryProducts(params));
|
|
3199
3459
|
case 4:
|
|
3200
3460
|
case "end":
|
|
3201
|
-
return
|
|
3461
|
+
return _context30.stop();
|
|
3202
3462
|
}
|
|
3203
|
-
},
|
|
3463
|
+
}, _callee30, this);
|
|
3204
3464
|
}));
|
|
3205
3465
|
function queryProducts() {
|
|
3206
3466
|
return _queryProducts.apply(this, arguments);
|
|
@@ -3210,24 +3470,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3210
3470
|
}, {
|
|
3211
3471
|
key: "loadScheduleAvailableDate",
|
|
3212
3472
|
value: (function () {
|
|
3213
|
-
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3214
|
-
return _regeneratorRuntime().wrap(function
|
|
3215
|
-
while (1) switch (
|
|
3473
|
+
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3474
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3475
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3216
3476
|
case 0:
|
|
3217
3477
|
if (this.store.schedule) {
|
|
3218
|
-
|
|
3478
|
+
_context31.next = 2;
|
|
3219
3479
|
break;
|
|
3220
3480
|
}
|
|
3221
3481
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
3222
3482
|
case 2:
|
|
3223
|
-
return
|
|
3483
|
+
return _context31.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
|
|
3224
3484
|
case 3:
|
|
3225
3485
|
case "end":
|
|
3226
|
-
return
|
|
3486
|
+
return _context31.stop();
|
|
3227
3487
|
}
|
|
3228
|
-
},
|
|
3488
|
+
}, _callee31, this);
|
|
3229
3489
|
}));
|
|
3230
|
-
function loadScheduleAvailableDate(
|
|
3490
|
+
function loadScheduleAvailableDate(_x16) {
|
|
3231
3491
|
return _loadScheduleAvailableDate.apply(this, arguments);
|
|
3232
3492
|
}
|
|
3233
3493
|
return loadScheduleAvailableDate;
|
|
@@ -3241,15 +3501,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3241
3501
|
}, {
|
|
3242
3502
|
key: "loadProductsByScheduleDate",
|
|
3243
3503
|
value: (function () {
|
|
3244
|
-
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3504
|
+
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3245
3505
|
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;
|
|
3246
3506
|
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator2, _step2, productId, result;
|
|
3247
|
-
return _regeneratorRuntime().wrap(function
|
|
3248
|
-
while (1) switch (
|
|
3507
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3508
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3249
3509
|
case 0:
|
|
3250
3510
|
date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
|
|
3251
3511
|
if (this.store.schedule) {
|
|
3252
|
-
|
|
3512
|
+
_context32.next = 3;
|
|
3253
3513
|
break;
|
|
3254
3514
|
}
|
|
3255
3515
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
@@ -3260,10 +3520,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3260
3520
|
});
|
|
3261
3521
|
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;
|
|
3262
3522
|
if (!(!hasCachedDate && !hasOtherProducts)) {
|
|
3263
|
-
|
|
3523
|
+
_context32.next = 9;
|
|
3264
3524
|
break;
|
|
3265
3525
|
}
|
|
3266
|
-
|
|
3526
|
+
_context32.next = 9;
|
|
3267
3527
|
return this.loadScheduleAvailableDate({
|
|
3268
3528
|
startDate: date,
|
|
3269
3529
|
endDate: date,
|
|
@@ -3283,45 +3543,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3283
3543
|
return !productIdFilter || productIdFilter.has(String(id));
|
|
3284
3544
|
});
|
|
3285
3545
|
if (availableProductIds.length) {
|
|
3286
|
-
|
|
3546
|
+
_context32.next = 17;
|
|
3287
3547
|
break;
|
|
3288
3548
|
}
|
|
3289
3549
|
this.unifiedProductCatalog = [];
|
|
3290
|
-
|
|
3550
|
+
_context32.next = 16;
|
|
3291
3551
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
|
|
3292
3552
|
case 16:
|
|
3293
|
-
return
|
|
3553
|
+
return _context32.abrupt("return", []);
|
|
3294
3554
|
case 17:
|
|
3295
|
-
|
|
3555
|
+
_context32.next = 19;
|
|
3296
3556
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
3297
3557
|
product_ids: availableProductIds,
|
|
3298
3558
|
schedule_date: date
|
|
3299
3559
|
}));
|
|
3300
3560
|
case 19:
|
|
3301
|
-
products =
|
|
3561
|
+
products = _context32.sent;
|
|
3302
3562
|
if (!(products.length || availableProductIds.length <= 1)) {
|
|
3303
|
-
|
|
3563
|
+
_context32.next = 22;
|
|
3304
3564
|
break;
|
|
3305
3565
|
}
|
|
3306
|
-
return
|
|
3566
|
+
return _context32.abrupt("return", products);
|
|
3307
3567
|
case 22:
|
|
3308
3568
|
fallbackProducts = [];
|
|
3309
3569
|
_iterator2 = _createForOfIteratorHelper(availableProductIds);
|
|
3310
|
-
|
|
3570
|
+
_context32.prev = 24;
|
|
3311
3571
|
_iterator2.s();
|
|
3312
3572
|
case 26:
|
|
3313
3573
|
if ((_step2 = _iterator2.n()).done) {
|
|
3314
|
-
|
|
3574
|
+
_context32.next = 34;
|
|
3315
3575
|
break;
|
|
3316
3576
|
}
|
|
3317
3577
|
productId = _step2.value;
|
|
3318
|
-
|
|
3578
|
+
_context32.next = 30;
|
|
3319
3579
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
3320
3580
|
product_ids: [productId],
|
|
3321
3581
|
schedule_date: date
|
|
3322
3582
|
}));
|
|
3323
3583
|
case 30:
|
|
3324
|
-
result =
|
|
3584
|
+
result = _context32.sent;
|
|
3325
3585
|
result.forEach(function (product) {
|
|
3326
3586
|
var _id;
|
|
3327
3587
|
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;
|
|
@@ -3333,32 +3593,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3333
3593
|
}
|
|
3334
3594
|
});
|
|
3335
3595
|
case 32:
|
|
3336
|
-
|
|
3596
|
+
_context32.next = 26;
|
|
3337
3597
|
break;
|
|
3338
3598
|
case 34:
|
|
3339
|
-
|
|
3599
|
+
_context32.next = 39;
|
|
3340
3600
|
break;
|
|
3341
3601
|
case 36:
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
_iterator2.e(
|
|
3602
|
+
_context32.prev = 36;
|
|
3603
|
+
_context32.t0 = _context32["catch"](24);
|
|
3604
|
+
_iterator2.e(_context32.t0);
|
|
3345
3605
|
case 39:
|
|
3346
|
-
|
|
3606
|
+
_context32.prev = 39;
|
|
3347
3607
|
_iterator2.f();
|
|
3348
|
-
return
|
|
3608
|
+
return _context32.finish(39);
|
|
3349
3609
|
case 42:
|
|
3350
3610
|
this.unifiedProductCatalog = [].concat(fallbackProducts);
|
|
3351
|
-
|
|
3611
|
+
_context32.next = 45;
|
|
3352
3612
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
|
|
3353
3613
|
case 45:
|
|
3354
|
-
return
|
|
3614
|
+
return _context32.abrupt("return", fallbackProducts);
|
|
3355
3615
|
case 46:
|
|
3356
3616
|
case "end":
|
|
3357
|
-
return
|
|
3617
|
+
return _context32.stop();
|
|
3358
3618
|
}
|
|
3359
|
-
},
|
|
3619
|
+
}, _callee32, this, [[24, 36, 39, 42]]);
|
|
3360
3620
|
}));
|
|
3361
|
-
function loadProductsByScheduleDate(
|
|
3621
|
+
function loadProductsByScheduleDate(_x17) {
|
|
3362
3622
|
return _loadProductsByScheduleDate.apply(this, arguments);
|
|
3363
3623
|
}
|
|
3364
3624
|
return loadProductsByScheduleDate;
|
|
@@ -3411,7 +3671,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3411
3671
|
}, {
|
|
3412
3672
|
key: "applyPlannerDiscounts",
|
|
3413
3673
|
value: (function () {
|
|
3414
|
-
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3674
|
+
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
3415
3675
|
var _params$customerId;
|
|
3416
3676
|
var params,
|
|
3417
3677
|
tempOrder,
|
|
@@ -3428,24 +3688,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3428
3688
|
discount,
|
|
3429
3689
|
discountId,
|
|
3430
3690
|
nextTempOrder,
|
|
3431
|
-
|
|
3432
|
-
return _regeneratorRuntime().wrap(function
|
|
3433
|
-
while (1) switch (
|
|
3691
|
+
_args33 = arguments;
|
|
3692
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3693
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3434
3694
|
case 0:
|
|
3435
|
-
params =
|
|
3695
|
+
params = _args33.length > 0 && _args33[0] !== undefined ? _args33[0] : {};
|
|
3436
3696
|
tempOrder = this.getTempOrder();
|
|
3437
3697
|
requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
3438
3698
|
parsedCustomerId = Number(requestedCustomerId);
|
|
3439
3699
|
customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
|
|
3440
|
-
|
|
3700
|
+
_context33.next = 7;
|
|
3441
3701
|
return this.getSummary();
|
|
3442
3702
|
case 7:
|
|
3443
|
-
summaryBefore =
|
|
3703
|
+
summaryBefore = _context33.sent;
|
|
3444
3704
|
if (customerId) {
|
|
3445
|
-
|
|
3705
|
+
_context33.next = 10;
|
|
3446
3706
|
break;
|
|
3447
3707
|
}
|
|
3448
|
-
return
|
|
3708
|
+
return _context33.abrupt("return", buildPlannerDiscountResult({
|
|
3449
3709
|
customerId: null,
|
|
3450
3710
|
discountList: this.getDiscountList(),
|
|
3451
3711
|
products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
|
|
@@ -3454,7 +3714,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3454
3714
|
status: 'no_customer'
|
|
3455
3715
|
}));
|
|
3456
3716
|
case 10:
|
|
3457
|
-
|
|
3717
|
+
_context33.next = 12;
|
|
3458
3718
|
return this.loadDiscountConfig({
|
|
3459
3719
|
customerId: customerId,
|
|
3460
3720
|
action: 'create'
|
|
@@ -3466,7 +3726,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3466
3726
|
return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
|
|
3467
3727
|
});
|
|
3468
3728
|
if (!preferredDiscount) {
|
|
3469
|
-
|
|
3729
|
+
_context33.next = 40;
|
|
3470
3730
|
break;
|
|
3471
3731
|
}
|
|
3472
3732
|
// A requested card is an explicit UI choice, not a best-effort preference. Clear prior
|
|
@@ -3478,98 +3738,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3478
3738
|
return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
|
|
3479
3739
|
});
|
|
3480
3740
|
_iterator3 = _createForOfIteratorHelper(selectedOtherDiscounts);
|
|
3481
|
-
|
|
3741
|
+
_context33.prev = 18;
|
|
3482
3742
|
_iterator3.s();
|
|
3483
3743
|
case 20:
|
|
3484
3744
|
if ((_step3 = _iterator3.n()).done) {
|
|
3485
|
-
|
|
3745
|
+
_context33.next = 28;
|
|
3486
3746
|
break;
|
|
3487
3747
|
}
|
|
3488
3748
|
discount = _step3.value;
|
|
3489
3749
|
discountId = Number(resolvePlannerDiscountId(discount));
|
|
3490
3750
|
if (!Number.isFinite(discountId)) {
|
|
3491
|
-
|
|
3751
|
+
_context33.next = 26;
|
|
3492
3752
|
break;
|
|
3493
3753
|
}
|
|
3494
|
-
|
|
3754
|
+
_context33.next = 26;
|
|
3495
3755
|
return this.setDiscountSelected({
|
|
3496
3756
|
discountId: discountId,
|
|
3497
3757
|
isSelected: false
|
|
3498
3758
|
});
|
|
3499
3759
|
case 26:
|
|
3500
|
-
|
|
3760
|
+
_context33.next = 20;
|
|
3501
3761
|
break;
|
|
3502
3762
|
case 28:
|
|
3503
|
-
|
|
3763
|
+
_context33.next = 33;
|
|
3504
3764
|
break;
|
|
3505
3765
|
case 30:
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
_iterator3.e(
|
|
3766
|
+
_context33.prev = 30;
|
|
3767
|
+
_context33.t0 = _context33["catch"](18);
|
|
3768
|
+
_iterator3.e(_context33.t0);
|
|
3509
3769
|
case 33:
|
|
3510
|
-
|
|
3770
|
+
_context33.prev = 33;
|
|
3511
3771
|
_iterator3.f();
|
|
3512
|
-
return
|
|
3772
|
+
return _context33.finish(33);
|
|
3513
3773
|
case 36:
|
|
3514
|
-
|
|
3774
|
+
_context33.next = 38;
|
|
3515
3775
|
return this.setDiscountSelected({
|
|
3516
3776
|
discountId: Number(preferredId),
|
|
3517
3777
|
isSelected: true
|
|
3518
3778
|
});
|
|
3519
3779
|
case 38:
|
|
3520
|
-
|
|
3780
|
+
_context33.next = 49;
|
|
3521
3781
|
break;
|
|
3522
3782
|
case 40:
|
|
3523
3783
|
if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
|
|
3524
|
-
|
|
3784
|
+
_context33.next = 46;
|
|
3525
3785
|
break;
|
|
3526
3786
|
}
|
|
3527
3787
|
if (!(params.applyBestDiscount !== false)) {
|
|
3528
|
-
|
|
3788
|
+
_context33.next = 44;
|
|
3529
3789
|
break;
|
|
3530
3790
|
}
|
|
3531
|
-
|
|
3791
|
+
_context33.next = 44;
|
|
3532
3792
|
return this.bestDiscount();
|
|
3533
3793
|
case 44:
|
|
3534
|
-
|
|
3794
|
+
_context33.next = 49;
|
|
3535
3795
|
break;
|
|
3536
3796
|
case 46:
|
|
3537
3797
|
if (!(params.applyBestDiscount !== false)) {
|
|
3538
|
-
|
|
3798
|
+
_context33.next = 49;
|
|
3539
3799
|
break;
|
|
3540
3800
|
}
|
|
3541
|
-
|
|
3801
|
+
_context33.next = 49;
|
|
3542
3802
|
return this.bestDiscount();
|
|
3543
3803
|
case 49:
|
|
3544
3804
|
nextTempOrder = this.getTempOrder();
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3805
|
+
_context33.t1 = buildPlannerDiscountResult;
|
|
3806
|
+
_context33.t2 = customerId;
|
|
3807
|
+
_context33.t3 = this.getDiscountList();
|
|
3808
|
+
_context33.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
|
|
3809
|
+
_context33.t5 = summaryBefore;
|
|
3810
|
+
_context33.next = 57;
|
|
3551
3811
|
return this.getSummary();
|
|
3552
3812
|
case 57:
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
customerId:
|
|
3559
|
-
discountList:
|
|
3560
|
-
products:
|
|
3561
|
-
summaryBefore:
|
|
3562
|
-
summaryAfter:
|
|
3563
|
-
status:
|
|
3564
|
-
preferredDiscountId:
|
|
3565
|
-
preferredDiscountFound:
|
|
3813
|
+
_context33.t6 = _context33.sent;
|
|
3814
|
+
_context33.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
|
|
3815
|
+
_context33.t8 = preferredDiscountId;
|
|
3816
|
+
_context33.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
|
|
3817
|
+
_context33.t10 = {
|
|
3818
|
+
customerId: _context33.t2,
|
|
3819
|
+
discountList: _context33.t3,
|
|
3820
|
+
products: _context33.t4,
|
|
3821
|
+
summaryBefore: _context33.t5,
|
|
3822
|
+
summaryAfter: _context33.t6,
|
|
3823
|
+
status: _context33.t7,
|
|
3824
|
+
preferredDiscountId: _context33.t8,
|
|
3825
|
+
preferredDiscountFound: _context33.t9
|
|
3566
3826
|
};
|
|
3567
|
-
return
|
|
3827
|
+
return _context33.abrupt("return", (0, _context33.t1)(_context33.t10));
|
|
3568
3828
|
case 63:
|
|
3569
3829
|
case "end":
|
|
3570
|
-
return
|
|
3830
|
+
return _context33.stop();
|
|
3571
3831
|
}
|
|
3572
|
-
},
|
|
3832
|
+
}, _callee33, this, [[18, 30, 33, 36]]);
|
|
3573
3833
|
}));
|
|
3574
3834
|
function applyPlannerDiscounts() {
|
|
3575
3835
|
return _applyPlannerDiscounts.apply(this, arguments);
|
|
@@ -3579,16 +3839,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3579
3839
|
}, {
|
|
3580
3840
|
key: "buildUnifiedOrderProduct",
|
|
3581
3841
|
value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
|
|
3582
|
-
var
|
|
3842
|
+
var _ref41, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref42, _sourceProduct$produc, _ref43, _ref44, _sourceProduct$quanti, _sourceProduct$price, _ref45, _ref46, _sourceProduct$sellin;
|
|
3583
3843
|
var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
|
|
3584
|
-
var quotationShelfId = (
|
|
3844
|
+
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;
|
|
3585
3845
|
var orderProduct = this.transformBaseProductToOrderProduct({
|
|
3586
3846
|
payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
|
|
3587
3847
|
id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
|
|
3588
|
-
product_id: (
|
|
3589
|
-
quantity: (
|
|
3848
|
+
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,
|
|
3849
|
+
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,
|
|
3590
3850
|
price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
|
|
3591
|
-
selling_price: (
|
|
3851
|
+
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,
|
|
3592
3852
|
metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
|
|
3593
3853
|
}),
|
|
3594
3854
|
sourceProduct: sourceProduct
|
|
@@ -3607,29 +3867,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3607
3867
|
}, {
|
|
3608
3868
|
key: "removeExistingStagedLines",
|
|
3609
3869
|
value: (function () {
|
|
3610
|
-
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3611
|
-
var _this$
|
|
3870
|
+
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(ownershipKey) {
|
|
3871
|
+
var _this$getTempOrder2;
|
|
3612
3872
|
var existingLines;
|
|
3613
|
-
return _regeneratorRuntime().wrap(function
|
|
3614
|
-
while (1) switch (
|
|
3873
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3874
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3615
3875
|
case 0:
|
|
3616
|
-
existingLines = (((_this$
|
|
3617
|
-
var _product$
|
|
3618
|
-
return (product === null || product === void 0 || (_product$
|
|
3876
|
+
existingLines = (((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.products) || []).filter(function (product) {
|
|
3877
|
+
var _product$metadata5;
|
|
3878
|
+
return (product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5[ownershipKey]) === true;
|
|
3619
3879
|
});
|
|
3620
3880
|
if (!(existingLines.length > 0)) {
|
|
3621
|
-
|
|
3881
|
+
_context34.next = 4;
|
|
3622
3882
|
break;
|
|
3623
3883
|
}
|
|
3624
|
-
|
|
3884
|
+
_context34.next = 4;
|
|
3625
3885
|
return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
|
|
3626
3886
|
case 4:
|
|
3627
3887
|
case "end":
|
|
3628
|
-
return
|
|
3888
|
+
return _context34.stop();
|
|
3629
3889
|
}
|
|
3630
|
-
},
|
|
3890
|
+
}, _callee34, this);
|
|
3631
3891
|
}));
|
|
3632
|
-
function removeExistingStagedLines(
|
|
3892
|
+
function removeExistingStagedLines(_x18) {
|
|
3633
3893
|
return _removeExistingStagedLines.apply(this, arguments);
|
|
3634
3894
|
}
|
|
3635
3895
|
return removeExistingStagedLines;
|
|
@@ -3637,25 +3897,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3637
3897
|
}, {
|
|
3638
3898
|
key: "stageProducts",
|
|
3639
3899
|
value: function () {
|
|
3640
|
-
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3900
|
+
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params, ownershipKey) {
|
|
3641
3901
|
var _params$rawProducts;
|
|
3642
|
-
var productIds, existingIds, missingIds, productIdSet, selectedProducts,
|
|
3643
|
-
return _regeneratorRuntime().wrap(function
|
|
3644
|
-
while (1) switch (
|
|
3902
|
+
var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i2, _arr2, sourceProduct, productInput;
|
|
3903
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3904
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3645
3905
|
case 0:
|
|
3646
3906
|
productIds = params.productIds || [];
|
|
3647
3907
|
if (productIds.length) {
|
|
3648
|
-
|
|
3908
|
+
_context35.next = 3;
|
|
3649
3909
|
break;
|
|
3650
3910
|
}
|
|
3651
|
-
return
|
|
3911
|
+
return _context35.abrupt("return", this.getTempOrder());
|
|
3652
3912
|
case 3:
|
|
3653
3913
|
if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
|
|
3654
|
-
|
|
3914
|
+
_context35.next = 7;
|
|
3655
3915
|
break;
|
|
3656
3916
|
}
|
|
3657
3917
|
this.unifiedProductCatalog = params.rawProducts;
|
|
3658
|
-
|
|
3918
|
+
_context35.next = 12;
|
|
3659
3919
|
break;
|
|
3660
3920
|
case 7:
|
|
3661
3921
|
existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
|
|
@@ -3666,15 +3926,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3666
3926
|
return !existingIds.has(String(id));
|
|
3667
3927
|
});
|
|
3668
3928
|
if (!(missingIds.length || params.productLoadParams)) {
|
|
3669
|
-
|
|
3929
|
+
_context35.next = 12;
|
|
3670
3930
|
break;
|
|
3671
3931
|
}
|
|
3672
|
-
|
|
3932
|
+
_context35.next = 12;
|
|
3673
3933
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
3674
3934
|
product_ids: productIds.map(Number).filter(Number.isFinite)
|
|
3675
3935
|
}));
|
|
3676
3936
|
case 12:
|
|
3677
|
-
|
|
3937
|
+
_context35.next = 14;
|
|
3678
3938
|
return this.removeExistingStagedLines(ownershipKey);
|
|
3679
3939
|
case 14:
|
|
3680
3940
|
productIdSet = new Set(productIds.map(function (id) {
|
|
@@ -3684,33 +3944,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3684
3944
|
var _product$id2;
|
|
3685
3945
|
return productIdSet.has(String((_product$id2 = product.id) !== null && _product$id2 !== void 0 ? _product$id2 : product.product_id));
|
|
3686
3946
|
});
|
|
3687
|
-
|
|
3947
|
+
_i2 = 0, _arr2 = selectedProducts;
|
|
3688
3948
|
case 17:
|
|
3689
|
-
if (!(
|
|
3690
|
-
|
|
3949
|
+
if (!(_i2 < _arr2.length)) {
|
|
3950
|
+
_context35.next = 26;
|
|
3691
3951
|
break;
|
|
3692
3952
|
}
|
|
3693
|
-
sourceProduct =
|
|
3953
|
+
sourceProduct = _arr2[_i2];
|
|
3694
3954
|
productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
|
|
3695
3955
|
if (!productInput) {
|
|
3696
|
-
|
|
3956
|
+
_context35.next = 23;
|
|
3697
3957
|
break;
|
|
3698
3958
|
}
|
|
3699
|
-
|
|
3959
|
+
_context35.next = 23;
|
|
3700
3960
|
return this.addProductToOrder(productInput);
|
|
3701
3961
|
case 23:
|
|
3702
|
-
|
|
3703
|
-
|
|
3962
|
+
_i2++;
|
|
3963
|
+
_context35.next = 17;
|
|
3704
3964
|
break;
|
|
3705
3965
|
case 26:
|
|
3706
|
-
return
|
|
3966
|
+
return _context35.abrupt("return", this.getTempOrder());
|
|
3707
3967
|
case 27:
|
|
3708
3968
|
case "end":
|
|
3709
|
-
return
|
|
3969
|
+
return _context35.stop();
|
|
3710
3970
|
}
|
|
3711
|
-
},
|
|
3971
|
+
}, _callee35, this);
|
|
3712
3972
|
}));
|
|
3713
|
-
function stageProducts(
|
|
3973
|
+
function stageProducts(_x19, _x20) {
|
|
3714
3974
|
return _stageProducts.apply(this, arguments);
|
|
3715
3975
|
}
|
|
3716
3976
|
return stageProducts;
|
|
@@ -3722,18 +3982,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3722
3982
|
}, {
|
|
3723
3983
|
key: "stageRetailProducts",
|
|
3724
3984
|
value: (function () {
|
|
3725
|
-
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3726
|
-
return _regeneratorRuntime().wrap(function
|
|
3727
|
-
while (1) switch (
|
|
3985
|
+
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
3986
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3987
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3728
3988
|
case 0:
|
|
3729
|
-
return
|
|
3989
|
+
return _context36.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
|
|
3730
3990
|
case 1:
|
|
3731
3991
|
case "end":
|
|
3732
|
-
return
|
|
3992
|
+
return _context36.stop();
|
|
3733
3993
|
}
|
|
3734
|
-
},
|
|
3994
|
+
}, _callee36, this);
|
|
3735
3995
|
}));
|
|
3736
|
-
function stageRetailProducts(
|
|
3996
|
+
function stageRetailProducts(_x21) {
|
|
3737
3997
|
return _stageRetailProducts.apply(this, arguments);
|
|
3738
3998
|
}
|
|
3739
3999
|
return stageRetailProducts;
|
|
@@ -3747,20 +4007,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3747
4007
|
}, {
|
|
3748
4008
|
key: "addRetailProduct",
|
|
3749
4009
|
value: (function () {
|
|
3750
|
-
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3751
|
-
var _params$quantity,
|
|
4010
|
+
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
4011
|
+
var _params$quantity, _ref47, _params$productId, _params$product, _params$product2;
|
|
3752
4012
|
var quantity, productId, sourceProduct, products, orderProduct;
|
|
3753
|
-
return _regeneratorRuntime().wrap(function
|
|
3754
|
-
while (1) switch (
|
|
4013
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
4014
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3755
4015
|
case 0:
|
|
3756
4016
|
quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
|
|
3757
4017
|
if (!(!Number.isFinite(quantity) || quantity <= 0)) {
|
|
3758
|
-
|
|
4018
|
+
_context37.next = 3;
|
|
3759
4019
|
break;
|
|
3760
4020
|
}
|
|
3761
4021
|
throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
|
|
3762
4022
|
case 3:
|
|
3763
|
-
productId = (
|
|
4023
|
+
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;
|
|
3764
4024
|
sourceProduct = params.product;
|
|
3765
4025
|
if (!sourceProduct && productId !== undefined && productId !== null) {
|
|
3766
4026
|
sourceProduct = this.unifiedProductCatalog.find(function (product) {
|
|
@@ -3769,22 +4029,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3769
4029
|
});
|
|
3770
4030
|
}
|
|
3771
4031
|
if (!(!sourceProduct && productId !== undefined && productId !== null)) {
|
|
3772
|
-
|
|
4032
|
+
_context37.next = 11;
|
|
3773
4033
|
break;
|
|
3774
4034
|
}
|
|
3775
|
-
|
|
4035
|
+
_context37.next = 9;
|
|
3776
4036
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
3777
4037
|
product_ids: [Number(productId)].filter(Number.isFinite)
|
|
3778
4038
|
}));
|
|
3779
4039
|
case 9:
|
|
3780
|
-
products =
|
|
4040
|
+
products = _context37.sent;
|
|
3781
4041
|
sourceProduct = products.find(function (product) {
|
|
3782
4042
|
var _product$id4;
|
|
3783
4043
|
return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
|
|
3784
4044
|
});
|
|
3785
4045
|
case 11:
|
|
3786
4046
|
if (sourceProduct) {
|
|
3787
|
-
|
|
4047
|
+
_context37.next = 13;
|
|
3788
4048
|
break;
|
|
3789
4049
|
}
|
|
3790
4050
|
throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
|
|
@@ -3793,19 +4053,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3793
4053
|
quantity: quantity
|
|
3794
4054
|
}), 'unified_booking_sales_retail');
|
|
3795
4055
|
if (orderProduct) {
|
|
3796
|
-
|
|
4056
|
+
_context37.next = 16;
|
|
3797
4057
|
break;
|
|
3798
4058
|
}
|
|
3799
4059
|
throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
|
|
3800
4060
|
case 16:
|
|
3801
|
-
return
|
|
4061
|
+
return _context37.abrupt("return", this.addProductToOrder(orderProduct));
|
|
3802
4062
|
case 17:
|
|
3803
4063
|
case "end":
|
|
3804
|
-
return
|
|
4064
|
+
return _context37.stop();
|
|
3805
4065
|
}
|
|
3806
|
-
},
|
|
4066
|
+
}, _callee37, this);
|
|
3807
4067
|
}));
|
|
3808
|
-
function addRetailProduct(
|
|
4068
|
+
function addRetailProduct(_x22) {
|
|
3809
4069
|
return _addRetailProduct.apply(this, arguments);
|
|
3810
4070
|
}
|
|
3811
4071
|
return addRetailProduct;
|
|
@@ -3905,7 +4165,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3905
4165
|
}, {
|
|
3906
4166
|
key: "buildAvailabilityOperatingHoursSnapshot",
|
|
3907
4167
|
value: function buildAvailabilityOperatingHoursSnapshot(params) {
|
|
3908
|
-
var
|
|
4168
|
+
var _this10 = this;
|
|
3909
4169
|
var descriptor = params.prepare._availabilityOperatingHours || {
|
|
3910
4170
|
source: params.prepare.businessHours ? 'prepare_business_hours' : 'default_business_hours',
|
|
3911
4171
|
scheduleIds: []
|
|
@@ -3915,7 +4175,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3915
4175
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3916
4176
|
startAt: "".concat(date, "T").concat(params.businessHours.startTime, ":00"),
|
|
3917
4177
|
endAt: "".concat(date, "T").concat(params.businessHours.endTime, ":00"),
|
|
3918
|
-
fixedOffsetMinutes:
|
|
4178
|
+
fixedOffsetMinutes: _this10.getAvailabilityRuntimeOffsetMinutes(),
|
|
3919
4179
|
rollOverEnd: true
|
|
3920
4180
|
});
|
|
3921
4181
|
return range ? [{
|
|
@@ -3952,7 +4212,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3952
4212
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3953
4213
|
startAt: slot.start_at,
|
|
3954
4214
|
endAt: slot.end_at,
|
|
3955
|
-
fixedOffsetMinutes:
|
|
4215
|
+
fixedOffsetMinutes: _this10.getAvailabilityRuntimeOffsetMinutes(),
|
|
3956
4216
|
rollOverEnd: true
|
|
3957
4217
|
});
|
|
3958
4218
|
return range ? [{
|
|
@@ -3969,7 +4229,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3969
4229
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3970
4230
|
startAt: slot.start_at,
|
|
3971
4231
|
endAt: slot.end_at,
|
|
3972
|
-
fixedOffsetMinutes:
|
|
4232
|
+
fixedOffsetMinutes: _this10.getAvailabilityRuntimeOffsetMinutes(),
|
|
3973
4233
|
rollOverEnd: true
|
|
3974
4234
|
});
|
|
3975
4235
|
return range ? [{
|
|
@@ -4007,46 +4267,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4007
4267
|
}, {
|
|
4008
4268
|
key: "loadAvailabilityProducts",
|
|
4009
4269
|
value: function () {
|
|
4010
|
-
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4270
|
+
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
4011
4271
|
var _prepare$catalogScope,
|
|
4012
4272
|
_prepare$catalogScope2,
|
|
4013
|
-
|
|
4273
|
+
_this11 = this,
|
|
4014
4274
|
_prepare$resourceIds;
|
|
4015
4275
|
var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
|
|
4016
|
-
return _regeneratorRuntime().wrap(function
|
|
4017
|
-
while (1) switch (
|
|
4276
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
4277
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
4018
4278
|
case 0:
|
|
4019
4279
|
prepare = params.prepare, dateRange = params.dateRange;
|
|
4020
4280
|
explicitProductIds = prepare.productIds || [];
|
|
4021
4281
|
rawProducts = [];
|
|
4022
4282
|
if (!Array.isArray(prepare.rawProducts)) {
|
|
4023
|
-
|
|
4283
|
+
_context38.next = 8;
|
|
4024
4284
|
break;
|
|
4025
4285
|
}
|
|
4026
4286
|
rawProducts = prepare.rawProducts;
|
|
4027
4287
|
this.unifiedProductCatalog = _toConsumableArray(rawProducts);
|
|
4028
|
-
|
|
4288
|
+
_context38.next = 34;
|
|
4029
4289
|
break;
|
|
4030
4290
|
case 8:
|
|
4031
4291
|
if (!(explicitProductIds.length > 0)) {
|
|
4032
|
-
|
|
4292
|
+
_context38.next = 14;
|
|
4033
4293
|
break;
|
|
4034
4294
|
}
|
|
4035
|
-
|
|
4295
|
+
_context38.next = 11;
|
|
4036
4296
|
return this.loadProducts({
|
|
4037
4297
|
product_ids: explicitProductIds,
|
|
4038
4298
|
schedule_date: dateRange.startDate
|
|
4039
4299
|
});
|
|
4040
4300
|
case 11:
|
|
4041
|
-
rawProducts =
|
|
4042
|
-
|
|
4301
|
+
rawProducts = _context38.sent;
|
|
4302
|
+
_context38.next = 34;
|
|
4043
4303
|
break;
|
|
4044
4304
|
case 14:
|
|
4045
4305
|
if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
|
|
4046
|
-
|
|
4306
|
+
_context38.next = 30;
|
|
4047
4307
|
break;
|
|
4048
4308
|
}
|
|
4049
|
-
|
|
4309
|
+
_context38.next = 17;
|
|
4050
4310
|
return this.loadScheduleAvailableDate({
|
|
4051
4311
|
startDate: dateRange.startDate,
|
|
4052
4312
|
endDate: dateRange.endDate,
|
|
@@ -4062,44 +4322,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4062
4322
|
});
|
|
4063
4323
|
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)) || [])));
|
|
4064
4324
|
if (!(productIds.length > 0)) {
|
|
4065
|
-
|
|
4325
|
+
_context38.next = 27;
|
|
4066
4326
|
break;
|
|
4067
4327
|
}
|
|
4068
4328
|
assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
|
|
4069
|
-
|
|
4329
|
+
_context38.next = 24;
|
|
4070
4330
|
return this.loadProducts({
|
|
4071
4331
|
product_ids: productIds,
|
|
4072
4332
|
schedule_date: dateRange.startDate
|
|
4073
4333
|
});
|
|
4074
4334
|
case 24:
|
|
4075
|
-
rawProducts =
|
|
4076
|
-
|
|
4335
|
+
rawProducts = _context38.sent;
|
|
4336
|
+
_context38.next = 28;
|
|
4077
4337
|
break;
|
|
4078
4338
|
case 27:
|
|
4079
4339
|
this.unifiedProductCatalog = [];
|
|
4080
4340
|
case 28:
|
|
4081
|
-
|
|
4341
|
+
_context38.next = 34;
|
|
4082
4342
|
break;
|
|
4083
4343
|
case 30:
|
|
4084
4344
|
if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
|
|
4085
|
-
|
|
4345
|
+
_context38.next = 34;
|
|
4086
4346
|
break;
|
|
4087
4347
|
}
|
|
4088
|
-
|
|
4348
|
+
_context38.next = 33;
|
|
4089
4349
|
return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
|
|
4090
4350
|
schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
|
|
4091
4351
|
}));
|
|
4092
4352
|
case 33:
|
|
4093
|
-
rawProducts =
|
|
4353
|
+
rawProducts = _context38.sent;
|
|
4094
4354
|
case 34:
|
|
4095
4355
|
normalized = rawProducts.map(function (product) {
|
|
4096
|
-
return normalizeProductForAvailability(product, params.scheduleList,
|
|
4356
|
+
return normalizeProductForAvailability(product, params.scheduleList, _this11.getAvailabilityRuntimeOffsetMinutes());
|
|
4097
4357
|
});
|
|
4098
4358
|
if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
|
|
4099
|
-
|
|
4359
|
+
_context38.next = 37;
|
|
4100
4360
|
break;
|
|
4101
4361
|
}
|
|
4102
|
-
return
|
|
4362
|
+
return _context38.abrupt("return", normalized.filter(function (product) {
|
|
4103
4363
|
var _product$requirementG2;
|
|
4104
4364
|
return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
|
|
4105
4365
|
var _group$resourceIds3;
|
|
@@ -4112,16 +4372,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4112
4372
|
}));
|
|
4113
4373
|
case 37:
|
|
4114
4374
|
productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
|
|
4115
|
-
return
|
|
4375
|
+
return _context38.abrupt("return", productIdSet ? normalized.filter(function (product) {
|
|
4116
4376
|
return productIdSet.has(String(product.id));
|
|
4117
4377
|
}) : normalized);
|
|
4118
4378
|
case 39:
|
|
4119
4379
|
case "end":
|
|
4120
|
-
return
|
|
4380
|
+
return _context38.stop();
|
|
4121
4381
|
}
|
|
4122
|
-
},
|
|
4382
|
+
}, _callee38, this);
|
|
4123
4383
|
}));
|
|
4124
|
-
function loadAvailabilityProducts(
|
|
4384
|
+
function loadAvailabilityProducts(_x23) {
|
|
4125
4385
|
return _loadAvailabilityProducts.apply(this, arguments);
|
|
4126
4386
|
}
|
|
4127
4387
|
return loadAvailabilityProducts;
|
|
@@ -4134,12 +4394,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4134
4394
|
}, {
|
|
4135
4395
|
key: "fetchAvailabilityResourcesV2",
|
|
4136
4396
|
value: (function () {
|
|
4137
|
-
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4397
|
+
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
4138
4398
|
var response, data;
|
|
4139
|
-
return _regeneratorRuntime().wrap(function
|
|
4140
|
-
while (1) switch (
|
|
4399
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4400
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
4141
4401
|
case 0:
|
|
4142
|
-
|
|
4402
|
+
_context39.next = 2;
|
|
4143
4403
|
return this.request.get('/schedule/resource/list/v2', {
|
|
4144
4404
|
start_date: params.dateRange.startDate,
|
|
4145
4405
|
end_date: params.dateRange.endDate,
|
|
@@ -4149,28 +4409,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4149
4409
|
useCache: false
|
|
4150
4410
|
});
|
|
4151
4411
|
case 2:
|
|
4152
|
-
response =
|
|
4412
|
+
response = _context39.sent;
|
|
4153
4413
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
4154
4414
|
if (!Array.isArray(data)) {
|
|
4155
|
-
|
|
4415
|
+
_context39.next = 6;
|
|
4156
4416
|
break;
|
|
4157
4417
|
}
|
|
4158
|
-
return
|
|
4418
|
+
return _context39.abrupt("return", data);
|
|
4159
4419
|
case 6:
|
|
4160
4420
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
|
|
4161
|
-
|
|
4421
|
+
_context39.next = 8;
|
|
4162
4422
|
break;
|
|
4163
4423
|
}
|
|
4164
|
-
return
|
|
4424
|
+
return _context39.abrupt("return", data.list);
|
|
4165
4425
|
case 8:
|
|
4166
|
-
return
|
|
4426
|
+
return _context39.abrupt("return", []);
|
|
4167
4427
|
case 9:
|
|
4168
4428
|
case "end":
|
|
4169
|
-
return
|
|
4429
|
+
return _context39.stop();
|
|
4170
4430
|
}
|
|
4171
|
-
},
|
|
4431
|
+
}, _callee39, this);
|
|
4172
4432
|
}));
|
|
4173
|
-
function fetchAvailabilityResourcesV2(
|
|
4433
|
+
function fetchAvailabilityResourcesV2(_x24) {
|
|
4174
4434
|
return _fetchAvailabilityResourcesV.apply(this, arguments);
|
|
4175
4435
|
}
|
|
4176
4436
|
return fetchAvailabilityResourcesV2;
|
|
@@ -4178,17 +4438,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4178
4438
|
}, {
|
|
4179
4439
|
key: "fetchAndPublishAvailabilityResourcesV2",
|
|
4180
4440
|
value: function () {
|
|
4181
|
-
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4441
|
+
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
4182
4442
|
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
|
|
4183
|
-
return _regeneratorRuntime().wrap(function
|
|
4184
|
-
while (1) switch (
|
|
4443
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4444
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
4185
4445
|
case 0:
|
|
4186
4446
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4187
4447
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4188
|
-
|
|
4448
|
+
_context40.next = 3;
|
|
4189
4449
|
break;
|
|
4190
4450
|
}
|
|
4191
|
-
return
|
|
4451
|
+
return _context40.abrupt("return", []);
|
|
4192
4452
|
case 3:
|
|
4193
4453
|
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
4194
4454
|
cacheParams = {
|
|
@@ -4198,7 +4458,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4198
4458
|
};
|
|
4199
4459
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
4200
4460
|
if (!cachedRawResources) {
|
|
4201
|
-
|
|
4461
|
+
_context40.next = 9;
|
|
4202
4462
|
break;
|
|
4203
4463
|
}
|
|
4204
4464
|
if (params.useCacheOnHit) {
|
|
@@ -4210,23 +4470,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4210
4470
|
console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
|
|
4211
4471
|
});
|
|
4212
4472
|
}
|
|
4213
|
-
return
|
|
4473
|
+
return _context40.abrupt("return", cachedRawResources);
|
|
4214
4474
|
case 9:
|
|
4215
|
-
|
|
4475
|
+
_context40.next = 11;
|
|
4216
4476
|
return this.refreshAvailabilityRemoteResourceQuery({
|
|
4217
4477
|
timezone: params.timezone,
|
|
4218
4478
|
dateRange: params.dateRange,
|
|
4219
4479
|
resourceIds: normalizedResourceIds
|
|
4220
4480
|
});
|
|
4221
4481
|
case 11:
|
|
4222
|
-
return
|
|
4482
|
+
return _context40.abrupt("return", _context40.sent);
|
|
4223
4483
|
case 12:
|
|
4224
4484
|
case "end":
|
|
4225
|
-
return
|
|
4485
|
+
return _context40.stop();
|
|
4226
4486
|
}
|
|
4227
|
-
},
|
|
4487
|
+
}, _callee40, this);
|
|
4228
4488
|
}));
|
|
4229
|
-
function fetchAndPublishAvailabilityResourcesV2(
|
|
4489
|
+
function fetchAndPublishAvailabilityResourcesV2(_x25) {
|
|
4230
4490
|
return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
|
|
4231
4491
|
}
|
|
4232
4492
|
return fetchAndPublishAvailabilityResourcesV2;
|
|
@@ -4234,17 +4494,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4234
4494
|
}, {
|
|
4235
4495
|
key: "refreshAvailabilityRemoteResourceQuery",
|
|
4236
4496
|
value: function () {
|
|
4237
|
-
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4497
|
+
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
4238
4498
|
var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
|
|
4239
|
-
return _regeneratorRuntime().wrap(function
|
|
4240
|
-
while (1) switch (
|
|
4499
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4500
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
4241
4501
|
case 0:
|
|
4242
4502
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4243
4503
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4244
|
-
|
|
4504
|
+
_context41.next = 3;
|
|
4245
4505
|
break;
|
|
4246
4506
|
}
|
|
4247
|
-
return
|
|
4507
|
+
return _context41.abrupt("return", []);
|
|
4248
4508
|
case 3:
|
|
4249
4509
|
queryKey = this.buildAvailabilityRemoteResourceQueryKey({
|
|
4250
4510
|
timezone: params.timezone,
|
|
@@ -4254,13 +4514,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4254
4514
|
epoch = this.availabilityRemoteResourceEpoch;
|
|
4255
4515
|
existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4256
4516
|
if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
|
|
4257
|
-
|
|
4517
|
+
_context41.next = 10;
|
|
4258
4518
|
break;
|
|
4259
4519
|
}
|
|
4260
|
-
|
|
4520
|
+
_context41.next = 9;
|
|
4261
4521
|
return existing.promise;
|
|
4262
4522
|
case 9:
|
|
4263
|
-
return
|
|
4523
|
+
return _context41.abrupt("return", _context41.sent);
|
|
4264
4524
|
case 10:
|
|
4265
4525
|
this.availabilityRemoteResourceQuerySequence += 1;
|
|
4266
4526
|
writeVersion = this.availabilityRemoteResourceQuerySequence;
|
|
@@ -4272,11 +4532,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4272
4532
|
epoch: epoch,
|
|
4273
4533
|
promise: promise
|
|
4274
4534
|
});
|
|
4275
|
-
|
|
4276
|
-
|
|
4535
|
+
_context41.prev = 14;
|
|
4536
|
+
_context41.next = 17;
|
|
4277
4537
|
return promise;
|
|
4278
4538
|
case 17:
|
|
4279
|
-
rawResources =
|
|
4539
|
+
rawResources = _context41.sent;
|
|
4280
4540
|
if (epoch === this.availabilityRemoteResourceEpoch) {
|
|
4281
4541
|
this.availabilityRemoteOccupancyCache.publish({
|
|
4282
4542
|
scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
|
|
@@ -4287,21 +4547,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4287
4547
|
version: writeVersion
|
|
4288
4548
|
});
|
|
4289
4549
|
}
|
|
4290
|
-
return
|
|
4550
|
+
return _context41.abrupt("return", rawResources);
|
|
4291
4551
|
case 20:
|
|
4292
|
-
|
|
4552
|
+
_context41.prev = 20;
|
|
4293
4553
|
current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4294
4554
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4295
4555
|
this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
|
|
4296
4556
|
}
|
|
4297
|
-
return
|
|
4557
|
+
return _context41.finish(20);
|
|
4298
4558
|
case 24:
|
|
4299
4559
|
case "end":
|
|
4300
|
-
return
|
|
4560
|
+
return _context41.stop();
|
|
4301
4561
|
}
|
|
4302
|
-
},
|
|
4562
|
+
}, _callee41, this, [[14,, 20, 24]]);
|
|
4303
4563
|
}));
|
|
4304
|
-
function refreshAvailabilityRemoteResourceQuery(
|
|
4564
|
+
function refreshAvailabilityRemoteResourceQuery(_x26) {
|
|
4305
4565
|
return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
|
|
4306
4566
|
}
|
|
4307
4567
|
return refreshAvailabilityRemoteResourceQuery;
|
|
@@ -4309,26 +4569,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4309
4569
|
}, {
|
|
4310
4570
|
key: "loadAvailabilityResources",
|
|
4311
4571
|
value: function () {
|
|
4312
|
-
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4572
|
+
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
|
|
4313
4573
|
var resourceIds, cachedRawResources, rawResources;
|
|
4314
|
-
return _regeneratorRuntime().wrap(function
|
|
4315
|
-
while (1) switch (
|
|
4574
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4575
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4316
4576
|
case 0:
|
|
4317
4577
|
resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
|
|
4318
4578
|
if (!(resourceIds.length === 0)) {
|
|
4319
|
-
|
|
4579
|
+
_context42.next = 3;
|
|
4320
4580
|
break;
|
|
4321
4581
|
}
|
|
4322
|
-
return
|
|
4582
|
+
return _context42.abrupt("return", {
|
|
4323
4583
|
resources: [],
|
|
4324
4584
|
resourceOccupancies: []
|
|
4325
4585
|
});
|
|
4326
4586
|
case 3:
|
|
4327
4587
|
if (!Array.isArray(params.rawResources)) {
|
|
4328
|
-
|
|
4588
|
+
_context42.next = 5;
|
|
4329
4589
|
break;
|
|
4330
4590
|
}
|
|
4331
|
-
return
|
|
4591
|
+
return _context42.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4332
4592
|
rawResources: params.rawResources,
|
|
4333
4593
|
scheduleList: params.scheduleList,
|
|
4334
4594
|
dateRange: params.dateRange,
|
|
@@ -4336,7 +4596,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4336
4596
|
}));
|
|
4337
4597
|
case 5:
|
|
4338
4598
|
if (!(params.fetchPolicy === 'cache_only')) {
|
|
4339
|
-
|
|
4599
|
+
_context42.next = 10;
|
|
4340
4600
|
break;
|
|
4341
4601
|
}
|
|
4342
4602
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read({
|
|
@@ -4345,22 +4605,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4345
4605
|
dateRange: params.dateRange
|
|
4346
4606
|
});
|
|
4347
4607
|
if (!cachedRawResources) {
|
|
4348
|
-
|
|
4608
|
+
_context42.next = 9;
|
|
4349
4609
|
break;
|
|
4350
4610
|
}
|
|
4351
|
-
return
|
|
4611
|
+
return _context42.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4352
4612
|
rawResources: cachedRawResources,
|
|
4353
4613
|
scheduleList: params.scheduleList,
|
|
4354
4614
|
dateRange: params.dateRange,
|
|
4355
4615
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4356
4616
|
}));
|
|
4357
4617
|
case 9:
|
|
4358
|
-
return
|
|
4618
|
+
return _context42.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
|
|
4359
4619
|
resources: [],
|
|
4360
4620
|
resourceOccupancies: []
|
|
4361
4621
|
});
|
|
4362
4622
|
case 10:
|
|
4363
|
-
|
|
4623
|
+
_context42.next = 12;
|
|
4364
4624
|
return this.fetchAndPublishAvailabilityResourcesV2({
|
|
4365
4625
|
timezone: params.timezone,
|
|
4366
4626
|
dateRange: params.dateRange,
|
|
@@ -4368,8 +4628,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4368
4628
|
useCacheOnHit: true
|
|
4369
4629
|
});
|
|
4370
4630
|
case 12:
|
|
4371
|
-
rawResources =
|
|
4372
|
-
return
|
|
4631
|
+
rawResources = _context42.sent;
|
|
4632
|
+
return _context42.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4373
4633
|
rawResources: rawResources,
|
|
4374
4634
|
scheduleList: params.scheduleList,
|
|
4375
4635
|
dateRange: params.dateRange,
|
|
@@ -4377,11 +4637,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4377
4637
|
}));
|
|
4378
4638
|
case 14:
|
|
4379
4639
|
case "end":
|
|
4380
|
-
return
|
|
4640
|
+
return _context42.stop();
|
|
4381
4641
|
}
|
|
4382
|
-
},
|
|
4642
|
+
}, _callee42, this);
|
|
4383
4643
|
}));
|
|
4384
|
-
function loadAvailabilityResources(
|
|
4644
|
+
function loadAvailabilityResources(_x27) {
|
|
4385
4645
|
return _loadAvailabilityResources.apply(this, arguments);
|
|
4386
4646
|
}
|
|
4387
4647
|
return loadAvailabilityResources;
|
|
@@ -4401,7 +4661,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4401
4661
|
var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
|
|
4402
4662
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
4403
4663
|
productLineUids.forEach(function (requestedUid) {
|
|
4404
|
-
var
|
|
4664
|
+
var _ref48, _product$booking_uid2, _product$metadata6;
|
|
4405
4665
|
var product = products.find(function (line) {
|
|
4406
4666
|
return getProductLineUid(line) === String(requestedUid);
|
|
4407
4667
|
});
|
|
@@ -4411,7 +4671,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4411
4671
|
});
|
|
4412
4672
|
}
|
|
4413
4673
|
var productUid = getProductLineUid(product);
|
|
4414
|
-
var linkedBookingUid = String((
|
|
4674
|
+
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 : '');
|
|
4415
4675
|
var linkedBookings = bookings.filter(function (booking) {
|
|
4416
4676
|
var _booking$product_uid;
|
|
4417
4677
|
return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
|
|
@@ -4454,24 +4714,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4454
4714
|
}, {
|
|
4455
4715
|
key: "collectCartResourceOccupancies",
|
|
4456
4716
|
value: function collectCartResourceOccupancies(tempOrder, exclusions) {
|
|
4457
|
-
var
|
|
4717
|
+
var _this12 = this;
|
|
4458
4718
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
4459
4719
|
return bookings.flatMap(function (booking) {
|
|
4460
|
-
var
|
|
4720
|
+
var _ref49, _booking$product_uid2, _booking$metadata2;
|
|
4461
4721
|
var bookingUid = getBookingUid(booking);
|
|
4462
|
-
var productUid = String((
|
|
4722
|
+
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 : '');
|
|
4463
4723
|
var scheduleEventId = toNumberId(booking.schedule_event_id);
|
|
4464
4724
|
var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
|
|
4465
4725
|
var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
|
|
4466
4726
|
var resources = Array.isArray(booking.resources) ? booking.resources : [];
|
|
4467
4727
|
return resources.flatMap(function (resource) {
|
|
4468
|
-
var
|
|
4469
|
-
var resourceId = (
|
|
4728
|
+
var _ref50, _resource$resource_id, _ref51, _resource$capacity;
|
|
4729
|
+
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;
|
|
4470
4730
|
if (resourceId == null || !startAt || !endAt) return [];
|
|
4471
4731
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4472
4732
|
startAt: startAt,
|
|
4473
4733
|
endAt: endAt,
|
|
4474
|
-
fixedOffsetMinutes:
|
|
4734
|
+
fixedOffsetMinutes: _this12.getAvailabilityRuntimeOffsetMinutes(),
|
|
4475
4735
|
rollOverEnd: false
|
|
4476
4736
|
});
|
|
4477
4737
|
if (!range) return [];
|
|
@@ -4479,7 +4739,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4479
4739
|
resourceId: resourceId,
|
|
4480
4740
|
startAt: range.startAt,
|
|
4481
4741
|
endAt: range.endAt,
|
|
4482
|
-
pax: Math.max(1, Number((
|
|
4742
|
+
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),
|
|
4483
4743
|
source: 'cart',
|
|
4484
4744
|
scheduleEventId: scheduleEventId,
|
|
4485
4745
|
bookingUid: bookingUid || undefined,
|
|
@@ -4489,7 +4749,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4489
4749
|
resource: resource
|
|
4490
4750
|
}
|
|
4491
4751
|
};
|
|
4492
|
-
return
|
|
4752
|
+
return _this12.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
|
|
4493
4753
|
});
|
|
4494
4754
|
});
|
|
4495
4755
|
}
|
|
@@ -4556,16 +4816,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4556
4816
|
}, {
|
|
4557
4817
|
key: "assertContextualQueryFreshness",
|
|
4558
4818
|
value: function assertContextualQueryFreshness(context, request) {
|
|
4559
|
-
var
|
|
4819
|
+
var _this13 = this;
|
|
4560
4820
|
if (request.target === 'time') {
|
|
4561
4821
|
request.candidates.forEach(function (candidate) {
|
|
4562
|
-
|
|
4822
|
+
_this13.assertAvailabilityCandidateFreshness(context, candidate);
|
|
4563
4823
|
});
|
|
4564
4824
|
return;
|
|
4565
4825
|
}
|
|
4566
4826
|
if (request.target === 'resource') {
|
|
4567
4827
|
request.selectedRanges.forEach(function (candidate) {
|
|
4568
|
-
|
|
4828
|
+
_this13.assertAvailabilityCandidateFreshness(context, candidate);
|
|
4569
4829
|
});
|
|
4570
4830
|
}
|
|
4571
4831
|
}
|
|
@@ -4612,8 +4872,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4612
4872
|
}, {
|
|
4613
4873
|
key: "buildAvailabilityProjectionSnapshot",
|
|
4614
4874
|
value: function () {
|
|
4615
|
-
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4616
|
-
var
|
|
4875
|
+
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
4876
|
+
var _this14 = this;
|
|
4617
4877
|
var options,
|
|
4618
4878
|
normalizedPrepareParams,
|
|
4619
4879
|
timezoneLabel,
|
|
@@ -4636,23 +4896,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4636
4896
|
durationCandidateAnchorAt,
|
|
4637
4897
|
orderRevision,
|
|
4638
4898
|
projection,
|
|
4639
|
-
|
|
4640
|
-
return _regeneratorRuntime().wrap(function
|
|
4641
|
-
while (1) switch (
|
|
4899
|
+
_args43 = arguments;
|
|
4900
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4901
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4642
4902
|
case 0:
|
|
4643
|
-
options =
|
|
4903
|
+
options = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {};
|
|
4644
4904
|
normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
4645
4905
|
timezoneLabel = String(normalizedPrepareParams.timezone);
|
|
4646
4906
|
dateRange = normalizedPrepareParams.dateRange;
|
|
4647
4907
|
scheduleList = this.getAvailabilityScheduleCatalog();
|
|
4648
|
-
|
|
4908
|
+
_context43.next = 7;
|
|
4649
4909
|
return this.loadAvailabilityProducts({
|
|
4650
4910
|
prepare: normalizedPrepareParams,
|
|
4651
4911
|
dateRange: dateRange,
|
|
4652
4912
|
scheduleList: scheduleList
|
|
4653
4913
|
});
|
|
4654
4914
|
case 7:
|
|
4655
|
-
products =
|
|
4915
|
+
products = _context43.sent;
|
|
4656
4916
|
// Coverage is physical local time; the caller's date range remains business
|
|
4657
4917
|
// dates. Keep yesterday's opening and the last business day's overnight tail.
|
|
4658
4918
|
useDurationTimeGrid = this.usesDurationTimeGrid() && products.some(function (product) {
|
|
@@ -4674,7 +4934,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4674
4934
|
scheduleList: scheduleList,
|
|
4675
4935
|
businessHours: businessHours
|
|
4676
4936
|
});
|
|
4677
|
-
|
|
4937
|
+
_context43.next = 16;
|
|
4678
4938
|
return this.loadAvailabilityResources({
|
|
4679
4939
|
timezone: timezoneLabel,
|
|
4680
4940
|
dateRange: coverageDateRange,
|
|
@@ -4686,14 +4946,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4686
4946
|
fallbackResources: options.fallbackResources
|
|
4687
4947
|
});
|
|
4688
4948
|
case 16:
|
|
4689
|
-
loadedResources =
|
|
4949
|
+
loadedResources = _context43.sent;
|
|
4690
4950
|
tempOrder = this.getTempOrder();
|
|
4691
4951
|
exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
|
|
4692
4952
|
injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
|
|
4693
4953
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4694
4954
|
startAt: occupancy.startAt,
|
|
4695
4955
|
endAt: occupancy.endAt,
|
|
4696
|
-
fixedOffsetMinutes:
|
|
4956
|
+
fixedOffsetMinutes: _this14.getAvailabilityRuntimeOffsetMinutes(),
|
|
4697
4957
|
rollOverEnd: false
|
|
4698
4958
|
});
|
|
4699
4959
|
if (!range) return [];
|
|
@@ -4703,7 +4963,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4703
4963
|
})];
|
|
4704
4964
|
});
|
|
4705
4965
|
remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
|
|
4706
|
-
return !
|
|
4966
|
+
return !_this14.occupancyIsExcluded(occupancy, exclusions);
|
|
4707
4967
|
});
|
|
4708
4968
|
cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
|
|
4709
4969
|
preparedAt = this.getAvailabilityRuntimeDateTime();
|
|
@@ -4732,18 +4992,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4732
4992
|
prepareParams: normalizedPrepareParams,
|
|
4733
4993
|
durationCandidateAnchorAt: durationCandidateAnchorAt
|
|
4734
4994
|
});
|
|
4735
|
-
return
|
|
4995
|
+
return _context43.abrupt("return", {
|
|
4736
4996
|
projection: projection,
|
|
4737
4997
|
prepareParams: normalizedPrepareParams,
|
|
4738
4998
|
orderRevision: orderRevision
|
|
4739
4999
|
});
|
|
4740
5000
|
case 28:
|
|
4741
5001
|
case "end":
|
|
4742
|
-
return
|
|
5002
|
+
return _context43.stop();
|
|
4743
5003
|
}
|
|
4744
|
-
},
|
|
5004
|
+
}, _callee43, this);
|
|
4745
5005
|
}));
|
|
4746
|
-
function buildAvailabilityProjectionSnapshot(
|
|
5006
|
+
function buildAvailabilityProjectionSnapshot(_x28) {
|
|
4747
5007
|
return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
|
|
4748
5008
|
}
|
|
4749
5009
|
return buildAvailabilityProjectionSnapshot;
|
|
@@ -4751,10 +5011,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4751
5011
|
}, {
|
|
4752
5012
|
key: "getSharedPreparedAvailabilitySnapshot",
|
|
4753
5013
|
value: function () {
|
|
4754
|
-
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5014
|
+
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
4755
5015
|
var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
|
|
4756
|
-
return _regeneratorRuntime().wrap(function
|
|
4757
|
-
while (1) switch (
|
|
5016
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
5017
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4758
5018
|
case 0:
|
|
4759
5019
|
lifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
4760
5020
|
normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
@@ -4773,15 +5033,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4773
5033
|
}
|
|
4774
5034
|
})) : this.buildAvailabilityPrepareKey(normalizedParams);
|
|
4775
5035
|
if (!hasRawInputs) {
|
|
4776
|
-
|
|
5036
|
+
_context44.next = 11;
|
|
4777
5037
|
break;
|
|
4778
5038
|
}
|
|
4779
|
-
|
|
5039
|
+
_context44.next = 7;
|
|
4780
5040
|
return this.buildAvailabilityProjectionSnapshot(normalizedParams);
|
|
4781
5041
|
case 7:
|
|
4782
|
-
snapshot =
|
|
5042
|
+
snapshot = _context44.sent;
|
|
4783
5043
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
4784
|
-
|
|
5044
|
+
_context44.next = 10;
|
|
4785
5045
|
break;
|
|
4786
5046
|
}
|
|
4787
5047
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -4790,7 +5050,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4790
5050
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
4791
5051
|
});
|
|
4792
5052
|
case 10:
|
|
4793
|
-
return
|
|
5053
|
+
return _context44.abrupt("return", {
|
|
4794
5054
|
prepareKey: prepareKey,
|
|
4795
5055
|
snapshot: snapshot
|
|
4796
5056
|
});
|
|
@@ -4804,13 +5064,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4804
5064
|
promise: promise
|
|
4805
5065
|
});
|
|
4806
5066
|
}
|
|
4807
|
-
|
|
4808
|
-
|
|
5067
|
+
_context44.prev = 14;
|
|
5068
|
+
_context44.next = 17;
|
|
4809
5069
|
return promise;
|
|
4810
5070
|
case 17:
|
|
4811
|
-
_snapshot =
|
|
5071
|
+
_snapshot = _context44.sent;
|
|
4812
5072
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
4813
|
-
|
|
5073
|
+
_context44.next = 20;
|
|
4814
5074
|
break;
|
|
4815
5075
|
}
|
|
4816
5076
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -4819,24 +5079,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4819
5079
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
4820
5080
|
});
|
|
4821
5081
|
case 20:
|
|
4822
|
-
return
|
|
5082
|
+
return _context44.abrupt("return", {
|
|
4823
5083
|
prepareKey: prepareKey,
|
|
4824
5084
|
snapshot: _snapshot
|
|
4825
5085
|
});
|
|
4826
5086
|
case 21:
|
|
4827
|
-
|
|
5087
|
+
_context44.prev = 21;
|
|
4828
5088
|
current = this.availabilityPrepareInFlight.get(prepareKey);
|
|
4829
5089
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4830
5090
|
this.availabilityPrepareInFlight.delete(prepareKey);
|
|
4831
5091
|
}
|
|
4832
|
-
return
|
|
5092
|
+
return _context44.finish(21);
|
|
4833
5093
|
case 25:
|
|
4834
5094
|
case "end":
|
|
4835
|
-
return
|
|
5095
|
+
return _context44.stop();
|
|
4836
5096
|
}
|
|
4837
|
-
},
|
|
5097
|
+
}, _callee44, this, [[14,, 21, 25]]);
|
|
4838
5098
|
}));
|
|
4839
|
-
function getSharedPreparedAvailabilitySnapshot(
|
|
5099
|
+
function getSharedPreparedAvailabilitySnapshot(_x29) {
|
|
4840
5100
|
return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
|
|
4841
5101
|
}
|
|
4842
5102
|
return getSharedPreparedAvailabilitySnapshot;
|
|
@@ -4844,51 +5104,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4844
5104
|
}, {
|
|
4845
5105
|
key: "refreshAvailabilityContextProjection",
|
|
4846
5106
|
value: function () {
|
|
4847
|
-
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4848
|
-
var
|
|
5107
|
+
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
5108
|
+
var _this15 = this;
|
|
4849
5109
|
var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
|
|
4850
|
-
return _regeneratorRuntime().wrap(function
|
|
4851
|
-
while (1) switch (
|
|
5110
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
5111
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4852
5112
|
case 0:
|
|
4853
5113
|
existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
4854
5114
|
if (!existingInFlight) {
|
|
4855
|
-
|
|
5115
|
+
_context46.next = 5;
|
|
4856
5116
|
break;
|
|
4857
5117
|
}
|
|
4858
|
-
|
|
5118
|
+
_context46.next = 4;
|
|
4859
5119
|
return existingInFlight;
|
|
4860
5120
|
case 4:
|
|
4861
|
-
return
|
|
5121
|
+
return _context46.abrupt("return", _context46.sent);
|
|
4862
5122
|
case 5:
|
|
4863
5123
|
context = this.getAvailabilityContextEntry(params.contextId);
|
|
4864
5124
|
expectedVersion = context.activeVersion;
|
|
4865
5125
|
expectedRefreshNonce = context.refreshNonce;
|
|
4866
5126
|
expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
4867
|
-
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5127
|
+
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
|
|
4868
5128
|
var snapshot, currentContext, projectionEntry;
|
|
4869
|
-
return _regeneratorRuntime().wrap(function
|
|
4870
|
-
while (1) switch (
|
|
5129
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
5130
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4871
5131
|
case 0:
|
|
4872
|
-
|
|
4873
|
-
return
|
|
5132
|
+
_context45.next = 2;
|
|
5133
|
+
return _this15.buildAvailabilityProjectionSnapshot(_this15.cloneAvailabilityPrepareParams(context.prepareParams), {
|
|
4874
5134
|
durationCandidateAnchorAt: context.durationCandidateAnchorAt
|
|
4875
5135
|
});
|
|
4876
5136
|
case 2:
|
|
4877
|
-
snapshot =
|
|
4878
|
-
currentContext =
|
|
5137
|
+
snapshot = _context45.sent;
|
|
5138
|
+
currentContext = _this15.availabilityContextRegistry.get(params.contextId);
|
|
4879
5139
|
if (currentContext) {
|
|
4880
|
-
|
|
5140
|
+
_context45.next = 6;
|
|
4881
5141
|
break;
|
|
4882
5142
|
}
|
|
4883
|
-
return
|
|
5143
|
+
return _context45.abrupt("return", null);
|
|
4884
5144
|
case 6:
|
|
4885
|
-
if (!(expectedLifecycleGeneration !==
|
|
4886
|
-
|
|
5145
|
+
if (!(expectedLifecycleGeneration !== _this15.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
|
|
5146
|
+
_context45.next = 8;
|
|
4887
5147
|
break;
|
|
4888
5148
|
}
|
|
4889
|
-
return
|
|
5149
|
+
return _context45.abrupt("return", null);
|
|
4890
5150
|
case 8:
|
|
4891
|
-
projectionEntry =
|
|
5151
|
+
projectionEntry = _this15.storeAvailabilityProjectionEntry({
|
|
4892
5152
|
contextId: currentContext.contextId,
|
|
4893
5153
|
prepareParams: snapshot.prepareParams,
|
|
4894
5154
|
prepareKey: currentContext.prepareKey,
|
|
@@ -4896,8 +5156,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4896
5156
|
orderRevision: snapshot.orderRevision,
|
|
4897
5157
|
incrementVersion: true
|
|
4898
5158
|
});
|
|
4899
|
-
|
|
4900
|
-
return
|
|
5159
|
+
_context45.next = 11;
|
|
5160
|
+
return _this15.emitAvailabilityDiagnostic({
|
|
4901
5161
|
action: 'refresh',
|
|
4902
5162
|
contextId: currentContext.contextId,
|
|
4903
5163
|
contextVersion: projectionEntry.contextVersion,
|
|
@@ -4908,33 +5168,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4908
5168
|
reason: params.reason
|
|
4909
5169
|
});
|
|
4910
5170
|
case 11:
|
|
4911
|
-
return
|
|
5171
|
+
return _context45.abrupt("return", projectionEntry);
|
|
4912
5172
|
case 12:
|
|
4913
5173
|
case "end":
|
|
4914
|
-
return
|
|
5174
|
+
return _context45.stop();
|
|
4915
5175
|
}
|
|
4916
|
-
},
|
|
5176
|
+
}, _callee45);
|
|
4917
5177
|
}))();
|
|
4918
5178
|
this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
|
|
4919
|
-
|
|
4920
|
-
|
|
5179
|
+
_context46.prev = 11;
|
|
5180
|
+
_context46.next = 14;
|
|
4921
5181
|
return refreshPromise;
|
|
4922
5182
|
case 14:
|
|
4923
|
-
return
|
|
5183
|
+
return _context46.abrupt("return", _context46.sent);
|
|
4924
5184
|
case 15:
|
|
4925
|
-
|
|
5185
|
+
_context46.prev = 15;
|
|
4926
5186
|
current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
4927
5187
|
if (current === refreshPromise) {
|
|
4928
5188
|
this.availabilityProjectionRefreshInFlight.delete(params.contextId);
|
|
4929
5189
|
}
|
|
4930
|
-
return
|
|
5190
|
+
return _context46.finish(15);
|
|
4931
5191
|
case 19:
|
|
4932
5192
|
case "end":
|
|
4933
|
-
return
|
|
5193
|
+
return _context46.stop();
|
|
4934
5194
|
}
|
|
4935
|
-
},
|
|
5195
|
+
}, _callee46, this, [[11,, 15, 19]]);
|
|
4936
5196
|
}));
|
|
4937
|
-
function refreshAvailabilityContextProjection(
|
|
5197
|
+
function refreshAvailabilityContextProjection(_x30) {
|
|
4938
5198
|
return _refreshAvailabilityContextProjection.apply(this, arguments);
|
|
4939
5199
|
}
|
|
4940
5200
|
return refreshAvailabilityContextProjection;
|
|
@@ -4942,53 +5202,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4942
5202
|
}, {
|
|
4943
5203
|
key: "ensureAvailabilityContextProjection",
|
|
4944
5204
|
value: function () {
|
|
4945
|
-
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5205
|
+
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(contextId, reason) {
|
|
4946
5206
|
var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
|
|
4947
|
-
return _regeneratorRuntime().wrap(function
|
|
4948
|
-
while (1) switch (
|
|
5207
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
5208
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4949
5209
|
case 0:
|
|
4950
5210
|
retries = 0;
|
|
4951
5211
|
case 1:
|
|
4952
5212
|
if (!(retries < 3)) {
|
|
4953
|
-
|
|
5213
|
+
_context47.next = 19;
|
|
4954
5214
|
break;
|
|
4955
5215
|
}
|
|
4956
5216
|
context = this.getAvailabilityContextEntry(contextId);
|
|
4957
5217
|
currentOrderRevision = this.getCurrentOrderRevision();
|
|
4958
5218
|
projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
|
|
4959
5219
|
if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
|
|
4960
|
-
|
|
5220
|
+
_context47.next = 7;
|
|
4961
5221
|
break;
|
|
4962
5222
|
}
|
|
4963
|
-
return
|
|
5223
|
+
return _context47.abrupt("return", {
|
|
4964
5224
|
context: context,
|
|
4965
5225
|
projectionEntry: projectionEntry,
|
|
4966
5226
|
refreshed: false
|
|
4967
5227
|
});
|
|
4968
5228
|
case 7:
|
|
4969
|
-
|
|
5229
|
+
_context47.next = 9;
|
|
4970
5230
|
return this.refreshAvailabilityContextProjection({
|
|
4971
5231
|
contextId: contextId,
|
|
4972
5232
|
reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
|
|
4973
5233
|
previousOrderRevision: context.lastKnownOrderRevision
|
|
4974
5234
|
});
|
|
4975
5235
|
case 9:
|
|
4976
|
-
refreshedProjectionEntry =
|
|
5236
|
+
refreshedProjectionEntry = _context47.sent;
|
|
4977
5237
|
if (refreshedProjectionEntry) {
|
|
4978
|
-
|
|
5238
|
+
_context47.next = 13;
|
|
4979
5239
|
break;
|
|
4980
5240
|
}
|
|
4981
5241
|
retries += 1;
|
|
4982
|
-
return
|
|
5242
|
+
return _context47.abrupt("continue", 1);
|
|
4983
5243
|
case 13:
|
|
4984
5244
|
if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
4985
|
-
|
|
5245
|
+
_context47.next = 16;
|
|
4986
5246
|
break;
|
|
4987
5247
|
}
|
|
4988
5248
|
retries += 1;
|
|
4989
|
-
return
|
|
5249
|
+
return _context47.abrupt("continue", 1);
|
|
4990
5250
|
case 16:
|
|
4991
|
-
return
|
|
5251
|
+
return _context47.abrupt("return", {
|
|
4992
5252
|
context: this.getAvailabilityContextEntry(contextId),
|
|
4993
5253
|
projectionEntry: refreshedProjectionEntry,
|
|
4994
5254
|
refreshed: true
|
|
@@ -5000,11 +5260,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5000
5260
|
});
|
|
5001
5261
|
case 20:
|
|
5002
5262
|
case "end":
|
|
5003
|
-
return
|
|
5263
|
+
return _context47.stop();
|
|
5004
5264
|
}
|
|
5005
|
-
},
|
|
5265
|
+
}, _callee47, this);
|
|
5006
5266
|
}));
|
|
5007
|
-
function ensureAvailabilityContextProjection(
|
|
5267
|
+
function ensureAvailabilityContextProjection(_x31, _x32) {
|
|
5008
5268
|
return _ensureAvailabilityContextProjection.apply(this, arguments);
|
|
5009
5269
|
}
|
|
5010
5270
|
return ensureAvailabilityContextProjection;
|
|
@@ -5012,18 +5272,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5012
5272
|
}, {
|
|
5013
5273
|
key: "tryAcquireAvailabilityCommitLock",
|
|
5014
5274
|
value: function () {
|
|
5015
|
-
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5275
|
+
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId) {
|
|
5016
5276
|
var _currentContext$activ;
|
|
5017
5277
|
var _waitingContext$activ, waitingContext, currentContext;
|
|
5018
|
-
return _regeneratorRuntime().wrap(function
|
|
5019
|
-
while (1) switch (
|
|
5278
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5279
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
5020
5280
|
case 0:
|
|
5021
5281
|
if (!this.availabilityCommitLocks.has(contextId)) {
|
|
5022
|
-
|
|
5282
|
+
_context48.next = 5;
|
|
5023
5283
|
break;
|
|
5024
5284
|
}
|
|
5025
5285
|
waitingContext = this.availabilityContextRegistry.get(contextId);
|
|
5026
|
-
|
|
5286
|
+
_context48.next = 4;
|
|
5027
5287
|
return this.emitAvailabilityDiagnostic({
|
|
5028
5288
|
action: 'commit_lock_wait',
|
|
5029
5289
|
contextId: contextId,
|
|
@@ -5040,7 +5300,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5040
5300
|
case 5:
|
|
5041
5301
|
this.availabilityCommitLocks.add(contextId);
|
|
5042
5302
|
currentContext = this.availabilityContextRegistry.get(contextId);
|
|
5043
|
-
|
|
5303
|
+
_context48.next = 9;
|
|
5044
5304
|
return this.emitAvailabilityDiagnostic({
|
|
5045
5305
|
action: 'commit_lock_acquired',
|
|
5046
5306
|
contextId: contextId,
|
|
@@ -5052,11 +5312,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5052
5312
|
});
|
|
5053
5313
|
case 9:
|
|
5054
5314
|
case "end":
|
|
5055
|
-
return
|
|
5315
|
+
return _context48.stop();
|
|
5056
5316
|
}
|
|
5057
|
-
},
|
|
5317
|
+
}, _callee48, this);
|
|
5058
5318
|
}));
|
|
5059
|
-
function tryAcquireAvailabilityCommitLock(
|
|
5319
|
+
function tryAcquireAvailabilityCommitLock(_x33) {
|
|
5060
5320
|
return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
|
|
5061
5321
|
}
|
|
5062
5322
|
return tryAcquireAvailabilityCommitLock;
|
|
@@ -5064,15 +5324,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5064
5324
|
}, {
|
|
5065
5325
|
key: "releaseAvailabilityCommitLock",
|
|
5066
5326
|
value: function () {
|
|
5067
|
-
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5327
|
+
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(contextId) {
|
|
5068
5328
|
var _releasedContext$acti;
|
|
5069
5329
|
var releasedContext;
|
|
5070
|
-
return _regeneratorRuntime().wrap(function
|
|
5071
|
-
while (1) switch (
|
|
5330
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
5331
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
5072
5332
|
case 0:
|
|
5073
5333
|
this.availabilityCommitLocks.delete(contextId);
|
|
5074
5334
|
releasedContext = this.availabilityContextRegistry.get(contextId);
|
|
5075
|
-
|
|
5335
|
+
_context49.next = 4;
|
|
5076
5336
|
return this.emitAvailabilityDiagnostic({
|
|
5077
5337
|
action: 'commit_lock_released',
|
|
5078
5338
|
contextId: contextId,
|
|
@@ -5084,11 +5344,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5084
5344
|
});
|
|
5085
5345
|
case 4:
|
|
5086
5346
|
case "end":
|
|
5087
|
-
return
|
|
5347
|
+
return _context49.stop();
|
|
5088
5348
|
}
|
|
5089
|
-
},
|
|
5349
|
+
}, _callee49, this);
|
|
5090
5350
|
}));
|
|
5091
|
-
function releaseAvailabilityCommitLock(
|
|
5351
|
+
function releaseAvailabilityCommitLock(_x34) {
|
|
5092
5352
|
return _releaseAvailabilityCommitLock.apply(this, arguments);
|
|
5093
5353
|
}
|
|
5094
5354
|
return releaseAvailabilityCommitLock;
|
|
@@ -5096,20 +5356,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5096
5356
|
}, {
|
|
5097
5357
|
key: "prepareAvailabilityProjection",
|
|
5098
5358
|
value: (function () {
|
|
5099
|
-
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5359
|
+
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
|
|
5100
5360
|
var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
|
|
5101
|
-
return _regeneratorRuntime().wrap(function
|
|
5102
|
-
while (1) switch (
|
|
5361
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
5362
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
5103
5363
|
case 0:
|
|
5104
5364
|
this.assertAvailabilityPrepareParams(params);
|
|
5105
|
-
|
|
5365
|
+
_context50.next = 3;
|
|
5106
5366
|
return this.resolveAvailabilityPrepareDefaults(params);
|
|
5107
5367
|
case 3:
|
|
5108
|
-
paramsWithDefaults =
|
|
5109
|
-
|
|
5368
|
+
paramsWithDefaults = _context50.sent;
|
|
5369
|
+
_context50.next = 6;
|
|
5110
5370
|
return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
|
|
5111
5371
|
case 6:
|
|
5112
|
-
_yield$this$getShared =
|
|
5372
|
+
_yield$this$getShared = _context50.sent;
|
|
5113
5373
|
prepareKey = _yield$this$getShared.prepareKey;
|
|
5114
5374
|
snapshot = _yield$this$getShared.snapshot;
|
|
5115
5375
|
contextId = this.createAvailabilityContextId();
|
|
@@ -5130,7 +5390,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5130
5390
|
refreshed: false,
|
|
5131
5391
|
reason: 'prepare'
|
|
5132
5392
|
};
|
|
5133
|
-
|
|
5393
|
+
_context50.next = 16;
|
|
5134
5394
|
return this.emitAvailabilityDiagnostic({
|
|
5135
5395
|
action: 'prepare',
|
|
5136
5396
|
contextId: contextId,
|
|
@@ -5141,17 +5401,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5141
5401
|
reason: 'prepare'
|
|
5142
5402
|
});
|
|
5143
5403
|
case 16:
|
|
5144
|
-
|
|
5404
|
+
_context50.next = 18;
|
|
5145
5405
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
|
|
5146
5406
|
case 18:
|
|
5147
|
-
return
|
|
5407
|
+
return _context50.abrupt("return", handle);
|
|
5148
5408
|
case 19:
|
|
5149
5409
|
case "end":
|
|
5150
|
-
return
|
|
5410
|
+
return _context50.stop();
|
|
5151
5411
|
}
|
|
5152
|
-
},
|
|
5412
|
+
}, _callee50, this);
|
|
5153
5413
|
}));
|
|
5154
|
-
function prepareAvailabilityProjection(
|
|
5414
|
+
function prepareAvailabilityProjection(_x35) {
|
|
5155
5415
|
return _prepareAvailabilityProjection.apply(this, arguments);
|
|
5156
5416
|
}
|
|
5157
5417
|
return prepareAvailabilityProjection;
|
|
@@ -5159,12 +5419,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5159
5419
|
}, {
|
|
5160
5420
|
key: "getProductTimeRanges",
|
|
5161
5421
|
value: (function () {
|
|
5162
|
-
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5422
|
+
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(contextId) {
|
|
5163
5423
|
var _this$otherParams$pla2,
|
|
5164
|
-
_this$
|
|
5424
|
+
_this$otherParams29,
|
|
5165
5425
|
_context$prepareParam,
|
|
5166
5426
|
_extractFixedOffsetMi,
|
|
5167
|
-
|
|
5427
|
+
_this16 = this;
|
|
5168
5428
|
var request,
|
|
5169
5429
|
_yield$this$ensureAva,
|
|
5170
5430
|
context,
|
|
@@ -5179,26 +5439,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5179
5439
|
businessDate,
|
|
5180
5440
|
rememberedStartAtByProductId,
|
|
5181
5441
|
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
5182
|
-
|
|
5183
|
-
return _regeneratorRuntime().wrap(function
|
|
5184
|
-
while (1) switch (
|
|
5442
|
+
_args51 = arguments;
|
|
5443
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
5444
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
5185
5445
|
case 0:
|
|
5186
|
-
request =
|
|
5187
|
-
|
|
5446
|
+
request = _args51.length > 1 && _args51[1] !== undefined ? _args51[1] : {};
|
|
5447
|
+
_context51.next = 3;
|
|
5188
5448
|
return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
|
|
5189
5449
|
case 3:
|
|
5190
|
-
_yield$this$ensureAva =
|
|
5450
|
+
_yield$this$ensureAva = _context51.sent;
|
|
5191
5451
|
context = _yield$this$ensureAva.context;
|
|
5192
5452
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
5193
5453
|
contextVersion = context.activeVersion;
|
|
5194
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$
|
|
5454
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
5195
5455
|
isEditingContext = Boolean((_context$prepareParam = context.prepareParams.editingProductLineUids) === null || _context$prepareParam === void 0 ? void 0 : _context$prepareParam.length);
|
|
5196
5456
|
editingOffset = (_extractFixedOffsetMi = extractFixedOffsetMinutes(projectionEntry.projection.meta.now)) !== null && _extractFixedOffsetMi !== void 0 ? _extractFixedOffsetMi : this.getAvailabilityRuntimeOffsetMinutes(); // This new editing input represents an absolute instant. Normalize it once
|
|
5197
5457
|
// to the projection's fixed business clock before the wall-clock planner.
|
|
5198
|
-
editingStartAtByProductId = isEditingContext && request.editingStartAtByProductId ? Object.fromEntries(Object.entries(request.editingStartAtByProductId).map(function (
|
|
5199
|
-
var
|
|
5200
|
-
productId =
|
|
5201
|
-
startAt =
|
|
5458
|
+
editingStartAtByProductId = isEditingContext && request.editingStartAtByProductId ? Object.fromEntries(Object.entries(request.editingStartAtByProductId).map(function (_ref53) {
|
|
5459
|
+
var _ref54 = _slicedToArray(_ref53, 2),
|
|
5460
|
+
productId = _ref54[0],
|
|
5461
|
+
startAt = _ref54[1];
|
|
5202
5462
|
try {
|
|
5203
5463
|
var _extractFixedOffsetMi2;
|
|
5204
5464
|
var scalar = localDateTimeToScalar(parseLocalDateTime(startAt));
|
|
@@ -5222,7 +5482,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5222
5482
|
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && !rememberedStartAtByProductId && (editingStarts.length > 0 || Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
5223
5483
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
5224
5484
|
}));
|
|
5225
|
-
return
|
|
5485
|
+
return _context51.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), {}, {
|
|
5226
5486
|
dateRange: dateRange,
|
|
5227
5487
|
editingStartAtByProductId: editingStartAtByProductId,
|
|
5228
5488
|
rememberedStartAtByProductId: rememberedStartAtByProductId
|
|
@@ -5240,17 +5500,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5240
5500
|
}).map(function (group) {
|
|
5241
5501
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
5242
5502
|
ranges: group.ranges.map(function (candidate) {
|
|
5243
|
-
return
|
|
5503
|
+
return _this16.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
|
|
5244
5504
|
})
|
|
5245
5505
|
});
|
|
5246
5506
|
}));
|
|
5247
5507
|
case 17:
|
|
5248
5508
|
case "end":
|
|
5249
|
-
return
|
|
5509
|
+
return _context51.stop();
|
|
5250
5510
|
}
|
|
5251
|
-
},
|
|
5511
|
+
}, _callee51, this);
|
|
5252
5512
|
}));
|
|
5253
|
-
function getProductTimeRanges(
|
|
5513
|
+
function getProductTimeRanges(_x36) {
|
|
5254
5514
|
return _getProductTimeRanges.apply(this, arguments);
|
|
5255
5515
|
}
|
|
5256
5516
|
return getProductTimeRanges;
|
|
@@ -5258,21 +5518,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5258
5518
|
}, {
|
|
5259
5519
|
key: "queryBookingAvailability",
|
|
5260
5520
|
value: (function () {
|
|
5261
|
-
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5262
|
-
var _this$otherParams$pla3, _this$
|
|
5521
|
+
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(contextId, request) {
|
|
5522
|
+
var _this$otherParams$pla3, _this$otherParams30, _context$prepareParam2;
|
|
5263
5523
|
var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, queryRequest, result, contextVersion, contextualResult;
|
|
5264
|
-
return _regeneratorRuntime().wrap(function
|
|
5265
|
-
while (1) switch (
|
|
5524
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
5525
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
5266
5526
|
case 0:
|
|
5267
|
-
|
|
5527
|
+
_context52.next = 2;
|
|
5268
5528
|
return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
|
|
5269
5529
|
case 2:
|
|
5270
|
-
_yield$this$ensureAva2 =
|
|
5530
|
+
_yield$this$ensureAva2 = _context52.sent;
|
|
5271
5531
|
context = _yield$this$ensureAva2.context;
|
|
5272
5532
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
5273
5533
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
5274
5534
|
this.assertContextualQueryFreshness(context, request);
|
|
5275
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$
|
|
5535
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
|
|
5276
5536
|
queryRequest = request.target === 'date' || request.target === 'product' ? _objectSpread(_objectSpread({}, request), {}, {
|
|
5277
5537
|
dateRange: request.dateRange || this.getAvailabilityBusinessDateRange(projectionEntry.projection)
|
|
5278
5538
|
}) : request;
|
|
@@ -5308,18 +5568,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5308
5568
|
});
|
|
5309
5569
|
})
|
|
5310
5570
|
}) : result;
|
|
5311
|
-
return
|
|
5571
|
+
return _context52.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
|
|
5312
5572
|
contextId: context.contextId,
|
|
5313
5573
|
contextVersion: contextVersion,
|
|
5314
5574
|
refreshed: refreshed
|
|
5315
5575
|
}));
|
|
5316
5576
|
case 13:
|
|
5317
5577
|
case "end":
|
|
5318
|
-
return
|
|
5578
|
+
return _context52.stop();
|
|
5319
5579
|
}
|
|
5320
|
-
},
|
|
5580
|
+
}, _callee52, this);
|
|
5321
5581
|
}));
|
|
5322
|
-
function queryBookingAvailability(
|
|
5582
|
+
function queryBookingAvailability(_x37, _x38) {
|
|
5323
5583
|
return _queryBookingAvailability.apply(this, arguments);
|
|
5324
5584
|
}
|
|
5325
5585
|
return queryBookingAvailability;
|
|
@@ -5368,18 +5628,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5368
5628
|
}, {
|
|
5369
5629
|
key: "findProductLineByUid",
|
|
5370
5630
|
value: function findProductLineByUid(productLineUid) {
|
|
5371
|
-
var _this$
|
|
5372
|
-
return (((_this$
|
|
5631
|
+
var _this$getTempOrder3;
|
|
5632
|
+
return (((_this$getTempOrder3 = this.getTempOrder()) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.products) || []).find(function (product) {
|
|
5373
5633
|
return getProductLineUid(product) === String(productLineUid);
|
|
5374
5634
|
});
|
|
5375
5635
|
}
|
|
5376
5636
|
}, {
|
|
5377
5637
|
key: "findLinkedBooking",
|
|
5378
5638
|
value: function findLinkedBooking(product) {
|
|
5379
|
-
var
|
|
5639
|
+
var _ref55, _product$booking_uid3, _product$metadata7, _this$getTempOrder4;
|
|
5380
5640
|
var productUid = getProductLineUid(product);
|
|
5381
|
-
var bookingUid = String((
|
|
5382
|
-
return (((_this$
|
|
5641
|
+
var bookingUid = String((_ref55 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.booking_uid) !== null && _ref55 !== void 0 ? _ref55 : '');
|
|
5642
|
+
return (((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.bookings) || []).find(function (booking) {
|
|
5383
5643
|
var _booking$product_uid3;
|
|
5384
5644
|
return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
|
|
5385
5645
|
});
|
|
@@ -5387,46 +5647,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5387
5647
|
}, {
|
|
5388
5648
|
key: "removeBookingProductsOutsideStartDate",
|
|
5389
5649
|
value: function () {
|
|
5390
|
-
var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5391
|
-
var _this$
|
|
5392
|
-
_this$
|
|
5393
|
-
|
|
5650
|
+
var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(startDate) {
|
|
5651
|
+
var _this$getTempOrder5,
|
|
5652
|
+
_this$otherParams31,
|
|
5653
|
+
_this17 = this;
|
|
5394
5654
|
var products, targetDate, identities;
|
|
5395
|
-
return _regeneratorRuntime().wrap(function
|
|
5396
|
-
while (1) switch (
|
|
5655
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5656
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
5397
5657
|
case 0:
|
|
5398
|
-
products = ((_this$
|
|
5399
|
-
if (!(((_this$
|
|
5400
|
-
|
|
5658
|
+
products = ((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || [];
|
|
5659
|
+
if (!(((_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.enforceSingleBookingStartDate) !== true)) {
|
|
5660
|
+
_context53.next = 3;
|
|
5401
5661
|
break;
|
|
5402
5662
|
}
|
|
5403
|
-
return
|
|
5663
|
+
return _context53.abrupt("return", products);
|
|
5404
5664
|
case 3:
|
|
5405
5665
|
targetDate = getVisibleCalendarDate(startDate);
|
|
5406
5666
|
if (targetDate) {
|
|
5407
|
-
|
|
5667
|
+
_context53.next = 6;
|
|
5408
5668
|
break;
|
|
5409
5669
|
}
|
|
5410
|
-
return
|
|
5670
|
+
return _context53.abrupt("return", products);
|
|
5411
5671
|
case 6:
|
|
5412
5672
|
identities = products.flatMap(function (product) {
|
|
5413
|
-
var _product$
|
|
5414
|
-
if (!getProductLineUid(product) || (product === null || product === void 0 || (_product$
|
|
5673
|
+
var _product$metadata8;
|
|
5674
|
+
if (!getProductLineUid(product) || (product === null || product === void 0 || (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.product_add_schedule_time) != null) {
|
|
5415
5675
|
return [];
|
|
5416
5676
|
}
|
|
5417
|
-
var booking =
|
|
5677
|
+
var booking = _this17.findLinkedBooking(product);
|
|
5418
5678
|
if (!booking || isFulfillmentTimingBooking(booking)) return [];
|
|
5419
5679
|
var bookingDate = getVisibleCalendarDate(booking.start_date);
|
|
5420
5680
|
return bookingDate && bookingDate !== targetDate ? [buildAvailabilityLineIdentity(product)] : [];
|
|
5421
5681
|
});
|
|
5422
|
-
return
|
|
5682
|
+
return _context53.abrupt("return", identities.length ? this.removeProductsFromOrder(identities) : products);
|
|
5423
5683
|
case 8:
|
|
5424
5684
|
case "end":
|
|
5425
|
-
return
|
|
5685
|
+
return _context53.stop();
|
|
5426
5686
|
}
|
|
5427
|
-
},
|
|
5687
|
+
}, _callee53, this);
|
|
5428
5688
|
}));
|
|
5429
|
-
function removeBookingProductsOutsideStartDate(
|
|
5689
|
+
function removeBookingProductsOutsideStartDate(_x39) {
|
|
5430
5690
|
return _removeBookingProductsOutsideStartDate.apply(this, arguments);
|
|
5431
5691
|
}
|
|
5432
5692
|
return removeBookingProductsOutsideStartDate;
|
|
@@ -5434,20 +5694,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5434
5694
|
}, {
|
|
5435
5695
|
key: "commitAvailabilitySelection",
|
|
5436
5696
|
value: (function () {
|
|
5437
|
-
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5697
|
+
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(contextId, params) {
|
|
5438
5698
|
var _this$otherParams$pla4,
|
|
5439
|
-
_this$
|
|
5699
|
+
_this$otherParams32,
|
|
5440
5700
|
_params$availabilityC,
|
|
5441
5701
|
_this$store$order11,
|
|
5442
5702
|
_this$store$order11$e,
|
|
5443
|
-
|
|
5444
|
-
var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount,
|
|
5445
|
-
return _regeneratorRuntime().wrap(function
|
|
5446
|
-
while (1) switch (
|
|
5703
|
+
_this18 = this;
|
|
5704
|
+
var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref56, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla5, _this$otherParams33, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla6, _this$otherParams34, _ref57, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref58, _ref59, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, _params$orderProduct9, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, selectedProduct, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, candidateBusinessDate, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, legacyBooking, legacyResources, selectedResources, resourceKeys, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref60, _transformed$product_4, _this$getTempOrder6, _this$getTempOrder7, _params$salesNotes, _params$salesNotes2, _ref61, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
|
|
5705
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5706
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
5447
5707
|
case 0:
|
|
5448
5708
|
normalizedContextId = String(contextId || '').trim();
|
|
5449
5709
|
if (normalizedContextId) {
|
|
5450
|
-
|
|
5710
|
+
_context54.next = 3;
|
|
5451
5711
|
break;
|
|
5452
5712
|
}
|
|
5453
5713
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
|
|
@@ -5455,8 +5715,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5455
5715
|
});
|
|
5456
5716
|
case 3:
|
|
5457
5717
|
isRememberedSelection = params.selectionIntent === 'remembered';
|
|
5458
|
-
if (!(isRememberedSelection && (String((_this$otherParams$pla4 = (_this$
|
|
5459
|
-
|
|
5718
|
+
if (!(isRememberedSelection && (String((_this$otherParams$pla4 = (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add'))) {
|
|
5719
|
+
_context54.next = 6;
|
|
5460
5720
|
break;
|
|
5461
5721
|
}
|
|
5462
5722
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
|
|
@@ -5467,27 +5727,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5467
5727
|
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);
|
|
5468
5728
|
rememberedOrder = hasCommitGuard ? this.getTempOrder() : null;
|
|
5469
5729
|
getRememberedCommitIdentity = function getRememberedCommitIdentity() {
|
|
5470
|
-
var
|
|
5730
|
+
var _this18$otherParams$s, _this18$otherParams, _this18$otherParams2, _this18$core, _this18$getTempOrder, _this18$getTempOrder2;
|
|
5471
5731
|
return JSON.stringify(stableValue({
|
|
5472
|
-
scope:
|
|
5473
|
-
shopId: (
|
|
5474
|
-
contextShopId: (
|
|
5475
|
-
orderId: (
|
|
5476
|
-
externalSaleNumber: (
|
|
5732
|
+
scope: _this18.getAvailabilityScopeDescriptor(),
|
|
5733
|
+
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,
|
|
5734
|
+
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,
|
|
5735
|
+
orderId: (_this18$getTempOrder = _this18.getTempOrder()) === null || _this18$getTempOrder === void 0 ? void 0 : _this18$getTempOrder.order_id,
|
|
5736
|
+
externalSaleNumber: (_this18$getTempOrder2 = _this18.getTempOrder()) === null || _this18$getTempOrder2 === void 0 ? void 0 : _this18$getTempOrder2.external_sale_number
|
|
5477
5737
|
}));
|
|
5478
5738
|
};
|
|
5479
5739
|
rememberedCommitIdentity = hasCommitGuard ? getRememberedCommitIdentity() : '';
|
|
5480
5740
|
availabilityCommitTargetGuard = function availabilityCommitTargetGuard() {
|
|
5481
|
-
return
|
|
5741
|
+
return _this18.getTempOrder() === rememberedOrder && getRememberedCommitIdentity() === rememberedCommitIdentity;
|
|
5482
5742
|
};
|
|
5483
5743
|
guardedCommitPublished = false;
|
|
5484
|
-
|
|
5744
|
+
_context54.next = 16;
|
|
5485
5745
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
5486
5746
|
case 16:
|
|
5487
|
-
|
|
5747
|
+
_context54.prev = 16;
|
|
5488
5748
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
5489
5749
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
5490
|
-
|
|
5750
|
+
_context54.next = 20;
|
|
5491
5751
|
break;
|
|
5492
5752
|
}
|
|
5493
5753
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
@@ -5495,16 +5755,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5495
5755
|
});
|
|
5496
5756
|
case 20:
|
|
5497
5757
|
if (!(params.mode === 'edit' && bookingCount !== 1)) {
|
|
5498
|
-
|
|
5758
|
+
_context54.next = 22;
|
|
5499
5759
|
break;
|
|
5500
5760
|
}
|
|
5501
5761
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
5502
5762
|
bookingCount: bookingCount
|
|
5503
5763
|
});
|
|
5504
5764
|
case 22:
|
|
5505
|
-
orderProductQuantity = (
|
|
5765
|
+
orderProductQuantity = (_ref56 = (_params$orderProduct$ = (_params$orderProduct = params.orderProduct) === null || _params$orderProduct === void 0 ? void 0 : _params$orderProduct.num) !== null && _params$orderProduct$ !== void 0 ? _params$orderProduct$ : (_params$orderProduct2 = params.orderProduct) === null || _params$orderProduct2 === void 0 ? void 0 : _params$orderProduct2.quantity) !== null && _ref56 !== void 0 ? _ref56 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
|
|
5506
5766
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
5507
|
-
|
|
5767
|
+
_context54.next = 25;
|
|
5508
5768
|
break;
|
|
5509
5769
|
}
|
|
5510
5770
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
@@ -5514,22 +5774,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5514
5774
|
case 25:
|
|
5515
5775
|
partySize = Number(params.partySize);
|
|
5516
5776
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
5517
|
-
|
|
5777
|
+
_context54.next = 28;
|
|
5518
5778
|
break;
|
|
5519
5779
|
}
|
|
5520
5780
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
5521
5781
|
partySize: params.partySize
|
|
5522
5782
|
});
|
|
5523
5783
|
case 28:
|
|
5524
|
-
|
|
5784
|
+
_context54.next = 30;
|
|
5525
5785
|
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
5526
5786
|
case 30:
|
|
5527
|
-
_yield$this$ensureAva3 =
|
|
5787
|
+
_yield$this$ensureAva3 = _context54.sent;
|
|
5528
5788
|
context = _yield$this$ensureAva3.context;
|
|
5529
5789
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
5530
5790
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
5531
5791
|
if (!refreshed) {
|
|
5532
|
-
|
|
5792
|
+
_context54.next = 36;
|
|
5533
5793
|
break;
|
|
5534
5794
|
}
|
|
5535
5795
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5540,11 +5800,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5540
5800
|
case 36:
|
|
5541
5801
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
5542
5802
|
if (!(params.mode === 'edit')) {
|
|
5543
|
-
|
|
5803
|
+
_context54.next = 42;
|
|
5544
5804
|
break;
|
|
5545
5805
|
}
|
|
5546
5806
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
5547
|
-
|
|
5807
|
+
_context54.next = 40;
|
|
5548
5808
|
break;
|
|
5549
5809
|
}
|
|
5550
5810
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -5553,11 +5813,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5553
5813
|
editingProductLineUids: boundEditingUids
|
|
5554
5814
|
});
|
|
5555
5815
|
case 40:
|
|
5556
|
-
|
|
5816
|
+
_context54.next = 44;
|
|
5557
5817
|
break;
|
|
5558
5818
|
case 42:
|
|
5559
5819
|
if (!(boundEditingUids.length > 0)) {
|
|
5560
|
-
|
|
5820
|
+
_context54.next = 44;
|
|
5561
5821
|
break;
|
|
5562
5822
|
}
|
|
5563
5823
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
@@ -5566,7 +5826,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5566
5826
|
});
|
|
5567
5827
|
case 44:
|
|
5568
5828
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
5569
|
-
|
|
5829
|
+
_context54.next = 46;
|
|
5570
5830
|
break;
|
|
5571
5831
|
}
|
|
5572
5832
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5576,7 +5836,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5576
5836
|
});
|
|
5577
5837
|
case 46:
|
|
5578
5838
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
5579
|
-
|
|
5839
|
+
_context54.next = 48;
|
|
5580
5840
|
break;
|
|
5581
5841
|
}
|
|
5582
5842
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -5587,7 +5847,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5587
5847
|
});
|
|
5588
5848
|
case 48:
|
|
5589
5849
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
5590
|
-
|
|
5850
|
+
_context54.next = 50;
|
|
5591
5851
|
break;
|
|
5592
5852
|
}
|
|
5593
5853
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -5599,7 +5859,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5599
5859
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
5600
5860
|
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;
|
|
5601
5861
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
5602
|
-
|
|
5862
|
+
_context54.next = 54;
|
|
5603
5863
|
break;
|
|
5604
5864
|
}
|
|
5605
5865
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
@@ -5608,14 +5868,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5608
5868
|
});
|
|
5609
5869
|
case 54:
|
|
5610
5870
|
if (!(params.mode === 'edit' && !params.productLineUid)) {
|
|
5611
|
-
|
|
5871
|
+
_context54.next = 56;
|
|
5612
5872
|
break;
|
|
5613
5873
|
}
|
|
5614
5874
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
5615
5875
|
case 56:
|
|
5616
5876
|
editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
5617
5877
|
if (!(params.mode === 'edit' && !editingLine)) {
|
|
5618
|
-
|
|
5878
|
+
_context54.next = 59;
|
|
5619
5879
|
break;
|
|
5620
5880
|
}
|
|
5621
5881
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
@@ -5623,7 +5883,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5623
5883
|
});
|
|
5624
5884
|
case 59:
|
|
5625
5885
|
if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
5626
|
-
|
|
5886
|
+
_context54.next = 61;
|
|
5627
5887
|
break;
|
|
5628
5888
|
}
|
|
5629
5889
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -5633,7 +5893,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5633
5893
|
});
|
|
5634
5894
|
case 61:
|
|
5635
5895
|
if (Array.isArray(params.requirementSelections)) {
|
|
5636
|
-
|
|
5896
|
+
_context54.next = 63;
|
|
5637
5897
|
break;
|
|
5638
5898
|
}
|
|
5639
5899
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
@@ -5644,8 +5904,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5644
5904
|
selectedProduct = baseProjection.products.find(function (item) {
|
|
5645
5905
|
return sameAvailabilityId(item.id, params.candidate.productId);
|
|
5646
5906
|
});
|
|
5647
|
-
if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$
|
|
5648
|
-
|
|
5907
|
+
if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.platform) !== null && _this$otherParams$pla5 !== void 0 ? _this$otherParams$pla5 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add' || (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) !== 'duration'))) {
|
|
5908
|
+
_context54.next = 67;
|
|
5649
5909
|
break;
|
|
5650
5910
|
}
|
|
5651
5911
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
|
|
@@ -5659,7 +5919,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5659
5919
|
};
|
|
5660
5920
|
prepareParams = baseProjection.meta.prepareParams;
|
|
5661
5921
|
if (prepareParams) {
|
|
5662
|
-
|
|
5922
|
+
_context54.next = 71;
|
|
5663
5923
|
break;
|
|
5664
5924
|
}
|
|
5665
5925
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
@@ -5671,7 +5931,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5671
5931
|
})),
|
|
5672
5932
|
includesInjectedRawOccupancies: true
|
|
5673
5933
|
};
|
|
5674
|
-
|
|
5934
|
+
_context54.next = 74;
|
|
5675
5935
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
5676
5936
|
editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
|
|
5677
5937
|
}), {
|
|
@@ -5680,13 +5940,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5680
5940
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
5681
5941
|
});
|
|
5682
5942
|
case 74:
|
|
5683
|
-
commitSnapshot =
|
|
5943
|
+
commitSnapshot = _context54.sent;
|
|
5684
5944
|
refreshedProjection = commitSnapshot.projection;
|
|
5685
5945
|
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 : ''))) {
|
|
5686
|
-
|
|
5946
|
+
_context54.next = 81;
|
|
5687
5947
|
break;
|
|
5688
5948
|
}
|
|
5689
|
-
|
|
5949
|
+
_context54.next = 79;
|
|
5690
5950
|
return this.refreshAvailabilityContextProjection({
|
|
5691
5951
|
contextId: normalizedContextId,
|
|
5692
5952
|
reason: 'commit_order_revision_changed',
|
|
@@ -5707,7 +5967,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5707
5967
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
5708
5968
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
5709
5969
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
5710
|
-
allowPosAvailabilityOverride = String((_this$otherParams$pla6 = (_this$
|
|
5970
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla6 = (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.platform) !== null && _this$otherParams$pla6 !== void 0 ? _this$otherParams$pla6 : '').trim().toLowerCase() === 'pos' && !isRememberedSelection;
|
|
5711
5971
|
candidateBusinessDate = params.candidate.businessDate || ((selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) === 'duration' && this.usesDurationTimeGrid(refreshedProjection) ? getDurationBusinessDate(refreshedProjection, params.candidate.startAt) : params.candidate.startAt.slice(0, 10));
|
|
5712
5972
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
5713
5973
|
productIds: [params.candidate.productId],
|
|
@@ -5741,7 +6001,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5741
6001
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
5742
6002
|
});
|
|
5743
6003
|
if (refreshedCandidateBase) {
|
|
5744
|
-
|
|
6004
|
+
_context54.next = 90;
|
|
5745
6005
|
break;
|
|
5746
6006
|
}
|
|
5747
6007
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -5754,7 +6014,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5754
6014
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
5755
6015
|
});
|
|
5756
6016
|
if (product) {
|
|
5757
|
-
|
|
6017
|
+
_context54.next = 93;
|
|
5758
6018
|
break;
|
|
5759
6019
|
}
|
|
5760
6020
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
@@ -5793,7 +6053,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5793
6053
|
});
|
|
5794
6054
|
}
|
|
5795
6055
|
if (validation.ok) {
|
|
5796
|
-
|
|
6056
|
+
_context54.next = 98;
|
|
5797
6057
|
break;
|
|
5798
6058
|
}
|
|
5799
6059
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -5816,7 +6076,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5816
6076
|
incrementVersion: true
|
|
5817
6077
|
});
|
|
5818
6078
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
5819
|
-
|
|
6079
|
+
_context54.next = 102;
|
|
5820
6080
|
return this.emitAvailabilityDiagnostic({
|
|
5821
6081
|
action: 'refresh',
|
|
5822
6082
|
contextId: normalizedContextId,
|
|
@@ -5840,9 +6100,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5840
6100
|
availabilityCommitGuard = hasCommitGuard ? function () {
|
|
5841
6101
|
var _params$availabilityC2;
|
|
5842
6102
|
(_params$availabilityC2 = params.availabilityCommitGuard) === null || _params$availabilityC2 === void 0 || _params$availabilityC2.call(params);
|
|
5843
|
-
|
|
6103
|
+
_this18.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
5844
6104
|
if (!availabilityCommitTargetGuard()) {
|
|
5845
|
-
throw
|
|
6105
|
+
throw _this18.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '记忆时间加购期间订单或业务已变化');
|
|
5846
6106
|
}
|
|
5847
6107
|
if (!isRememberedSelection) return;
|
|
5848
6108
|
var currentValidation = validateAvailabilitySelection(refreshedProjection, {
|
|
@@ -5863,7 +6123,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5863
6123
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
5864
6124
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
5865
6125
|
if (!(params.mode === 'edit' && !existingBookingUid)) {
|
|
5866
|
-
|
|
6126
|
+
_context54.next = 109;
|
|
5867
6127
|
break;
|
|
5868
6128
|
}
|
|
5869
6129
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
@@ -5877,11 +6137,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5877
6137
|
product: product,
|
|
5878
6138
|
resources: refreshedProjection.resources,
|
|
5879
6139
|
bookingUid: existingBookingUid || undefined,
|
|
5880
|
-
holder: (
|
|
5881
|
-
holderIds: (
|
|
6140
|
+
holder: (_ref57 = (_params$orderProduct$3 = (_params$orderProduct6 = params.orderProduct) === null || _params$orderProduct6 === void 0 || (_params$orderProduct6 = _params$orderProduct6._extend) === null || _params$orderProduct6 === void 0 ? void 0 : _params$orderProduct6.holder) !== null && _params$orderProduct$3 !== void 0 ? _params$orderProduct$3 : existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _ref57 !== void 0 ? _ref57 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
|
|
6141
|
+
holderIds: (_ref58 = (_ref59 = (_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 && _ref59 !== void 0 ? _ref59 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref58 !== void 0 ? _ref58 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
|
|
5882
6142
|
});
|
|
5883
6143
|
if (!(isRememberedSelection && (_params$orderProduct9 = params.orderProduct) !== null && _params$orderProduct9 !== void 0 && (_params$orderProduct9 = _params$orderProduct9._extend) !== null && _params$orderProduct9 !== void 0 && _params$orderProduct9.resource)) {
|
|
5884
|
-
|
|
6144
|
+
_context54.next = 119;
|
|
5885
6145
|
break;
|
|
5886
6146
|
}
|
|
5887
6147
|
// AutoClose 与编辑共用旧资源协议。仅复用其结构,实际资源及每份容量
|
|
@@ -5901,7 +6161,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5901
6161
|
return sameAvailabilityId(selected.form_id, resource.form_id);
|
|
5902
6162
|
});
|
|
5903
6163
|
}))) {
|
|
5904
|
-
|
|
6164
|
+
_context54.next = 118;
|
|
5905
6165
|
break;
|
|
5906
6166
|
}
|
|
5907
6167
|
throw new AvailabilityError('REVALIDATION_FAILED', '记忆时间的资源与本次校验结果不一致');
|
|
@@ -5918,7 +6178,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5918
6178
|
quantity: bookingCount
|
|
5919
6179
|
}), 'unified_booking_sales', product);
|
|
5920
6180
|
if (transformed) {
|
|
5921
|
-
|
|
6181
|
+
_context54.next = 122;
|
|
5922
6182
|
break;
|
|
5923
6183
|
}
|
|
5924
6184
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
@@ -5937,7 +6197,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5937
6197
|
productLineUids = [];
|
|
5938
6198
|
bookingUids = [];
|
|
5939
6199
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
5940
|
-
|
|
6200
|
+
_context54.next = 143;
|
|
5941
6201
|
break;
|
|
5942
6202
|
}
|
|
5943
6203
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -5947,10 +6207,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5947
6207
|
unique_identification_number: params.productLineUid,
|
|
5948
6208
|
booking_uid: existingBookingUid
|
|
5949
6209
|
});
|
|
5950
|
-
|
|
6210
|
+
_context54.next = 135;
|
|
5951
6211
|
return this.updateOrderProduct(_objectSpread(_objectSpread({
|
|
5952
6212
|
product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
|
|
5953
|
-
product_variant_id: (
|
|
6213
|
+
product_variant_id: (_ref60 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref60 !== void 0 ? _ref60 : 0,
|
|
5954
6214
|
unique_identification_number: params.productLineUid,
|
|
5955
6215
|
updates: transformed,
|
|
5956
6216
|
booking: booking
|
|
@@ -5960,24 +6220,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5960
6220
|
allow_booking_discount_reapply: params.allowBookingDiscountReapply
|
|
5961
6221
|
} : {}));
|
|
5962
6222
|
case 135:
|
|
5963
|
-
|
|
6223
|
+
_context54.next = 137;
|
|
5964
6224
|
return this.removeBookingProductsOutsideStartDate(booking.start_date);
|
|
5965
6225
|
case 137:
|
|
5966
6226
|
productLineUid = params.productLineUid;
|
|
5967
6227
|
bookingUid = existingBookingUid;
|
|
5968
6228
|
productLineUids = [productLineUid];
|
|
5969
6229
|
bookingUids = [bookingUid];
|
|
5970
|
-
|
|
6230
|
+
_context54.next = 160;
|
|
5971
6231
|
break;
|
|
5972
6232
|
case 143:
|
|
5973
|
-
beforeProductLineUids = new Set((((_this$
|
|
6233
|
+
beforeProductLineUids = new Set((((_this$getTempOrder6 = this.getTempOrder()) === null || _this$getTempOrder6 === void 0 ? void 0 : _this$getTempOrder6.products) || []).map(function (line) {
|
|
5974
6234
|
return getProductLineUid(line);
|
|
5975
6235
|
}).filter(Boolean));
|
|
5976
|
-
beforeBookingUids = new Set((((_this$
|
|
6236
|
+
beforeBookingUids = new Set((((_this$getTempOrder7 = this.getTempOrder()) === null || _this$getTempOrder7 === void 0 ? void 0 : _this$getTempOrder7.bookings) || []).map(function (item) {
|
|
5977
6237
|
return getBookingUid(item);
|
|
5978
6238
|
}).filter(Boolean));
|
|
5979
6239
|
availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
|
|
5980
|
-
|
|
6240
|
+
_context54.next = 148;
|
|
5981
6241
|
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 ? {
|
|
5982
6242
|
salesNotes: params.salesNotes
|
|
5983
6243
|
} : {}), availabilityCommitGuard ? {
|
|
@@ -5985,11 +6245,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5985
6245
|
availabilityCommitTargetGuard: availabilityCommitTargetGuard
|
|
5986
6246
|
} : {}) : undefined);
|
|
5987
6247
|
case 148:
|
|
5988
|
-
products =
|
|
5989
|
-
|
|
6248
|
+
products = _context54.sent;
|
|
6249
|
+
_context54.next = 151;
|
|
5990
6250
|
return this.removeBookingProductsOutsideStartDate(booking.start_date);
|
|
5991
6251
|
case 151:
|
|
5992
|
-
products =
|
|
6252
|
+
products = _context54.sent;
|
|
5993
6253
|
guardedCommitPublished = hasCommitGuard;
|
|
5994
6254
|
addedLines = products.filter(function (line) {
|
|
5995
6255
|
var _line$product_id, _line$metadata;
|
|
@@ -5998,7 +6258,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5998
6258
|
productLineUids = addedLines.map(function (line) {
|
|
5999
6259
|
return getProductLineUid(line);
|
|
6000
6260
|
}).filter(Boolean);
|
|
6001
|
-
addedBookings = (((
|
|
6261
|
+
addedBookings = (((_ref61 = hasCommitGuard ? rememberedOrder : this.getTempOrder()) === null || _ref61 === void 0 ? void 0 : _ref61.bookings) || []).filter(function (item) {
|
|
6002
6262
|
var _item$metadata;
|
|
6003
6263
|
return ((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeBookingUids.has(getBookingUid(item));
|
|
6004
6264
|
});
|
|
@@ -6007,8 +6267,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6007
6267
|
}).filter(Boolean);
|
|
6008
6268
|
if (bookingUids.length === 0) {
|
|
6009
6269
|
bookingUids = addedLines.map(function (line) {
|
|
6010
|
-
var
|
|
6011
|
-
return String((
|
|
6270
|
+
var _ref62, _line$booking_uid, _line$metadata2;
|
|
6271
|
+
return String((_ref62 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.booking_uid) !== null && _ref62 !== void 0 ? _ref62 : '');
|
|
6012
6272
|
}).filter(Boolean);
|
|
6013
6273
|
}
|
|
6014
6274
|
productLineUid = productLineUids[productLineUids.length - 1] || '';
|
|
@@ -6029,60 +6289,60 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6029
6289
|
bookingUids: bookingUids
|
|
6030
6290
|
};
|
|
6031
6291
|
if (!targetStillCurrent) {
|
|
6032
|
-
|
|
6292
|
+
_context54.next = 178;
|
|
6033
6293
|
break;
|
|
6034
6294
|
}
|
|
6035
6295
|
// A notification failure after publication must not invite a duplicate add.
|
|
6036
6296
|
emit = function emit() {
|
|
6037
|
-
return
|
|
6297
|
+
return _this18.core.effects.emit("".concat(_this18.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
6038
6298
|
};
|
|
6039
6299
|
if (!guardedCommitPublished) {
|
|
6040
|
-
|
|
6300
|
+
_context54.next = 176;
|
|
6041
6301
|
break;
|
|
6042
6302
|
}
|
|
6043
|
-
|
|
6044
|
-
|
|
6303
|
+
_context54.prev = 167;
|
|
6304
|
+
_context54.next = 170;
|
|
6045
6305
|
return emit();
|
|
6046
6306
|
case 170:
|
|
6047
|
-
|
|
6307
|
+
_context54.next = 174;
|
|
6048
6308
|
break;
|
|
6049
6309
|
case 172:
|
|
6050
|
-
|
|
6051
|
-
|
|
6310
|
+
_context54.prev = 172;
|
|
6311
|
+
_context54.t0 = _context54["catch"](167);
|
|
6052
6312
|
case 174:
|
|
6053
|
-
|
|
6313
|
+
_context54.next = 178;
|
|
6054
6314
|
break;
|
|
6055
6315
|
case 176:
|
|
6056
|
-
|
|
6316
|
+
_context54.next = 178;
|
|
6057
6317
|
return emit();
|
|
6058
6318
|
case 178:
|
|
6059
|
-
return
|
|
6319
|
+
return _context54.abrupt("return", result);
|
|
6060
6320
|
case 179:
|
|
6061
|
-
|
|
6321
|
+
_context54.prev = 179;
|
|
6062
6322
|
release = this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
6063
6323
|
if (!guardedCommitPublished) {
|
|
6064
|
-
|
|
6324
|
+
_context54.next = 186;
|
|
6065
6325
|
break;
|
|
6066
6326
|
}
|
|
6067
|
-
|
|
6327
|
+
_context54.next = 184;
|
|
6068
6328
|
return release.catch(function () {
|
|
6069
6329
|
return undefined;
|
|
6070
6330
|
});
|
|
6071
6331
|
case 184:
|
|
6072
|
-
|
|
6332
|
+
_context54.next = 188;
|
|
6073
6333
|
break;
|
|
6074
6334
|
case 186:
|
|
6075
|
-
|
|
6335
|
+
_context54.next = 188;
|
|
6076
6336
|
return release;
|
|
6077
6337
|
case 188:
|
|
6078
|
-
return
|
|
6338
|
+
return _context54.finish(179);
|
|
6079
6339
|
case 189:
|
|
6080
6340
|
case "end":
|
|
6081
|
-
return
|
|
6341
|
+
return _context54.stop();
|
|
6082
6342
|
}
|
|
6083
|
-
},
|
|
6343
|
+
}, _callee54, this, [[16,, 179, 189], [167, 172]]);
|
|
6084
6344
|
}));
|
|
6085
|
-
function commitAvailabilitySelection(
|
|
6345
|
+
function commitAvailabilitySelection(_x40, _x41) {
|
|
6086
6346
|
return _commitAvailabilitySelection.apply(this, arguments);
|
|
6087
6347
|
}
|
|
6088
6348
|
return commitAvailabilitySelection;
|