@pisell/pisellos 2.3.186 → 2.3.189
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/BookingContext/utils/productExtend.d.ts +9 -1
- package/dist/modules/BookingContext/utils/productExtend.js +47 -13
- package/dist/modules/Order/index.d.ts +15 -5
- package/dist/modules/Order/index.js +1161 -921
- package/dist/modules/Order/types.d.ts +16 -4
- package/dist/modules/ResourcePlanner/planner.js +29 -2
- package/dist/modules/ResourcePlanner/types.d.ts +6 -0
- package/dist/solution/BaseSales/index.d.ts +4 -0
- package/dist/solution/BaseSales/index.js +204 -176
- package/dist/solution/BaseSales/types.d.ts +1 -0
- package/dist/solution/BaseSales/types.js +1 -0
- package/dist/solution/BookingTicket/index.js +52 -31
- package/dist/solution/UnifiedBookingSales/index.d.ts +3 -0
- package/dist/solution/UnifiedBookingSales/index.js +279 -204
- package/dist/solution/UnifiedBookingSales/types.d.ts +6 -1
- package/lib/modules/BookingContext/utils/productExtend.d.ts +9 -1
- package/lib/modules/BookingContext/utils/productExtend.js +38 -5
- package/lib/modules/Order/index.d.ts +15 -5
- package/lib/modules/Order/index.js +167 -21
- package/lib/modules/Order/types.d.ts +16 -4
- package/lib/modules/ResourcePlanner/planner.js +25 -1
- package/lib/modules/ResourcePlanner/types.d.ts +6 -0
- package/lib/solution/BaseSales/index.d.ts +4 -0
- package/lib/solution/BaseSales/index.js +14 -0
- package/lib/solution/BaseSales/types.d.ts +1 -0
- package/lib/solution/BaseSales/types.js +1 -0
- package/lib/solution/BookingTicket/index.js +8 -2
- package/lib/solution/UnifiedBookingSales/index.d.ts +3 -0
- package/lib/solution/UnifiedBookingSales/index.js +80 -15
- package/lib/solution/UnifiedBookingSales/types.d.ts +6 -1
- package/package.json +1 -1
|
@@ -1989,11 +1989,56 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1989
1989
|
contextId: context.contextId
|
|
1990
1990
|
}, projection && this.usesDurationTimeGrid(projection) ? {
|
|
1991
1991
|
durationTimeSelection: {
|
|
1992
|
-
version:
|
|
1993
|
-
currentBusinessDate: this.getCurrentAvailabilityBusinessDate(projection)
|
|
1992
|
+
version: 2,
|
|
1993
|
+
currentBusinessDate: this.getCurrentAvailabilityBusinessDate(projection),
|
|
1994
|
+
orderSessionId: this.getOrderSessionId()
|
|
1994
1995
|
}
|
|
1995
1996
|
} : {});
|
|
1996
1997
|
}
|
|
1998
|
+
|
|
1999
|
+
/** Accept the v2 interval only within the POS order that recorded it. */
|
|
2000
|
+
}, {
|
|
2001
|
+
key: "resolveOrderRememberedTimes",
|
|
2002
|
+
value: function resolveOrderRememberedTimes(context, projection, ranges, orderSessionId) {
|
|
2003
|
+
var _this$otherParams$pla2, _this$otherParams16, _context$prepareParam, _extractFixedOffsetMi;
|
|
2004
|
+
if (ranges === undefined) return undefined;
|
|
2005
|
+
if (String((_this$otherParams$pla2 = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() !== 'pos' || (_context$prepareParam = context.prepareParams.editingProductLineUids) !== null && _context$prepareParam !== void 0 && _context$prepareParam.length || !this.usesDurationTimeGrid(projection)) return undefined;
|
|
2006
|
+
this.assertRememberedOrderSession(orderSessionId);
|
|
2007
|
+
if (!isRecord(ranges) || !Object.keys(ranges).length) {
|
|
2008
|
+
throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间区间不能为空');
|
|
2009
|
+
}
|
|
2010
|
+
var offset = (_extractFixedOffsetMi = extractFixedOffsetMinutes(projection.meta.now)) !== null && _extractFixedOffsetMi !== void 0 ? _extractFixedOffsetMi : this.getAvailabilityRuntimeOffsetMinutes();
|
|
2011
|
+
return Object.fromEntries(Object.entries(ranges).map(function (_ref32) {
|
|
2012
|
+
var _ref33 = _slicedToArray(_ref32, 2),
|
|
2013
|
+
productId = _ref33[0],
|
|
2014
|
+
range = _ref33[1];
|
|
2015
|
+
try {
|
|
2016
|
+
var normalize = function normalize(value) {
|
|
2017
|
+
var _extractFixedOffsetMi2;
|
|
2018
|
+
if (typeof value !== 'string') throw new Error('Missing interval boundary');
|
|
2019
|
+
var scalar = localDateTimeToScalar(parseLocalDateTime(value));
|
|
2020
|
+
var inputOffset = (_extractFixedOffsetMi2 = extractFixedOffsetMinutes(value)) !== null && _extractFixedOffsetMi2 !== void 0 ? _extractFixedOffsetMi2 : offset;
|
|
2021
|
+
return formatLocalDateTime(scalar + (offset - inputOffset) * 60000, offset);
|
|
2022
|
+
};
|
|
2023
|
+
var startAt = normalize(range.startAt);
|
|
2024
|
+
var endAt = normalize(range.endAt);
|
|
2025
|
+
if (endAt <= startAt) throw new Error('Invalid interval');
|
|
2026
|
+
return [productId, {
|
|
2027
|
+
startAt: startAt,
|
|
2028
|
+
endAt: endAt
|
|
2029
|
+
}];
|
|
2030
|
+
} catch (_unused5) {
|
|
2031
|
+
throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间必须包含有效且递增的开始和结束时间');
|
|
2032
|
+
}
|
|
2033
|
+
}));
|
|
2034
|
+
}
|
|
2035
|
+
}, {
|
|
2036
|
+
key: "assertRememberedOrderSession",
|
|
2037
|
+
value: function assertRememberedOrderSession(orderSessionId) {
|
|
2038
|
+
if (!orderSessionId || !this.isOrderSessionCurrent(orderSessionId)) {
|
|
2039
|
+
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '记忆时间所属订单已变化,请重新选择');
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
1997
2042
|
}, {
|
|
1998
2043
|
key: "emitAvailabilityDiagnostic",
|
|
1999
2044
|
value: function () {
|
|
@@ -2127,8 +2172,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2127
2172
|
}, {
|
|
2128
2173
|
key: "isSessionStoragePersistEnabled",
|
|
2129
2174
|
value: function isSessionStoragePersistEnabled() {
|
|
2130
|
-
var _this$
|
|
2131
|
-
return Boolean(this.cacheId && ((_this$
|
|
2175
|
+
var _this$otherParams17;
|
|
2176
|
+
return Boolean(this.cacheId && ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.enableSessionStoragePersist) === true);
|
|
2132
2177
|
}
|
|
2133
2178
|
}, {
|
|
2134
2179
|
key: "shouldUseSessionStorageForSubModule",
|
|
@@ -2195,12 +2240,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2195
2240
|
key: "ensureLocalOrderNumbersForCheckout",
|
|
2196
2241
|
value: (function () {
|
|
2197
2242
|
var _ensureLocalOrderNumbersForCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
2198
|
-
var _this$
|
|
2243
|
+
var _this$otherParams18, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2;
|
|
2199
2244
|
var order, tempOrder, biz, idGenerator;
|
|
2200
2245
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
2201
2246
|
while (1) switch (_context8.prev = _context8.next) {
|
|
2202
2247
|
case 0:
|
|
2203
|
-
if (!(normalizeRuntimePlatform((_this$
|
|
2248
|
+
if (!(normalizeRuntimePlatform((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform) !== 'kiosk')) {
|
|
2204
2249
|
_context8.next = 2;
|
|
2205
2250
|
break;
|
|
2206
2251
|
}
|
|
@@ -2292,10 +2337,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2292
2337
|
}, {
|
|
2293
2338
|
key: "shouldUseCheckoutSyncTask",
|
|
2294
2339
|
value: function shouldUseCheckoutSyncTask() {
|
|
2295
|
-
var _this$
|
|
2296
|
-
var configured = (_this$
|
|
2340
|
+
var _this$otherParams19, _this$otherParams20;
|
|
2341
|
+
var configured = (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.checkoutSyncTaskEnabled;
|
|
2297
2342
|
if (configured === true) return true;
|
|
2298
|
-
var platform = normalizeRuntimePlatform((_this$
|
|
2343
|
+
var platform = normalizeRuntimePlatform((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.platform);
|
|
2299
2344
|
return !isCustomerUserPlatform(platform) && !isSelfServicePlatform(platform);
|
|
2300
2345
|
}
|
|
2301
2346
|
|
|
@@ -2450,8 +2495,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2450
2495
|
}, {
|
|
2451
2496
|
key: "isAuthenticatedCustomerUserPlatform",
|
|
2452
2497
|
value: function isAuthenticatedCustomerUserPlatform() {
|
|
2453
|
-
var _this$
|
|
2454
|
-
return isCustomerUserPlatform((_this$
|
|
2498
|
+
var _this$otherParams21;
|
|
2499
|
+
return isCustomerUserPlatform((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.platform);
|
|
2455
2500
|
}
|
|
2456
2501
|
}, {
|
|
2457
2502
|
key: "resolveDiscountOrderIdentity",
|
|
@@ -2543,13 +2588,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2543
2588
|
}, {
|
|
2544
2589
|
key: "getRuntimeOpenDataScope",
|
|
2545
2590
|
value: function getRuntimeOpenDataScope() {
|
|
2546
|
-
var
|
|
2591
|
+
var _ref34, _otherParams$business3;
|
|
2547
2592
|
var otherParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.otherParams;
|
|
2548
2593
|
return JSON.stringify({
|
|
2549
2594
|
shop: this.getPickupTimingContextData('shop_id'),
|
|
2550
2595
|
appShop: this.appPlugin ? this.getAppData('shop_id') : undefined,
|
|
2551
2596
|
tenant: this.appPlugin ? this.getAppData('tenant_id') : undefined,
|
|
2552
|
-
businessCode: String((
|
|
2597
|
+
businessCode: String((_ref34 = (_otherParams$business3 = otherParams === null || otherParams === void 0 ? void 0 : otherParams.businessCode) !== null && _otherParams$business3 !== void 0 ? _otherParams$business3 : otherParams === null || otherParams === void 0 ? void 0 : otherParams.business_code) !== null && _ref34 !== void 0 ? _ref34 : '').trim(),
|
|
2553
2598
|
channel: String((otherParams === null || otherParams === void 0 ? void 0 : otherParams.channel) || _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "getSubmitOrderSalesChannel", this).call(this)).trim(),
|
|
2554
2599
|
platform: normalizeRuntimePlatform(otherParams === null || otherParams === void 0 ? void 0 : otherParams.platform),
|
|
2555
2600
|
timezone: this.getPickupTimingContextData('timezone'),
|
|
@@ -2791,7 +2836,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2791
2836
|
key: "getSalesSettings",
|
|
2792
2837
|
value: (function () {
|
|
2793
2838
|
var _getSalesSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
2794
|
-
var _this$
|
|
2839
|
+
var _this$otherParams22;
|
|
2795
2840
|
var config;
|
|
2796
2841
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
2797
2842
|
while (1) switch (_context18.prev = _context18.next) {
|
|
@@ -2806,7 +2851,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2806
2851
|
}
|
|
2807
2852
|
throw new Error('Sales settings are unavailable without a business context.');
|
|
2808
2853
|
case 5:
|
|
2809
|
-
return _context18.abrupt("return", normalizeSalesSettings(config, (_this$
|
|
2854
|
+
return _context18.abrupt("return", normalizeSalesSettings(config, (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.platform));
|
|
2810
2855
|
case 6:
|
|
2811
2856
|
case "end":
|
|
2812
2857
|
return _context18.stop();
|
|
@@ -2821,11 +2866,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2821
2866
|
}, {
|
|
2822
2867
|
key: "getLoadedSalesSettings",
|
|
2823
2868
|
value: function getLoadedSalesSettings() {
|
|
2824
|
-
var _this$
|
|
2869
|
+
var _this$otherParams23;
|
|
2825
2870
|
if (!this.runtimeOpenDataSnapshot) {
|
|
2826
2871
|
throw new Error('Sales settings are not loaded. Call getSalesSettings before preparing a booking.');
|
|
2827
2872
|
}
|
|
2828
|
-
return normalizeSalesSettings(this.runtimeOpenDataSnapshot, (_this$
|
|
2873
|
+
return normalizeSalesSettings(this.runtimeOpenDataSnapshot, (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.platform);
|
|
2829
2874
|
}
|
|
2830
2875
|
}, {
|
|
2831
2876
|
key: "getProductBookingsForScheduling",
|
|
@@ -2845,8 +2890,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2845
2890
|
}, {
|
|
2846
2891
|
key: "shouldApplyMultipleBookingScheduling",
|
|
2847
2892
|
value: function shouldApplyMultipleBookingScheduling() {
|
|
2848
|
-
var _this$
|
|
2849
|
-
var platform = normalizeRuntimePlatform((_this$
|
|
2893
|
+
var _this$otherParams24;
|
|
2894
|
+
var platform = normalizeRuntimePlatform((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.platform);
|
|
2850
2895
|
return platform === 'pos' || platform === 'webpos';
|
|
2851
2896
|
}
|
|
2852
2897
|
}, {
|
|
@@ -2900,7 +2945,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2900
2945
|
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "buildBookingCalcContext", this).call(this, extra)), {}, {
|
|
2901
2946
|
resolveDefaultBookingStart: function resolveDefaultBookingStart(cacheItem, fallback) {
|
|
2902
2947
|
var _extra$holderIds;
|
|
2903
|
-
return _this7.resolveLoadedDefaultBookingStart((_extra$holderIds = extra === null || extra === void 0 ? void 0 : extra.holderIds) !== null && _extra$holderIds !== void 0 ? _extra$holderIds : getBookingHolderIds(cacheItem), fallback);
|
|
2948
|
+
return extra !== null && extra !== void 0 && extra.useCurrentTimeAfterRememberedExpiry ? normalizeBookingDateTime(fallback) : _this7.resolveLoadedDefaultBookingStart((_extra$holderIds = extra === null || extra === void 0 ? void 0 : extra.holderIds) !== null && _extra$holderIds !== void 0 ? _extra$holderIds : getBookingHolderIds(cacheItem), fallback);
|
|
2904
2949
|
}
|
|
2905
2950
|
});
|
|
2906
2951
|
}
|
|
@@ -2911,7 +2956,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2911
2956
|
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "buildAddProductCtx", this).call(this, extra)), {}, {
|
|
2912
2957
|
resolveDefaultBookingStart: function resolveDefaultBookingStart(cacheItem, fallback) {
|
|
2913
2958
|
var _extra$holderIds2;
|
|
2914
|
-
return _this8.resolveLoadedDefaultBookingStart((_extra$holderIds2 = extra === null || extra === void 0 ? void 0 : extra.holderIds) !== null && _extra$holderIds2 !== void 0 ? _extra$holderIds2 : getBookingHolderIds(cacheItem), fallback);
|
|
2959
|
+
return extra !== null && extra !== void 0 && extra.useCurrentTimeAfterRememberedExpiry ? normalizeBookingDateTime(fallback) : _this8.resolveLoadedDefaultBookingStart((_extra$holderIds2 = extra === null || extra === void 0 ? void 0 : extra.holderIds) !== null && _extra$holderIds2 !== void 0 ? _extra$holderIds2 : getBookingHolderIds(cacheItem), fallback);
|
|
2915
2960
|
}
|
|
2916
2961
|
});
|
|
2917
2962
|
}
|
|
@@ -2921,7 +2966,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2921
2966
|
key: "applyDefaultBookingStart",
|
|
2922
2967
|
value: (function () {
|
|
2923
2968
|
var _applyDefaultBookingStart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(cacheItem) {
|
|
2924
|
-
var _cacheItem$_extend, _cacheItem$_data, _options$holderIds,
|
|
2969
|
+
var _cacheItem$_extend, _cacheItem$_data, _options$holderIds, _ref36, _normalizeBookingDate, _cacheItem$_data2;
|
|
2925
2970
|
var options,
|
|
2926
2971
|
extend,
|
|
2927
2972
|
currentStart,
|
|
@@ -2970,7 +3015,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2970
3015
|
throw new Error('The explicit booking start must be a valid date and time.');
|
|
2971
3016
|
case 13:
|
|
2972
3017
|
holderIds = (_options$holderIds = options.holderIds) !== null && _options$holderIds !== void 0 ? _options$holderIds : getBookingHolderIds(cacheItem);
|
|
2973
|
-
fallback = (
|
|
3018
|
+
fallback = (_ref36 = (_normalizeBookingDate = normalizeBookingDateTime((_cacheItem$_data2 = cacheItem._data) === null || _cacheItem$_data2 === void 0 ? void 0 : _cacheItem$_data2.salesDefaultBookingFallback)) !== null && _normalizeBookingDate !== void 0 ? _normalizeBookingDate : currentStart) !== null && _ref36 !== void 0 ? _ref36 : normalizeBookingDateTime(String(this.getBookingDate() || ''));
|
|
2974
3019
|
if (!(explicitStart !== null && explicitStart !== void 0)) {
|
|
2975
3020
|
_context20.next = 19;
|
|
2976
3021
|
break;
|
|
@@ -3049,13 +3094,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3049
3094
|
key: "loadPickupTimingOpenData",
|
|
3050
3095
|
value: function () {
|
|
3051
3096
|
var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(_force) {
|
|
3052
|
-
var
|
|
3097
|
+
var _ref37, _this$otherParams$bus2, _this$otherParams25, _this$otherParams26;
|
|
3053
3098
|
var scope, businessCode, config;
|
|
3054
3099
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
3055
3100
|
while (1) switch (_context21.prev = _context21.next) {
|
|
3056
3101
|
case 0:
|
|
3057
3102
|
scope = this.getPickupTimingScope();
|
|
3058
|
-
businessCode = String((
|
|
3103
|
+
businessCode = String((_ref37 = (_this$otherParams$bus2 = (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.business_code) !== null && _ref37 !== void 0 ? _ref37 : '').trim();
|
|
3059
3104
|
_context21.next = 4;
|
|
3060
3105
|
return this.loadOpenData({
|
|
3061
3106
|
businessCode: businessCode,
|
|
@@ -3141,13 +3186,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3141
3186
|
key: "validateRequiredProducts",
|
|
3142
3187
|
value: (function () {
|
|
3143
3188
|
var _validateRequiredProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
3144
|
-
var
|
|
3189
|
+
var _ref38, _this$otherParams$bus3, _this$otherParams27, _this$otherParams28, _this$otherParams$cha3, _this$otherParams29, _this$otherParams30;
|
|
3145
3190
|
var businessCode, channel, scope, order, runtimeConfig, configs, _response$data2, openData, ids, response, strategyConfigs, cartItems, result, _result$failedChecks$, error;
|
|
3146
3191
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
3147
3192
|
while (1) switch (_context23.prev = _context23.next) {
|
|
3148
3193
|
case 0:
|
|
3149
|
-
businessCode = String((
|
|
3150
|
-
channel = String((_this$otherParams$cha3 = (_this$
|
|
3194
|
+
businessCode = String((_ref38 = (_this$otherParams$bus3 = (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.businessCode) !== null && _this$otherParams$bus3 !== void 0 ? _this$otherParams$bus3 : (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.business_code) !== null && _ref38 !== void 0 ? _ref38 : '').trim();
|
|
3195
|
+
channel = String((_this$otherParams$cha3 = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.channel) !== null && _this$otherParams$cha3 !== void 0 ? _this$otherParams$cha3 : '').trim();
|
|
3151
3196
|
if (!(businessCode !== 'venue_ticket' || channel !== 'online_ordering')) {
|
|
3152
3197
|
_context23.next = 4;
|
|
3153
3198
|
break;
|
|
@@ -3156,7 +3201,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3156
3201
|
case 4:
|
|
3157
3202
|
scope = this.getPickupTimingScope();
|
|
3158
3203
|
order = this.getTempOrder();
|
|
3159
|
-
runtimeConfig = ((_this$
|
|
3204
|
+
runtimeConfig = ((_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.itemRule) || {};
|
|
3160
3205
|
configs = normalizeItemRuleStrategyConfigs(runtimeConfig.strategyConfigs);
|
|
3161
3206
|
if (configs.length) {
|
|
3162
3207
|
_context23.next = 23;
|
|
@@ -3385,7 +3430,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3385
3430
|
key: "resolveProductAllergyRequirement",
|
|
3386
3431
|
value: (function () {
|
|
3387
3432
|
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
3388
|
-
var _this$
|
|
3433
|
+
var _this$otherParams31, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref41, _runtimeConfig$servic, _this$otherParams32, _ref42, _ref43, _params$channel, _this$otherParams33, _this$otherParams34, _runtimeConfig$submis;
|
|
3389
3434
|
var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
|
|
3390
3435
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3391
3436
|
while (1) switch (_context27.prev = _context27.next) {
|
|
@@ -3408,14 +3453,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3408
3453
|
return _context27.abrupt("return", null);
|
|
3409
3454
|
case 8:
|
|
3410
3455
|
productVariantId = normalizePositiveInteger(params.productVariantId);
|
|
3411
|
-
runtimeConfig = ((_this$
|
|
3456
|
+
runtimeConfig = ((_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.itemRule) || {};
|
|
3412
3457
|
runtimePax = runtimeConfig.pax || {};
|
|
3413
3458
|
cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
|
|
3414
|
-
var _item$product_id, _item$product_variant,
|
|
3459
|
+
var _item$product_id, _item$product_variant, _ref40, _item$num;
|
|
3415
3460
|
return {
|
|
3416
3461
|
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),
|
|
3417
3462
|
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,
|
|
3418
|
-
quantity: Number((
|
|
3463
|
+
quantity: Number((_ref40 = (_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 && _ref40 !== void 0 ? _ref40 : 0)
|
|
3419
3464
|
};
|
|
3420
3465
|
}).filter(function (item) {
|
|
3421
3466
|
return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
|
|
@@ -3427,8 +3472,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3427
3472
|
child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
|
|
3428
3473
|
},
|
|
3429
3474
|
cartItems: cartItems,
|
|
3430
|
-
serviceType: String((
|
|
3431
|
-
channel: String((
|
|
3475
|
+
serviceType: String((_ref41 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.serviceType) !== null && _ref41 !== void 0 ? _ref41 : ''),
|
|
3476
|
+
channel: String((_ref42 = (_ref43 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.channel) !== null && _ref43 !== void 0 ? _ref43 : (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.platform) !== null && _ref42 !== void 0 ? _ref42 : ''),
|
|
3432
3477
|
currentProduct: _objectSpread({
|
|
3433
3478
|
product_id: productId
|
|
3434
3479
|
}, productVariantId ? {
|
|
@@ -3518,9 +3563,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3518
3563
|
}, {
|
|
3519
3564
|
key: "isInvoiceOpenDataCacheCurrent",
|
|
3520
3565
|
value: function isInvoiceOpenDataCacheCurrent() {
|
|
3521
|
-
var _this$
|
|
3522
|
-
var businessCode = String(((_this$
|
|
3523
|
-
var channel = String(((_this$
|
|
3566
|
+
var _this$otherParams35, _this$otherParams36;
|
|
3567
|
+
var businessCode = String(((_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.businessCode) || '').trim();
|
|
3568
|
+
var channel = String(((_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.channel) || '').trim();
|
|
3524
3569
|
if (!businessCode || !channel) return false;
|
|
3525
3570
|
return this.openDataTarget === "".concat(businessCode, "+").concat(channel) && this.runtimeOpenDataScope === this.getRuntimeOpenDataScope();
|
|
3526
3571
|
}
|
|
@@ -4024,10 +4069,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4024
4069
|
}, {
|
|
4025
4070
|
key: "buildUnifiedOrderProduct",
|
|
4026
4071
|
value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
|
|
4027
|
-
var _sourceProduct$_exten, _this$
|
|
4072
|
+
var _sourceProduct$_exten, _this$otherParams37, _bookingQuote$pricing, _ref44, _sourceProduct$_exten2, _sourceProduct$_exten3, _sourceProduct$metada, _sourceProduct$id, _ref45, _sourceProduct$produc, _ref46, _ref47, _sourceProduct$quanti, _sourceProduct$price, _ref48, _ref49, _sourceProduct$sellin;
|
|
4028
4073
|
var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
|
|
4029
4074
|
var bookingQuote = (_sourceProduct$_exten = sourceProduct._extend) === null || _sourceProduct$_exten === void 0 ? void 0 : _sourceProduct$_exten.bookingPriceQuote;
|
|
4030
|
-
var isPos = normalizeRuntimePlatform((_this$
|
|
4075
|
+
var isPos = normalizeRuntimePlatform((_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.platform) === 'pos';
|
|
4031
4076
|
var quoteMethod = isPos ? bookingQuote === null || bookingQuote === void 0 || (_bookingQuote$pricing = bookingQuote.pricing_method) === null || _bookingQuote$pricing === void 0 ? void 0 : _bookingQuote$pricing.type : undefined;
|
|
4032
4077
|
var hasDurationQuote = quoteMethod === 'duration_based';
|
|
4033
4078
|
var quoteSourcePrice = bookingQuote === null || bookingQuote === void 0 ? void 0 : bookingQuote.sourceUnitPrice;
|
|
@@ -4037,14 +4082,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4037
4082
|
code: 'DURATION_PRICING_UNAVAILABLE'
|
|
4038
4083
|
});
|
|
4039
4084
|
}
|
|
4040
|
-
var quotationShelfId = (
|
|
4085
|
+
var quotationShelfId = (_ref44 = (_sourceProduct$_exten2 = (_sourceProduct$_exten3 = sourceProduct._extend) === null || _sourceProduct$_exten3 === void 0 ? void 0 : _sourceProduct$_exten3.quotation_shelf_id) !== null && _sourceProduct$_exten2 !== void 0 ? _sourceProduct$_exten2 : sourceProduct.quotation_shelf_id) !== null && _ref44 !== void 0 ? _ref44 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
|
|
4041
4086
|
var orderProduct = this.transformBaseProductToOrderProduct(_objectSpread({
|
|
4042
4087
|
payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
|
|
4043
4088
|
id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
|
|
4044
|
-
product_id: (
|
|
4045
|
-
quantity: (
|
|
4089
|
+
product_id: (_ref45 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref45 !== void 0 ? _ref45 : product === null || product === void 0 ? void 0 : product.id,
|
|
4090
|
+
quantity: (_ref46 = (_ref47 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref47 !== void 0 ? _ref47 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref46 !== void 0 ? _ref46 : 1,
|
|
4046
4091
|
price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
|
|
4047
|
-
selling_price: (
|
|
4092
|
+
selling_price: (_ref48 = (_ref49 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref49 !== void 0 ? _ref49 : normalizedProductRaw.selling_price) !== null && _ref48 !== void 0 ? _ref48 : normalizedProductRaw.price,
|
|
4048
4093
|
metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
|
|
4049
4094
|
}),
|
|
4050
4095
|
sourceProduct: sourceProduct
|
|
@@ -4211,7 +4256,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4211
4256
|
key: "addRetailProduct",
|
|
4212
4257
|
value: (function () {
|
|
4213
4258
|
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
4214
|
-
var _params$quantity,
|
|
4259
|
+
var _params$quantity, _ref50, _params$productId, _params$product, _params$product2;
|
|
4215
4260
|
var quantity, productId, sourceProduct, products, orderProduct;
|
|
4216
4261
|
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4217
4262
|
while (1) switch (_context39.prev = _context39.next) {
|
|
@@ -4223,7 +4268,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4223
4268
|
}
|
|
4224
4269
|
throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
|
|
4225
4270
|
case 3:
|
|
4226
|
-
productId = (
|
|
4271
|
+
productId = (_ref50 = (_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 && _ref50 !== void 0 ? _ref50 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
|
|
4227
4272
|
sourceProduct = params.product;
|
|
4228
4273
|
if (!sourceProduct && productId !== undefined && productId !== null) {
|
|
4229
4274
|
sourceProduct = this.unifiedProductCatalog.find(function (product) {
|
|
@@ -4864,7 +4909,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4864
4909
|
var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
|
|
4865
4910
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
4866
4911
|
productLineUids.forEach(function (requestedUid) {
|
|
4867
|
-
var
|
|
4912
|
+
var _ref51, _product$booking_uid2, _product$metadata6;
|
|
4868
4913
|
var product = products.find(function (line) {
|
|
4869
4914
|
return getProductLineUid(line) === String(requestedUid);
|
|
4870
4915
|
});
|
|
@@ -4874,7 +4919,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4874
4919
|
});
|
|
4875
4920
|
}
|
|
4876
4921
|
var productUid = getProductLineUid(product);
|
|
4877
|
-
var linkedBookingUid = String((
|
|
4922
|
+
var linkedBookingUid = String((_ref51 = (_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 && _ref51 !== void 0 ? _ref51 : '');
|
|
4878
4923
|
var linkedBookings = bookings.filter(function (booking) {
|
|
4879
4924
|
var _booking$product_uid;
|
|
4880
4925
|
return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
|
|
@@ -4920,16 +4965,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4920
4965
|
var _this12 = this;
|
|
4921
4966
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
4922
4967
|
return bookings.flatMap(function (booking) {
|
|
4923
|
-
var
|
|
4968
|
+
var _ref52, _booking$product_uid2, _booking$metadata2;
|
|
4924
4969
|
var bookingUid = getBookingUid(booking);
|
|
4925
|
-
var productUid = String((
|
|
4970
|
+
var productUid = String((_ref52 = (_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 && _ref52 !== void 0 ? _ref52 : '');
|
|
4926
4971
|
var scheduleEventId = toNumberId(booking.schedule_event_id);
|
|
4927
4972
|
var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
|
|
4928
4973
|
var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
|
|
4929
4974
|
var resources = Array.isArray(booking.resources) ? booking.resources : [];
|
|
4930
4975
|
return resources.flatMap(function (resource) {
|
|
4931
|
-
var
|
|
4932
|
-
var resourceId = (
|
|
4976
|
+
var _ref53, _resource$resource_id, _ref54, _resource$capacity;
|
|
4977
|
+
var resourceId = (_ref53 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref53 !== void 0 ? _ref53 : resource.id;
|
|
4933
4978
|
if (resourceId == null || !startAt || !endAt) return [];
|
|
4934
4979
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4935
4980
|
startAt: startAt,
|
|
@@ -4942,7 +4987,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4942
4987
|
resourceId: resourceId,
|
|
4943
4988
|
startAt: range.startAt,
|
|
4944
4989
|
endAt: range.endAt,
|
|
4945
|
-
pax: Math.max(1, Number((
|
|
4990
|
+
pax: Math.max(1, Number((_ref54 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref54 !== void 0 ? _ref54 : 1) || 1),
|
|
4946
4991
|
source: 'cart',
|
|
4947
4992
|
scheduleEventId: scheduleEventId,
|
|
4948
4993
|
bookingUid: bookingUid || undefined,
|
|
@@ -5623,10 +5668,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5623
5668
|
key: "getProductTimeRanges",
|
|
5624
5669
|
value: (function () {
|
|
5625
5670
|
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(contextId) {
|
|
5626
|
-
var _this$otherParams$
|
|
5627
|
-
_this$
|
|
5628
|
-
_context$
|
|
5629
|
-
|
|
5671
|
+
var _this$otherParams$pla3,
|
|
5672
|
+
_this$otherParams38,
|
|
5673
|
+
_context$prepareParam2,
|
|
5674
|
+
_extractFixedOffsetMi3,
|
|
5630
5675
|
_this16 = this;
|
|
5631
5676
|
var request,
|
|
5632
5677
|
_yield$this$ensureAva,
|
|
@@ -5640,6 +5685,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5640
5685
|
dateRange,
|
|
5641
5686
|
editingStarts,
|
|
5642
5687
|
businessDate,
|
|
5688
|
+
rememberedTimeByProductId,
|
|
5643
5689
|
rememberedStartAtByProductId,
|
|
5644
5690
|
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
5645
5691
|
_args53 = arguments;
|
|
@@ -5654,20 +5700,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5654
5700
|
context = _yield$this$ensureAva.context;
|
|
5655
5701
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
5656
5702
|
contextVersion = context.activeVersion;
|
|
5657
|
-
isPosAvailabilityRequest = String((_this$otherParams$
|
|
5658
|
-
isEditingContext = Boolean((_context$
|
|
5659
|
-
editingOffset = (
|
|
5703
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
|
|
5704
|
+
isEditingContext = Boolean((_context$prepareParam2 = context.prepareParams.editingProductLineUids) === null || _context$prepareParam2 === void 0 ? void 0 : _context$prepareParam2.length);
|
|
5705
|
+
editingOffset = (_extractFixedOffsetMi3 = extractFixedOffsetMinutes(projectionEntry.projection.meta.now)) !== null && _extractFixedOffsetMi3 !== void 0 ? _extractFixedOffsetMi3 : this.getAvailabilityRuntimeOffsetMinutes(); // This new editing input represents an absolute instant. Normalize it once
|
|
5660
5706
|
// to the projection's fixed business clock before the wall-clock planner.
|
|
5661
|
-
editingStartAtByProductId = isEditingContext && request.editingStartAtByProductId ? Object.fromEntries(Object.entries(request.editingStartAtByProductId).map(function (
|
|
5662
|
-
var
|
|
5663
|
-
productId =
|
|
5664
|
-
startAt =
|
|
5707
|
+
editingStartAtByProductId = isEditingContext && request.editingStartAtByProductId ? Object.fromEntries(Object.entries(request.editingStartAtByProductId).map(function (_ref56) {
|
|
5708
|
+
var _ref57 = _slicedToArray(_ref56, 2),
|
|
5709
|
+
productId = _ref57[0],
|
|
5710
|
+
startAt = _ref57[1];
|
|
5665
5711
|
try {
|
|
5666
|
-
var
|
|
5712
|
+
var _extractFixedOffsetMi4;
|
|
5667
5713
|
var scalar = localDateTimeToScalar(parseLocalDateTime(startAt));
|
|
5668
|
-
var inputOffset = (
|
|
5714
|
+
var inputOffset = (_extractFixedOffsetMi4 = extractFixedOffsetMinutes(startAt)) !== null && _extractFixedOffsetMi4 !== void 0 ? _extractFixedOffsetMi4 : editingOffset;
|
|
5669
5715
|
return [productId, formatLocalDateTime(scalar + (editingOffset - inputOffset) * 60000, editingOffset)];
|
|
5670
|
-
} catch (
|
|
5716
|
+
} catch (_unused6) {
|
|
5671
5717
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑开始时间必须是完整有效日期时间');
|
|
5672
5718
|
}
|
|
5673
5719
|
})) : undefined;
|
|
@@ -5681,22 +5727,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5681
5727
|
endDate: businessDate
|
|
5682
5728
|
};
|
|
5683
5729
|
}
|
|
5684
|
-
|
|
5685
|
-
|
|
5730
|
+
rememberedTimeByProductId = this.resolveOrderRememberedTimes(context, projectionEntry.projection, request.rememberedTimeByProductId, request.orderSessionId);
|
|
5731
|
+
rememberedStartAtByProductId = !rememberedTimeByProductId && isPosAvailabilityRequest && !isEditingContext ? request.rememberedStartAtByProductId : undefined;
|
|
5732
|
+
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && !rememberedStartAtByProductId && !rememberedTimeByProductId && (editingStarts.length > 0 || Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
5686
5733
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
5687
5734
|
}));
|
|
5688
5735
|
return _context53.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), {}, {
|
|
5689
5736
|
dateRange: dateRange,
|
|
5690
5737
|
editingStartAtByProductId: editingStartAtByProductId,
|
|
5691
|
-
rememberedStartAtByProductId: rememberedStartAtByProductId
|
|
5692
|
-
|
|
5738
|
+
rememberedStartAtByProductId: rememberedStartAtByProductId,
|
|
5739
|
+
rememberedTimeByProductId: rememberedTimeByProductId
|
|
5740
|
+
}, rememberedStartAtByProductId || rememberedTimeByProductId ? {
|
|
5693
5741
|
allowOutsideOperatingHoursForRequestedStartTimes: false
|
|
5694
5742
|
} : {}), allowOutsideOperatingHoursForRequestedStartTimes ? {
|
|
5695
5743
|
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
5696
5744
|
} : {}), {
|
|
5697
5745
|
evaluatedAt: this.getAvailabilityRuntimeDateTime(),
|
|
5698
5746
|
useDurationTimeGrid: this.usesDurationTimeGrid(projectionEntry.projection),
|
|
5699
|
-
enforceSaleCutoff: Boolean(rememberedStartAtByProductId),
|
|
5747
|
+
enforceSaleCutoff: Boolean(rememberedStartAtByProductId || rememberedTimeByProductId),
|
|
5748
|
+
rememberedTimeByProductId: rememberedTimeByProductId,
|
|
5700
5749
|
useExactDurationCandidateMinute: isPosAvailabilityRequest,
|
|
5701
5750
|
allowSessionCustomRanges: isPosAvailabilityRequest,
|
|
5702
5751
|
allowExcludedScheduleDateOverride: isPosAvailabilityRequest
|
|
@@ -5707,7 +5756,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5707
5756
|
})
|
|
5708
5757
|
});
|
|
5709
5758
|
}));
|
|
5710
|
-
case
|
|
5759
|
+
case 18:
|
|
5711
5760
|
case "end":
|
|
5712
5761
|
return _context53.stop();
|
|
5713
5762
|
}
|
|
@@ -5722,8 +5771,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5722
5771
|
key: "queryBookingAvailability",
|
|
5723
5772
|
value: (function () {
|
|
5724
5773
|
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(contextId, request) {
|
|
5725
|
-
var _this$otherParams$
|
|
5726
|
-
var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, queryRequest, result, contextVersion, contextualResult;
|
|
5774
|
+
var _this$otherParams$pla4, _this$otherParams39, _context$prepareParam3;
|
|
5775
|
+
var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, rememberedTimeByProductId, queryRequest, result, contextVersion, contextualResult;
|
|
5727
5776
|
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5728
5777
|
while (1) switch (_context54.prev = _context54.next) {
|
|
5729
5778
|
case 0:
|
|
@@ -5735,13 +5784,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5735
5784
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
5736
5785
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
5737
5786
|
this.assertContextualQueryFreshness(context, request);
|
|
5738
|
-
isPosAvailabilityRequest = String((_this$otherParams$
|
|
5787
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla4 = (_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() === 'pos';
|
|
5788
|
+
rememberedTimeByProductId = request.selectionIntent === 'remembered' ? this.resolveOrderRememberedTimes(context, projectionEntry.projection, request.rememberedTimeByProductId, request.orderSessionId) : undefined;
|
|
5739
5789
|
queryRequest = request.target === 'date' || request.target === 'product' ? _objectSpread(_objectSpread({}, request), {}, {
|
|
5740
5790
|
dateRange: request.dateRange || this.getAvailabilityBusinessDateRange(projectionEntry.projection)
|
|
5741
5791
|
}) : request;
|
|
5742
5792
|
result = queryAvailabilityProjection(projectionEntry.projection, queryRequest, {
|
|
5743
5793
|
useDurationTimeGrid: this.usesDurationTimeGrid(projectionEntry.projection),
|
|
5744
|
-
enforceSaleCutoff: isPosAvailabilityRequest && !((_context$
|
|
5794
|
+
enforceSaleCutoff: isPosAvailabilityRequest && !((_context$prepareParam3 = context.prepareParams.editingProductLineUids) !== null && _context$prepareParam3 !== void 0 && _context$prepareParam3.length) && request.selectionIntent === 'remembered',
|
|
5795
|
+
rememberedTimeByProductId: rememberedTimeByProductId,
|
|
5745
5796
|
useExactDurationCandidateMinute: isPosAvailabilityRequest,
|
|
5746
5797
|
allowExcludedScheduleDateOverride: isPosAvailabilityRequest
|
|
5747
5798
|
});
|
|
@@ -5776,7 +5827,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5776
5827
|
contextVersion: contextVersion,
|
|
5777
5828
|
refreshed: refreshed
|
|
5778
5829
|
}));
|
|
5779
|
-
case
|
|
5830
|
+
case 14:
|
|
5780
5831
|
case "end":
|
|
5781
5832
|
return _context54.stop();
|
|
5782
5833
|
}
|
|
@@ -5839,9 +5890,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5839
5890
|
}, {
|
|
5840
5891
|
key: "findLinkedBooking",
|
|
5841
5892
|
value: function findLinkedBooking(product) {
|
|
5842
|
-
var
|
|
5893
|
+
var _ref58, _product$booking_uid3, _product$metadata7, _this$getTempOrder4;
|
|
5843
5894
|
var productUid = getProductLineUid(product);
|
|
5844
|
-
var bookingUid = String((
|
|
5895
|
+
var bookingUid = String((_ref58 = (_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 && _ref58 !== void 0 ? _ref58 : '');
|
|
5845
5896
|
return (((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.bookings) || []).find(function (booking) {
|
|
5846
5897
|
var _booking$product_uid3;
|
|
5847
5898
|
return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
|
|
@@ -5852,14 +5903,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5852
5903
|
value: function () {
|
|
5853
5904
|
var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(startDate) {
|
|
5854
5905
|
var _this$getTempOrder5,
|
|
5855
|
-
_this$
|
|
5906
|
+
_this$otherParams40,
|
|
5856
5907
|
_this17 = this;
|
|
5857
5908
|
var products, targetDate, identities;
|
|
5858
5909
|
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5859
5910
|
while (1) switch (_context55.prev = _context55.next) {
|
|
5860
5911
|
case 0:
|
|
5861
5912
|
products = ((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || [];
|
|
5862
|
-
if (!(((_this$
|
|
5913
|
+
if (!(((_this$otherParams40 = this.otherParams) === null || _this$otherParams40 === void 0 ? void 0 : _this$otherParams40.enforceSingleBookingStartDate) !== true)) {
|
|
5863
5914
|
_context55.next = 3;
|
|
5864
5915
|
break;
|
|
5865
5916
|
}
|
|
@@ -5898,13 +5949,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5898
5949
|
key: "commitAvailabilitySelection",
|
|
5899
5950
|
value: (function () {
|
|
5900
5951
|
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(contextId, params) {
|
|
5901
|
-
var _this$otherParams$
|
|
5902
|
-
_this$
|
|
5952
|
+
var _this$otherParams$pla5,
|
|
5953
|
+
_this$otherParams41,
|
|
5903
5954
|
_params$availabilityC,
|
|
5904
5955
|
_this$store$order11,
|
|
5905
5956
|
_this$store$order11$e,
|
|
5906
5957
|
_this18 = this;
|
|
5907
|
-
var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount,
|
|
5958
|
+
var normalizedContextId, isRememberedSelection, isOrderRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref59, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla6, _this$otherParams42, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla7, _this$otherParams43, _ref60, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref61, _ref62, _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, rememberedTimeByProductId, 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, _ref63, _transformed$product_4, _this$getTempOrder6, _this$getTempOrder7, _params$salesNotes, _params$salesNotes2, _ref64, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
|
|
5908
5959
|
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5909
5960
|
while (1) switch (_context56.prev = _context56.next) {
|
|
5910
5961
|
case 0:
|
|
@@ -5918,81 +5969,86 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5918
5969
|
});
|
|
5919
5970
|
case 3:
|
|
5920
5971
|
isRememberedSelection = params.selectionIntent === 'remembered';
|
|
5921
|
-
|
|
5922
|
-
|
|
5972
|
+
isOrderRememberedSelection = isRememberedSelection && params.orderSessionId !== undefined;
|
|
5973
|
+
if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41.platform) !== null && _this$otherParams$pla5 !== void 0 ? _this$otherParams$pla5 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add'))) {
|
|
5974
|
+
_context56.next = 7;
|
|
5923
5975
|
break;
|
|
5924
5976
|
}
|
|
5925
5977
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
|
|
5926
|
-
case
|
|
5978
|
+
case 7:
|
|
5927
5979
|
hasCommitGuard = isRememberedSelection || Boolean(params.availabilityCommitGuard);
|
|
5928
5980
|
(_params$availabilityC = params.availabilityCommitGuard) === null || _params$availabilityC === void 0 || _params$availabilityC.call(params);
|
|
5929
5981
|
// Stabilize the locally generated sale identity before taking the guard snapshot.
|
|
5930
5982
|
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);
|
|
5983
|
+
if (isOrderRememberedSelection) this.assertRememberedOrderSession(params.orderSessionId);
|
|
5931
5984
|
rememberedOrder = hasCommitGuard ? this.getTempOrder() : null;
|
|
5932
5985
|
getRememberedCommitIdentity = function getRememberedCommitIdentity() {
|
|
5933
5986
|
var _this18$otherParams$s, _this18$otherParams, _this18$otherParams2, _this18$core, _this18$getTempOrder, _this18$getTempOrder2;
|
|
5934
|
-
return JSON.stringify(stableValue({
|
|
5987
|
+
return JSON.stringify(stableValue(_objectSpread({
|
|
5935
5988
|
scope: _this18.getAvailabilityScopeDescriptor(),
|
|
5936
5989
|
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,
|
|
5937
|
-
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
|
|
5990
|
+
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
|
|
5991
|
+
}, isOrderRememberedSelection ? {
|
|
5992
|
+
orderSessionId: _this18.getOrderSessionId()
|
|
5993
|
+
} : {
|
|
5938
5994
|
orderId: (_this18$getTempOrder = _this18.getTempOrder()) === null || _this18$getTempOrder === void 0 ? void 0 : _this18$getTempOrder.order_id,
|
|
5939
5995
|
externalSaleNumber: (_this18$getTempOrder2 = _this18.getTempOrder()) === null || _this18$getTempOrder2 === void 0 ? void 0 : _this18$getTempOrder2.external_sale_number
|
|
5940
|
-
}));
|
|
5996
|
+
})));
|
|
5941
5997
|
};
|
|
5942
5998
|
rememberedCommitIdentity = hasCommitGuard ? getRememberedCommitIdentity() : '';
|
|
5943
5999
|
availabilityCommitTargetGuard = function availabilityCommitTargetGuard() {
|
|
5944
|
-
return _this18.getTempOrder() === rememberedOrder && getRememberedCommitIdentity() === rememberedCommitIdentity;
|
|
6000
|
+
return (isOrderRememberedSelection ? _this18.isOrderSessionCurrent(params.orderSessionId) : _this18.getTempOrder() === rememberedOrder) && getRememberedCommitIdentity() === rememberedCommitIdentity;
|
|
5945
6001
|
};
|
|
5946
6002
|
guardedCommitPublished = false;
|
|
5947
|
-
_context56.next =
|
|
6003
|
+
_context56.next = 18;
|
|
5948
6004
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
5949
|
-
case
|
|
5950
|
-
_context56.prev =
|
|
6005
|
+
case 18:
|
|
6006
|
+
_context56.prev = 18;
|
|
5951
6007
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
5952
6008
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
5953
|
-
_context56.next =
|
|
6009
|
+
_context56.next = 22;
|
|
5954
6010
|
break;
|
|
5955
6011
|
}
|
|
5956
6012
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
5957
6013
|
bookingCount: params.bookingCount
|
|
5958
6014
|
});
|
|
5959
|
-
case
|
|
6015
|
+
case 22:
|
|
5960
6016
|
if (!(params.mode === 'edit' && bookingCount !== 1)) {
|
|
5961
|
-
_context56.next =
|
|
6017
|
+
_context56.next = 24;
|
|
5962
6018
|
break;
|
|
5963
6019
|
}
|
|
5964
6020
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
5965
6021
|
bookingCount: bookingCount
|
|
5966
6022
|
});
|
|
5967
|
-
case
|
|
5968
|
-
orderProductQuantity = (
|
|
6023
|
+
case 24:
|
|
6024
|
+
orderProductQuantity = (_ref59 = (_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 && _ref59 !== void 0 ? _ref59 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
|
|
5969
6025
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
5970
|
-
_context56.next =
|
|
6026
|
+
_context56.next = 27;
|
|
5971
6027
|
break;
|
|
5972
6028
|
}
|
|
5973
6029
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
5974
6030
|
bookingCount: bookingCount,
|
|
5975
6031
|
orderProductQuantity: orderProductQuantity
|
|
5976
6032
|
});
|
|
5977
|
-
case
|
|
6033
|
+
case 27:
|
|
5978
6034
|
partySize = Number(params.partySize);
|
|
5979
6035
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
5980
|
-
_context56.next =
|
|
6036
|
+
_context56.next = 30;
|
|
5981
6037
|
break;
|
|
5982
6038
|
}
|
|
5983
6039
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
5984
6040
|
partySize: params.partySize
|
|
5985
6041
|
});
|
|
5986
|
-
case 28:
|
|
5987
|
-
_context56.next = 30;
|
|
5988
|
-
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
5989
6042
|
case 30:
|
|
6043
|
+
_context56.next = 32;
|
|
6044
|
+
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
6045
|
+
case 32:
|
|
5990
6046
|
_yield$this$ensureAva3 = _context56.sent;
|
|
5991
6047
|
context = _yield$this$ensureAva3.context;
|
|
5992
6048
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
5993
6049
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
5994
6050
|
if (!refreshed) {
|
|
5995
|
-
_context56.next =
|
|
6051
|
+
_context56.next = 38;
|
|
5996
6052
|
break;
|
|
5997
6053
|
}
|
|
5998
6054
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -6000,14 +6056,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6000
6056
|
currentContextVersion: context.activeVersion,
|
|
6001
6057
|
candidateContextVersion: params.candidate.availabilityContextVersion
|
|
6002
6058
|
});
|
|
6003
|
-
case
|
|
6059
|
+
case 38:
|
|
6004
6060
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
6005
6061
|
if (!(params.mode === 'edit')) {
|
|
6006
|
-
_context56.next =
|
|
6062
|
+
_context56.next = 44;
|
|
6007
6063
|
break;
|
|
6008
6064
|
}
|
|
6009
6065
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
6010
|
-
_context56.next =
|
|
6066
|
+
_context56.next = 42;
|
|
6011
6067
|
break;
|
|
6012
6068
|
}
|
|
6013
6069
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -6015,21 +6071,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6015
6071
|
productLineUid: params.productLineUid,
|
|
6016
6072
|
editingProductLineUids: boundEditingUids
|
|
6017
6073
|
});
|
|
6018
|
-
case 40:
|
|
6019
|
-
_context56.next = 44;
|
|
6020
|
-
break;
|
|
6021
6074
|
case 42:
|
|
6075
|
+
_context56.next = 46;
|
|
6076
|
+
break;
|
|
6077
|
+
case 44:
|
|
6022
6078
|
if (!(boundEditingUids.length > 0)) {
|
|
6023
|
-
_context56.next =
|
|
6079
|
+
_context56.next = 46;
|
|
6024
6080
|
break;
|
|
6025
6081
|
}
|
|
6026
6082
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
6027
6083
|
contextId: normalizedContextId,
|
|
6028
6084
|
editingProductLineUids: boundEditingUids
|
|
6029
6085
|
});
|
|
6030
|
-
case
|
|
6086
|
+
case 46:
|
|
6031
6087
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
6032
|
-
_context56.next =
|
|
6088
|
+
_context56.next = 48;
|
|
6033
6089
|
break;
|
|
6034
6090
|
}
|
|
6035
6091
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -6037,9 +6093,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6037
6093
|
currentContextVersion: context.activeVersion,
|
|
6038
6094
|
projectionContextVersion: projectionEntry.contextVersion
|
|
6039
6095
|
});
|
|
6040
|
-
case
|
|
6096
|
+
case 48:
|
|
6041
6097
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
6042
|
-
_context56.next =
|
|
6098
|
+
_context56.next = 50;
|
|
6043
6099
|
break;
|
|
6044
6100
|
}
|
|
6045
6101
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -6048,9 +6104,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6048
6104
|
projectionOrderRevision: projectionEntry.orderRevision,
|
|
6049
6105
|
currentOrderRevision: this.getCurrentOrderRevision()
|
|
6050
6106
|
});
|
|
6051
|
-
case
|
|
6107
|
+
case 50:
|
|
6052
6108
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
6053
|
-
_context56.next =
|
|
6109
|
+
_context56.next = 52;
|
|
6054
6110
|
break;
|
|
6055
6111
|
}
|
|
6056
6112
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -6058,35 +6114,35 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6058
6114
|
candidateContextVersion: params.candidate.availabilityContextVersion,
|
|
6059
6115
|
currentContextVersion: context.activeVersion
|
|
6060
6116
|
});
|
|
6061
|
-
case
|
|
6117
|
+
case 52:
|
|
6062
6118
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
6063
6119
|
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;
|
|
6064
6120
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
6065
|
-
_context56.next =
|
|
6121
|
+
_context56.next = 56;
|
|
6066
6122
|
break;
|
|
6067
6123
|
}
|
|
6068
6124
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
6069
6125
|
orderProductId: orderProductId,
|
|
6070
6126
|
candidateProductId: params.candidate.productId
|
|
6071
6127
|
});
|
|
6072
|
-
case
|
|
6128
|
+
case 56:
|
|
6073
6129
|
if (!(params.mode === 'edit' && !params.productLineUid)) {
|
|
6074
|
-
_context56.next =
|
|
6130
|
+
_context56.next = 58;
|
|
6075
6131
|
break;
|
|
6076
6132
|
}
|
|
6077
6133
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
6078
|
-
case
|
|
6134
|
+
case 58:
|
|
6079
6135
|
editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
6080
6136
|
if (!(params.mode === 'edit' && !editingLine)) {
|
|
6081
|
-
_context56.next =
|
|
6137
|
+
_context56.next = 61;
|
|
6082
6138
|
break;
|
|
6083
6139
|
}
|
|
6084
6140
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
6085
6141
|
productLineUid: params.productLineUid
|
|
6086
6142
|
});
|
|
6087
|
-
case
|
|
6143
|
+
case 61:
|
|
6088
6144
|
if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
6089
|
-
_context56.next =
|
|
6145
|
+
_context56.next = 63;
|
|
6090
6146
|
break;
|
|
6091
6147
|
}
|
|
6092
6148
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -6094,25 +6150,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6094
6150
|
productLineProductId: (_editingLine$product_2 = editingLine.product_id) !== null && _editingLine$product_2 !== void 0 ? _editingLine$product_2 : editingLine.id,
|
|
6095
6151
|
candidateProductId: params.candidate.productId
|
|
6096
6152
|
});
|
|
6097
|
-
case
|
|
6153
|
+
case 63:
|
|
6098
6154
|
if (Array.isArray(params.requirementSelections)) {
|
|
6099
|
-
_context56.next =
|
|
6155
|
+
_context56.next = 65;
|
|
6100
6156
|
break;
|
|
6101
6157
|
}
|
|
6102
6158
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
6103
6159
|
requirementSelections: params.requirementSelections
|
|
6104
6160
|
});
|
|
6105
|
-
case
|
|
6161
|
+
case 65:
|
|
6106
6162
|
baseProjection = projectionEntry.projection;
|
|
6107
6163
|
selectedProduct = baseProjection.products.find(function (item) {
|
|
6108
6164
|
return sameAvailabilityId(item.id, params.candidate.productId);
|
|
6109
6165
|
});
|
|
6110
|
-
if (!(isRememberedSelection && (String((_this$otherParams$
|
|
6111
|
-
_context56.next =
|
|
6166
|
+
if (!(isRememberedSelection && (String((_this$otherParams$pla6 = (_this$otherParams42 = this.otherParams) === null || _this$otherParams42 === void 0 ? void 0 : _this$otherParams42.platform) !== null && _this$otherParams$pla6 !== void 0 ? _this$otherParams$pla6 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add' || (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) !== 'duration'))) {
|
|
6167
|
+
_context56.next = 69;
|
|
6112
6168
|
break;
|
|
6113
6169
|
}
|
|
6114
6170
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
|
|
6115
|
-
case
|
|
6171
|
+
case 69:
|
|
6116
6172
|
commitWriteGuard = {
|
|
6117
6173
|
contextId: normalizedContextId,
|
|
6118
6174
|
expectedVersion: context.activeVersion,
|
|
@@ -6122,11 +6178,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6122
6178
|
};
|
|
6123
6179
|
prepareParams = baseProjection.meta.prepareParams;
|
|
6124
6180
|
if (prepareParams) {
|
|
6125
|
-
_context56.next =
|
|
6181
|
+
_context56.next = 73;
|
|
6126
6182
|
break;
|
|
6127
6183
|
}
|
|
6128
6184
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
6129
|
-
case
|
|
6185
|
+
case 73:
|
|
6130
6186
|
fallbackResources = {
|
|
6131
6187
|
resources: cloneDeep(_toConsumableArray(baseProjection.resources || [])),
|
|
6132
6188
|
resourceOccupancies: cloneDeep(_toConsumableArray(baseProjection.resourceOccupancies || []).filter(function (occupancy) {
|
|
@@ -6134,7 +6190,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6134
6190
|
})),
|
|
6135
6191
|
includesInjectedRawOccupancies: true
|
|
6136
6192
|
};
|
|
6137
|
-
_context56.next =
|
|
6193
|
+
_context56.next = 76;
|
|
6138
6194
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
6139
6195
|
editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
|
|
6140
6196
|
}), {
|
|
@@ -6142,20 +6198,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6142
6198
|
fallbackResources: fallbackResources,
|
|
6143
6199
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
6144
6200
|
});
|
|
6145
|
-
case
|
|
6201
|
+
case 76:
|
|
6146
6202
|
commitSnapshot = _context56.sent;
|
|
6147
6203
|
refreshedProjection = commitSnapshot.projection;
|
|
6148
6204
|
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 : ''))) {
|
|
6149
|
-
_context56.next =
|
|
6205
|
+
_context56.next = 83;
|
|
6150
6206
|
break;
|
|
6151
6207
|
}
|
|
6152
|
-
_context56.next =
|
|
6208
|
+
_context56.next = 81;
|
|
6153
6209
|
return this.refreshAvailabilityContextProjection({
|
|
6154
6210
|
contextId: normalizedContextId,
|
|
6155
6211
|
reason: 'commit_order_revision_changed',
|
|
6156
6212
|
previousOrderRevision: String((_baseProjection$meta$3 = baseProjection.meta.orderRevision) !== null && _baseProjection$meta$3 !== void 0 ? _baseProjection$meta$3 : '')
|
|
6157
6213
|
});
|
|
6158
|
-
case
|
|
6214
|
+
case 81:
|
|
6159
6215
|
latestContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
6160
6216
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '最终缓存重校验期间购物车已变化,请重新获取候选', {
|
|
6161
6217
|
contextId: normalizedContextId,
|
|
@@ -6166,19 +6222,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6166
6222
|
snapshotId: baseProjection.meta.snapshotId,
|
|
6167
6223
|
refreshedSnapshotId: refreshedProjection.meta.snapshotId
|
|
6168
6224
|
});
|
|
6169
|
-
case
|
|
6225
|
+
case 83:
|
|
6170
6226
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
6171
6227
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
6172
6228
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
6173
|
-
allowPosAvailabilityOverride = String((_this$otherParams$
|
|
6229
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla7 = (_this$otherParams43 = this.otherParams) === null || _this$otherParams43 === void 0 ? void 0 : _this$otherParams43.platform) !== null && _this$otherParams$pla7 !== void 0 ? _this$otherParams$pla7 : '').trim().toLowerCase() === 'pos' && !isRememberedSelection;
|
|
6174
6230
|
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));
|
|
6231
|
+
rememberedTimeByProductId = isOrderRememberedSelection ? this.resolveOrderRememberedTimes(context, refreshedProjection, _defineProperty({}, String(params.candidate.productId), {
|
|
6232
|
+
startAt: params.candidate.bookingStartAt,
|
|
6233
|
+
endAt: params.candidate.bookingEndAt
|
|
6234
|
+
}), params.orderSessionId) : undefined;
|
|
6175
6235
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
6176
6236
|
productIds: [params.candidate.productId],
|
|
6177
6237
|
dateRange: {
|
|
6178
6238
|
startDate: candidateBusinessDate,
|
|
6179
6239
|
endDate: candidateBusinessDate
|
|
6180
6240
|
}
|
|
6181
|
-
},
|
|
6241
|
+
}, rememberedTimeByProductId ? {
|
|
6242
|
+
rememberedTimeByProductId: rememberedTimeByProductId
|
|
6243
|
+
} : isRememberedSelection ? _objectSpread({
|
|
6182
6244
|
rememberedStartAtByProductId: _defineProperty({}, String(params.candidate.productId), params.candidate.bookingStartAt)
|
|
6183
6245
|
}, !(selectedProduct !== null && selectedProduct !== void 0 && selectedProduct.isFlexibleDuration) && candidateDurationMinutes ? {
|
|
6184
6246
|
durationMinutesByProductId: _defineProperty({}, String(params.candidate.productId), candidateDurationMinutes)
|
|
@@ -6194,6 +6256,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6194
6256
|
evaluatedAt: this.getAvailabilityRuntimeDateTime(),
|
|
6195
6257
|
useDurationTimeGrid: this.usesDurationTimeGrid(refreshedProjection),
|
|
6196
6258
|
enforceSaleCutoff: isRememberedSelection,
|
|
6259
|
+
rememberedTimeByProductId: rememberedTimeByProductId,
|
|
6197
6260
|
useExactDurationCandidateMinute: allowPosAvailabilityOverride,
|
|
6198
6261
|
allowSessionCustomRanges: allowPosAvailabilityOverride,
|
|
6199
6262
|
allowExcludedScheduleDateOverride: allowPosAvailabilityOverride
|
|
@@ -6204,7 +6267,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6204
6267
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
6205
6268
|
});
|
|
6206
6269
|
if (refreshedCandidateBase) {
|
|
6207
|
-
_context56.next =
|
|
6270
|
+
_context56.next = 93;
|
|
6208
6271
|
break;
|
|
6209
6272
|
}
|
|
6210
6273
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -6212,18 +6275,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6212
6275
|
candidate: params.candidate,
|
|
6213
6276
|
refreshedSnapshotId: refreshedProjection.meta.snapshotId
|
|
6214
6277
|
});
|
|
6215
|
-
case
|
|
6278
|
+
case 93:
|
|
6216
6279
|
product = refreshedProjection.products.find(function (item) {
|
|
6217
6280
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
6218
6281
|
});
|
|
6219
6282
|
if (product) {
|
|
6220
|
-
_context56.next =
|
|
6283
|
+
_context56.next = 96;
|
|
6221
6284
|
break;
|
|
6222
6285
|
}
|
|
6223
6286
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
6224
6287
|
productId: refreshedCandidateBase.productId
|
|
6225
6288
|
});
|
|
6226
|
-
case
|
|
6289
|
+
case 96:
|
|
6227
6290
|
validation = validateAvailabilitySelection(refreshedProjection, {
|
|
6228
6291
|
candidate: refreshedCandidateBase,
|
|
6229
6292
|
requirementSelections: params.requirementSelections,
|
|
@@ -6232,6 +6295,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6232
6295
|
}, {
|
|
6233
6296
|
useDurationTimeGrid: this.usesDurationTimeGrid(refreshedProjection),
|
|
6234
6297
|
enforceSaleCutoff: isRememberedSelection,
|
|
6298
|
+
rememberedTimeByProductId: rememberedTimeByProductId,
|
|
6235
6299
|
useExactDurationCandidateMinute: allowPosAvailabilityOverride,
|
|
6236
6300
|
allowExcludedScheduleDateOverride: allowPosAvailabilityOverride
|
|
6237
6301
|
});
|
|
@@ -6256,7 +6320,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6256
6320
|
});
|
|
6257
6321
|
}
|
|
6258
6322
|
if (validation.ok) {
|
|
6259
|
-
_context56.next =
|
|
6323
|
+
_context56.next = 101;
|
|
6260
6324
|
break;
|
|
6261
6325
|
}
|
|
6262
6326
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -6266,7 +6330,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6266
6330
|
validation: validation,
|
|
6267
6331
|
refreshedSnapshotId: refreshedProjection.meta.snapshotId
|
|
6268
6332
|
});
|
|
6269
|
-
case
|
|
6333
|
+
case 101:
|
|
6270
6334
|
// Revalidation failure must leave the caller's candidate reusable. Only publish the
|
|
6271
6335
|
// refreshed projection/version after candidate and resource validation has passed;
|
|
6272
6336
|
// otherwise a second Confirm from the still-open modal would incorrectly become stale.
|
|
@@ -6279,7 +6343,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6279
6343
|
incrementVersion: true
|
|
6280
6344
|
});
|
|
6281
6345
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
6282
|
-
_context56.next =
|
|
6346
|
+
_context56.next = 105;
|
|
6283
6347
|
return this.emitAvailabilityDiagnostic({
|
|
6284
6348
|
action: 'refresh',
|
|
6285
6349
|
contextId: normalizedContextId,
|
|
@@ -6290,7 +6354,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6290
6354
|
previousOrderRevision: baseProjection.meta.orderRevision,
|
|
6291
6355
|
reason: 'commit_cached_occupancy_revalidation'
|
|
6292
6356
|
});
|
|
6293
|
-
case
|
|
6357
|
+
case 105:
|
|
6294
6358
|
commitWriteGuard = {
|
|
6295
6359
|
contextId: normalizedContextId,
|
|
6296
6360
|
expectedVersion: revalidatedContext.activeVersion,
|
|
@@ -6307,6 +6371,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6307
6371
|
if (!availabilityCommitTargetGuard()) {
|
|
6308
6372
|
throw _this18.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '记忆时间加购期间订单或业务已变化');
|
|
6309
6373
|
}
|
|
6374
|
+
// Same-order immutable snapshots and generated sale IDs preserve the session.
|
|
6375
|
+
// Capture the actual object Order is about to publish, not an earlier snapshot.
|
|
6376
|
+
if (isOrderRememberedSelection) rememberedOrder = _this18.getTempOrder();
|
|
6310
6377
|
if (!isRememberedSelection) return;
|
|
6311
6378
|
var currentValidation = validateAvailabilitySelection(refreshedProjection, {
|
|
6312
6379
|
candidate: refreshedCandidateBase,
|
|
@@ -6315,7 +6382,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6315
6382
|
bookingCount: bookingCount
|
|
6316
6383
|
}, {
|
|
6317
6384
|
useDurationTimeGrid: true,
|
|
6318
|
-
enforceSaleCutoff: true
|
|
6385
|
+
enforceSaleCutoff: true,
|
|
6386
|
+
rememberedTimeByProductId: rememberedTimeByProductId
|
|
6319
6387
|
});
|
|
6320
6388
|
if (!currentValidation.ok) {
|
|
6321
6389
|
throw new AvailabilityError('REVALIDATION_FAILED', '记忆时间在加购前已不可用,请重新选择', {
|
|
@@ -6326,13 +6394,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6326
6394
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
6327
6395
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
6328
6396
|
if (!(params.mode === 'edit' && !existingBookingUid)) {
|
|
6329
|
-
_context56.next =
|
|
6397
|
+
_context56.next = 112;
|
|
6330
6398
|
break;
|
|
6331
6399
|
}
|
|
6332
6400
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
6333
6401
|
productLineUid: params.productLineUid
|
|
6334
6402
|
});
|
|
6335
|
-
case
|
|
6403
|
+
case 112:
|
|
6336
6404
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
6337
6405
|
booking = buildBookingFromAvailabilitySelection({
|
|
6338
6406
|
assignments: validation.assignments,
|
|
@@ -6340,11 +6408,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6340
6408
|
product: product,
|
|
6341
6409
|
resources: refreshedProjection.resources,
|
|
6342
6410
|
bookingUid: existingBookingUid || undefined,
|
|
6343
|
-
holder: (
|
|
6344
|
-
holderIds: (
|
|
6411
|
+
holder: (_ref60 = (_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 && _ref60 !== void 0 ? _ref60 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
|
|
6412
|
+
holderIds: (_ref61 = (_ref62 = (_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 && _ref62 !== void 0 ? _ref62 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref61 !== void 0 ? _ref61 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
|
|
6345
6413
|
});
|
|
6346
6414
|
if (!(isRememberedSelection && (_params$orderProduct9 = params.orderProduct) !== null && _params$orderProduct9 !== void 0 && (_params$orderProduct9 = _params$orderProduct9._extend) !== null && _params$orderProduct9 !== void 0 && _params$orderProduct9.resource)) {
|
|
6347
|
-
_context56.next =
|
|
6415
|
+
_context56.next = 122;
|
|
6348
6416
|
break;
|
|
6349
6417
|
}
|
|
6350
6418
|
// AutoClose 与编辑共用旧资源协议。仅复用其结构,实际资源及每份容量
|
|
@@ -6364,30 +6432,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6364
6432
|
return sameAvailabilityId(selected.form_id, resource.form_id);
|
|
6365
6433
|
});
|
|
6366
6434
|
}))) {
|
|
6367
|
-
_context56.next =
|
|
6435
|
+
_context56.next = 121;
|
|
6368
6436
|
break;
|
|
6369
6437
|
}
|
|
6370
6438
|
throw new AvailabilityError('REVALIDATION_FAILED', '记忆时间的资源与本次校验结果不一致');
|
|
6371
|
-
case
|
|
6439
|
+
case 121:
|
|
6372
6440
|
Object.assign(booking, {
|
|
6373
6441
|
relation_id: legacyBooking.relation_id,
|
|
6374
6442
|
form_id: legacyBooking.form_id,
|
|
6375
6443
|
relation_type: legacyBooking.relation_type,
|
|
6376
6444
|
resources: cloneDeep(legacyResources)
|
|
6377
6445
|
});
|
|
6378
|
-
case
|
|
6446
|
+
case 122:
|
|
6379
6447
|
transformed = this.buildUnifiedOrderProduct(_objectSpread(_objectSpread({}, params.orderProduct), {}, {
|
|
6380
6448
|
num: bookingCount,
|
|
6381
6449
|
quantity: bookingCount
|
|
6382
6450
|
}), 'unified_booking_sales', product);
|
|
6383
6451
|
if (transformed) {
|
|
6384
|
-
_context56.next =
|
|
6452
|
+
_context56.next = 125;
|
|
6385
6453
|
break;
|
|
6386
6454
|
}
|
|
6387
6455
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
6388
6456
|
orderProduct: params.orderProduct
|
|
6389
6457
|
});
|
|
6390
|
-
case
|
|
6458
|
+
case 125:
|
|
6391
6459
|
transformed.num = bookingCount;
|
|
6392
6460
|
transformed.metadata = _objectSpread(_objectSpread({}, transformed.metadata || {}), {}, {
|
|
6393
6461
|
unified_booking_sales: true,
|
|
@@ -6400,7 +6468,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6400
6468
|
productLineUids = [];
|
|
6401
6469
|
bookingUids = [];
|
|
6402
6470
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
6403
|
-
_context56.next =
|
|
6471
|
+
_context56.next = 146;
|
|
6404
6472
|
break;
|
|
6405
6473
|
}
|
|
6406
6474
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -6410,10 +6478,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6410
6478
|
unique_identification_number: params.productLineUid,
|
|
6411
6479
|
booking_uid: existingBookingUid
|
|
6412
6480
|
});
|
|
6413
|
-
_context56.next =
|
|
6481
|
+
_context56.next = 138;
|
|
6414
6482
|
return this.updateOrderProduct(_objectSpread(_objectSpread({
|
|
6415
6483
|
product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
|
|
6416
|
-
product_variant_id: (
|
|
6484
|
+
product_variant_id: (_ref63 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref63 !== void 0 ? _ref63 : 0,
|
|
6417
6485
|
unique_identification_number: params.productLineUid,
|
|
6418
6486
|
updates: transformed,
|
|
6419
6487
|
booking: booking
|
|
@@ -6422,17 +6490,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6422
6490
|
} : {}), params.allowBookingDiscountReapply !== undefined ? {
|
|
6423
6491
|
allow_booking_discount_reapply: params.allowBookingDiscountReapply
|
|
6424
6492
|
} : {}));
|
|
6425
|
-
case
|
|
6426
|
-
_context56.next =
|
|
6493
|
+
case 138:
|
|
6494
|
+
_context56.next = 140;
|
|
6427
6495
|
return this.removeBookingProductsOutsideStartDate(booking.start_date);
|
|
6428
|
-
case
|
|
6496
|
+
case 140:
|
|
6429
6497
|
productLineUid = params.productLineUid;
|
|
6430
6498
|
bookingUid = existingBookingUid;
|
|
6431
6499
|
productLineUids = [productLineUid];
|
|
6432
6500
|
bookingUids = [bookingUid];
|
|
6433
|
-
_context56.next =
|
|
6501
|
+
_context56.next = 164;
|
|
6434
6502
|
break;
|
|
6435
|
-
case
|
|
6503
|
+
case 146:
|
|
6436
6504
|
beforeProductLineUids = new Set((((_this$getTempOrder6 = this.getTempOrder()) === null || _this$getTempOrder6 === void 0 ? void 0 : _this$getTempOrder6.products) || []).map(function (line) {
|
|
6437
6505
|
return getProductLineUid(line);
|
|
6438
6506
|
}).filter(Boolean));
|
|
@@ -6440,20 +6508,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6440
6508
|
return getBookingUid(item);
|
|
6441
6509
|
}).filter(Boolean));
|
|
6442
6510
|
availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
|
|
6443
|
-
_context56.next =
|
|
6511
|
+
_context56.next = 151;
|
|
6444
6512
|
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 ? {
|
|
6445
6513
|
salesNotes: params.salesNotes
|
|
6446
6514
|
} : {}), availabilityCommitGuard ? {
|
|
6447
6515
|
availabilityCommitGuard: availabilityCommitGuard,
|
|
6448
6516
|
availabilityCommitTargetGuard: availabilityCommitTargetGuard
|
|
6449
6517
|
} : {}) : undefined);
|
|
6450
|
-
case 148:
|
|
6451
|
-
products = _context56.sent;
|
|
6452
|
-
_context56.next = 151;
|
|
6453
|
-
return this.removeBookingProductsOutsideStartDate(booking.start_date);
|
|
6454
6518
|
case 151:
|
|
6455
6519
|
products = _context56.sent;
|
|
6456
6520
|
guardedCommitPublished = hasCommitGuard;
|
|
6521
|
+
// A completed add can publish before a different order becomes current.
|
|
6522
|
+
// Keep its returned lines and never clean up products on that next order.
|
|
6523
|
+
if (!(!hasCommitGuard || availabilityCommitTargetGuard())) {
|
|
6524
|
+
_context56.next = 157;
|
|
6525
|
+
break;
|
|
6526
|
+
}
|
|
6527
|
+
_context56.next = 156;
|
|
6528
|
+
return this.removeBookingProductsOutsideStartDate(booking.start_date);
|
|
6529
|
+
case 156:
|
|
6530
|
+
products = _context56.sent;
|
|
6531
|
+
case 157:
|
|
6457
6532
|
addedLines = products.filter(function (line) {
|
|
6458
6533
|
var _line$product_id, _line$metadata;
|
|
6459
6534
|
return sameAvailabilityId((_line$product_id = line.product_id) !== null && _line$product_id !== void 0 ? _line$product_id : line.id, refreshedCandidate.productId) && ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeProductLineUids.has(getProductLineUid(line));
|
|
@@ -6461,7 +6536,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6461
6536
|
productLineUids = addedLines.map(function (line) {
|
|
6462
6537
|
return getProductLineUid(line);
|
|
6463
6538
|
}).filter(Boolean);
|
|
6464
|
-
addedBookings = (((
|
|
6539
|
+
addedBookings = (((_ref64 = hasCommitGuard ? rememberedOrder : this.getTempOrder()) === null || _ref64 === void 0 ? void 0 : _ref64.bookings) || []).filter(function (item) {
|
|
6465
6540
|
var _item$metadata;
|
|
6466
6541
|
return ((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeBookingUids.has(getBookingUid(item));
|
|
6467
6542
|
});
|
|
@@ -6470,13 +6545,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6470
6545
|
}).filter(Boolean);
|
|
6471
6546
|
if (bookingUids.length === 0) {
|
|
6472
6547
|
bookingUids = addedLines.map(function (line) {
|
|
6473
|
-
var
|
|
6474
|
-
return String((
|
|
6548
|
+
var _ref65, _line$booking_uid, _line$metadata2;
|
|
6549
|
+
return String((_ref65 = (_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 && _ref65 !== void 0 ? _ref65 : '');
|
|
6475
6550
|
}).filter(Boolean);
|
|
6476
6551
|
}
|
|
6477
6552
|
productLineUid = productLineUids[productLineUids.length - 1] || '';
|
|
6478
6553
|
bookingUid = bookingUids[bookingUids.length - 1] || '';
|
|
6479
|
-
case
|
|
6554
|
+
case 164:
|
|
6480
6555
|
targetStillCurrent = !hasCommitGuard || availabilityCommitTargetGuard();
|
|
6481
6556
|
if (targetStillCurrent) this.invalidateAvailabilityContextsAfterCommit();else this.removeAvailabilityContext(normalizedContextId);
|
|
6482
6557
|
nextContext = hasCommitGuard ? this.availabilityContextRegistry.get(normalizedContextId) : this.getAvailabilityContextEntry(normalizedContextId);
|
|
@@ -6492,7 +6567,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6492
6567
|
bookingUids: bookingUids
|
|
6493
6568
|
};
|
|
6494
6569
|
if (!targetStillCurrent) {
|
|
6495
|
-
_context56.next =
|
|
6570
|
+
_context56.next = 182;
|
|
6496
6571
|
break;
|
|
6497
6572
|
}
|
|
6498
6573
|
// A notification failure after publication must not invite a duplicate add.
|
|
@@ -6500,50 +6575,50 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6500
6575
|
return _this18.core.effects.emit("".concat(_this18.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
6501
6576
|
};
|
|
6502
6577
|
if (!guardedCommitPublished) {
|
|
6503
|
-
_context56.next =
|
|
6578
|
+
_context56.next = 180;
|
|
6504
6579
|
break;
|
|
6505
6580
|
}
|
|
6506
|
-
_context56.prev =
|
|
6507
|
-
_context56.next = 170;
|
|
6508
|
-
return emit();
|
|
6509
|
-
case 170:
|
|
6581
|
+
_context56.prev = 171;
|
|
6510
6582
|
_context56.next = 174;
|
|
6511
|
-
|
|
6512
|
-
case 172:
|
|
6513
|
-
_context56.prev = 172;
|
|
6514
|
-
_context56.t0 = _context56["catch"](167);
|
|
6583
|
+
return emit();
|
|
6515
6584
|
case 174:
|
|
6516
6585
|
_context56.next = 178;
|
|
6517
6586
|
break;
|
|
6518
6587
|
case 176:
|
|
6519
|
-
_context56.
|
|
6520
|
-
|
|
6588
|
+
_context56.prev = 176;
|
|
6589
|
+
_context56.t0 = _context56["catch"](171);
|
|
6521
6590
|
case 178:
|
|
6591
|
+
_context56.next = 182;
|
|
6592
|
+
break;
|
|
6593
|
+
case 180:
|
|
6594
|
+
_context56.next = 182;
|
|
6595
|
+
return emit();
|
|
6596
|
+
case 182:
|
|
6522
6597
|
return _context56.abrupt("return", result);
|
|
6523
|
-
case
|
|
6524
|
-
_context56.prev =
|
|
6598
|
+
case 183:
|
|
6599
|
+
_context56.prev = 183;
|
|
6525
6600
|
release = this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
6526
6601
|
if (!guardedCommitPublished) {
|
|
6527
|
-
_context56.next =
|
|
6602
|
+
_context56.next = 190;
|
|
6528
6603
|
break;
|
|
6529
6604
|
}
|
|
6530
|
-
_context56.next =
|
|
6605
|
+
_context56.next = 188;
|
|
6531
6606
|
return release.catch(function () {
|
|
6532
6607
|
return undefined;
|
|
6533
6608
|
});
|
|
6534
|
-
case
|
|
6535
|
-
_context56.next =
|
|
6609
|
+
case 188:
|
|
6610
|
+
_context56.next = 192;
|
|
6536
6611
|
break;
|
|
6537
|
-
case
|
|
6538
|
-
_context56.next =
|
|
6612
|
+
case 190:
|
|
6613
|
+
_context56.next = 192;
|
|
6539
6614
|
return release;
|
|
6540
|
-
case
|
|
6541
|
-
return _context56.finish(
|
|
6542
|
-
case
|
|
6615
|
+
case 192:
|
|
6616
|
+
return _context56.finish(183);
|
|
6617
|
+
case 193:
|
|
6543
6618
|
case "end":
|
|
6544
6619
|
return _context56.stop();
|
|
6545
6620
|
}
|
|
6546
|
-
}, _callee56, this, [[
|
|
6621
|
+
}, _callee56, this, [[18,, 183, 193], [171, 176]]);
|
|
6547
6622
|
}));
|
|
6548
6623
|
function commitAvailabilitySelection(_x41, _x42) {
|
|
6549
6624
|
return _commitAvailabilitySelection.apply(this, arguments);
|