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