@pisell/pisellos 0.10.77 → 0.10.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/evaluator.js +5 -4
- package/dist/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.js +27 -13
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.d.ts +2 -0
- package/dist/modules/ProductList/index.js +125 -39
- package/dist/modules/ResourcePlanner/planner.js +5 -0
- package/dist/modules/Rules/index.d.ts +3 -10
- package/dist/modules/Rules/index.js +164 -82
- package/dist/modules/Rules/promotionSelection.d.ts +14 -0
- package/dist/modules/Rules/promotionSelection.js +390 -0
- package/dist/modules/Rules/types.d.ts +9 -0
- package/dist/solution/BaseSales/index.d.ts +12 -1
- package/dist/solution/BaseSales/index.js +316 -206
- package/dist/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -13
- package/dist/solution/UnifiedBookingSales/index.d.ts +23 -1
- package/dist/solution/UnifiedBookingSales/index.js +1307 -635
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +25 -2
- package/dist/solution/UnifiedBookingSales/types.js +2 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +277 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +5 -4
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.js +11 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.d.ts +2 -0
- package/lib/modules/ProductList/index.js +56 -0
- package/lib/modules/ResourcePlanner/planner.js +4 -0
- package/lib/modules/Rules/index.d.ts +3 -10
- package/lib/modules/Rules/index.js +62 -22
- package/lib/modules/Rules/promotionSelection.d.ts +14 -0
- package/lib/modules/Rules/promotionSelection.js +230 -0
- package/lib/modules/Rules/types.d.ts +9 -0
- package/lib/solution/BaseSales/index.d.ts +12 -1
- package/lib/solution/BaseSales/index.js +84 -5
- package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -13
- package/lib/solution/UnifiedBookingSales/index.d.ts +23 -1
- package/lib/solution/UnifiedBookingSales/index.js +359 -5
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +25 -2
- package/lib/solution/UnifiedBookingSales/types.js +1 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +151 -0
- package/package.json +1 -1
|
@@ -38,19 +38,21 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
38
38
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
39
39
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
40
40
|
import dayjs from 'dayjs';
|
|
41
|
-
import { cloneDeep } from 'lodash-es';
|
|
41
|
+
import { cloneDeep, isEqual } from 'lodash-es';
|
|
42
42
|
import { OpenDataModule } from "../../modules";
|
|
43
43
|
import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
|
|
44
44
|
import { isProductFlexibleDuration, isSessionProduct, isBookingProduct, isMultiDayProduct } from "../../modules/BookingContext/utils";
|
|
45
45
|
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeSalesSettings } from "../../modules/OpenData";
|
|
46
46
|
import { getBookingBoundary, getBookingHolderIds, normalizeBookingDateTime, resolveDefaultBookingStart } from "./salesSettings";
|
|
47
47
|
import { getScheduleStartEndTimePoints } from "../../modules/Schedule/getDateIsInSchedule";
|
|
48
|
-
import { PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants } from "../../modules/ProductList/clientDataVariants";
|
|
48
|
+
import { PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants, tryResolveClientDataVariants } from "../../modules/ProductList/clientDataVariants";
|
|
49
49
|
import { AvailabilityError, createAvailabilityProjection, getProductTimeRanges as getProjectionProductTimeRanges, queryAvailabilityProjection, validateAvailabilitySelection } from "../../modules/ResourcePlanner";
|
|
50
50
|
import { UnifiedBookingSalesHooks } from "./types";
|
|
51
51
|
import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
|
|
52
|
+
import { AvailabilitySessionResourceCache } from "./sessionResourceCache";
|
|
52
53
|
import { BusinessAvailabilityController } from "./businessAvailability";
|
|
53
54
|
import { createCatalogQueryBatchAdapter } from "./catalogQueryBatch";
|
|
55
|
+
import { activeVenueMenus, createVenueCatalogSessionAdapter, productMatchesVenueMenu, readVenueCatalogList, validateVenueMenus, venueCatalogError } from "./venueCatalogSession";
|
|
54
56
|
import { BookingTicket } from "../BookingTicket";
|
|
55
57
|
import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
|
|
56
58
|
import { isCustomerUserPlatform, isSelfServicePlatform, normalizeRuntimePlatform } from "../../utils/platform";
|
|
@@ -1338,6 +1340,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1338
1340
|
_defineProperty(_assertThisInitialized(_this), "runtimeInitializationGeneration", 0);
|
|
1339
1341
|
_defineProperty(_assertThisInitialized(_this), "runtimeOpenDataDestroyed", false);
|
|
1340
1342
|
_defineProperty(_assertThisInitialized(_this), "unifiedProductCatalog", []);
|
|
1343
|
+
_defineProperty(_assertThisInitialized(_this), "venueCatalogSessions", new Set());
|
|
1344
|
+
_defineProperty(_assertThisInitialized(_this), "venueCatalogSessionKey", void 0);
|
|
1345
|
+
_defineProperty(_assertThisInitialized(_this), "venueCatalogMenus", void 0);
|
|
1346
|
+
_defineProperty(_assertThisInitialized(_this), "venueVariantDetails", new Map());
|
|
1341
1347
|
_defineProperty(_assertThisInitialized(_this), "availabilityRuntimeOffsetMinutes", null);
|
|
1342
1348
|
_defineProperty(_assertThisInitialized(_this), "availabilityScheduleCatalog", null);
|
|
1343
1349
|
_defineProperty(_assertThisInitialized(_this), "availabilityProjectionSequence", 0);
|
|
@@ -1348,6 +1354,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1348
1354
|
_defineProperty(_assertThisInitialized(_this), "availabilityPrepareInFlight", new Map());
|
|
1349
1355
|
_defineProperty(_assertThisInitialized(_this), "availabilityProjectionRefreshInFlight", new Map());
|
|
1350
1356
|
_defineProperty(_assertThisInitialized(_this), "availabilityRemoteOccupancyCache", new AvailabilityRemoteOccupancyCache(MAX_REMOTE_OCCUPANCY_RESOURCE_DATE_CELLS));
|
|
1357
|
+
_defineProperty(_assertThisInitialized(_this), "availabilitySessionResourceCache", new AvailabilitySessionResourceCache());
|
|
1351
1358
|
_defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceQueryInFlight", new Map());
|
|
1352
1359
|
_defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceQuerySequence", 0);
|
|
1353
1360
|
_defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceEpoch", 0);
|
|
@@ -1660,6 +1667,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1660
1667
|
value: function clearAvailabilityRemoteResourceState() {
|
|
1661
1668
|
this.availabilityRemoteResourceEpoch += 1;
|
|
1662
1669
|
this.availabilityRemoteOccupancyCache.clear();
|
|
1670
|
+
this.availabilitySessionResourceCache.clear();
|
|
1663
1671
|
this.availabilityRemoteResourceQueryInFlight.clear();
|
|
1664
1672
|
this.availabilityRemoteResourceQuerySequence = 0;
|
|
1665
1673
|
}
|
|
@@ -3259,62 +3267,672 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3259
3267
|
return _queryCatalogProductDetail.apply(this, arguments);
|
|
3260
3268
|
}
|
|
3261
3269
|
return queryCatalogProductDetail;
|
|
3270
|
+
}())
|
|
3271
|
+
}, {
|
|
3272
|
+
key: "isVenueCatalogLocalPricingActive",
|
|
3273
|
+
value: function isVenueCatalogLocalPricingActive() {
|
|
3274
|
+
return this.venueCatalogSessions.size > 0;
|
|
3275
|
+
}
|
|
3276
|
+
}, {
|
|
3277
|
+
key: "getVenueCatalogLocalPriceSource",
|
|
3278
|
+
value: function getVenueCatalogLocalPriceSource(productId, selectedProduct) {
|
|
3279
|
+
var _selectedProduct$meta,
|
|
3280
|
+
_this11 = this;
|
|
3281
|
+
var scope = this.getRuntimeOpenDataScope();
|
|
3282
|
+
var role = selectedProduct === null || selectedProduct === void 0 || (_selectedProduct$meta = selectedProduct.metadata) === null || _selectedProduct$meta === void 0 ? void 0 : _selectedProduct$meta.venue_booking_role;
|
|
3283
|
+
var poolRole = role === 'party_extra' || role === 'tickets_extra' ? 'extras' : role === 'party_main' || role === 'tickets' ? 'main' : undefined;
|
|
3284
|
+
var matches = Array.from(this.venueCatalogSessions).filter(function (entry) {
|
|
3285
|
+
var _entry$pool;
|
|
3286
|
+
return entry.scope === scope && entry.generation === _this11.runtimeInitializationGeneration && (!poolRole || entry.role === poolRole) && ((_entry$pool = entry.pool) === null || _entry$pool === void 0 ? void 0 : _entry$pool.products.some(function (row) {
|
|
3287
|
+
return Number(row.id) === productId;
|
|
3288
|
+
}));
|
|
3289
|
+
});
|
|
3290
|
+
if (!matches.length) return undefined;
|
|
3291
|
+
var pool = matches[0].pool;
|
|
3292
|
+
var product = this.getVenueCatalogHydratedProduct(pool.products.find(function (row) {
|
|
3293
|
+
return Number(row.id) === productId;
|
|
3294
|
+
}));
|
|
3295
|
+
// Legacy promotion/gift inputs may have no venue role. Equivalent complete
|
|
3296
|
+
// sources are unambiguous; different pool snapshots must never use Set order.
|
|
3297
|
+
if (matches.slice(1).some(function (entry) {
|
|
3298
|
+
return !isEqual(product, _this11.getVenueCatalogHydratedProduct(entry.pool.products.find(function (row) {
|
|
3299
|
+
return Number(row.id) === productId;
|
|
3300
|
+
}))) || !isEqual(pool.pricingMenus, entry.pool.pricingMenus);
|
|
3301
|
+
})) return undefined;
|
|
3302
|
+
return {
|
|
3303
|
+
product: cloneDeep(product),
|
|
3304
|
+
menuList: cloneDeep(pool.pricingMenus)
|
|
3305
|
+
};
|
|
3306
|
+
}
|
|
3307
|
+
}, {
|
|
3308
|
+
key: "getProductByIds",
|
|
3309
|
+
value: function () {
|
|
3310
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(ids, options) {
|
|
3311
|
+
var _this12 = this;
|
|
3312
|
+
var active, products;
|
|
3313
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3314
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3315
|
+
case 0:
|
|
3316
|
+
active = this.isVenueCatalogLocalPricingActive();
|
|
3317
|
+
_context30.next = 3;
|
|
3318
|
+
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "getProductByIds", this).call(this, ids, active ? {
|
|
3319
|
+
loadMissing: false
|
|
3320
|
+
} : options);
|
|
3321
|
+
case 3:
|
|
3322
|
+
products = _context30.sent;
|
|
3323
|
+
return _context30.abrupt("return", active ? products.map(function (product) {
|
|
3324
|
+
return _this12.getVenueCatalogHydratedProduct(product);
|
|
3325
|
+
}) : products);
|
|
3326
|
+
case 5:
|
|
3327
|
+
case "end":
|
|
3328
|
+
return _context30.stop();
|
|
3329
|
+
}
|
|
3330
|
+
}, _callee30, this);
|
|
3331
|
+
}));
|
|
3332
|
+
function getProductByIds(_x17, _x18) {
|
|
3333
|
+
return _getProductByIds.apply(this, arguments);
|
|
3334
|
+
}
|
|
3335
|
+
return getProductByIds;
|
|
3262
3336
|
}()
|
|
3337
|
+
}, {
|
|
3338
|
+
key: "getVenueCatalogHydratedProduct",
|
|
3339
|
+
value: function getVenueCatalogHydratedProduct(product) {
|
|
3340
|
+
var _this$venueVariantDet, _product$id;
|
|
3341
|
+
var variants = (_this$venueVariantDet = this.venueVariantDetails.get(Number((_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id))) === null || _this$venueVariantDet === void 0 ? void 0 : _this$venueVariantDet.data;
|
|
3342
|
+
return variants ? _objectSpread(_objectSpread({}, cloneDeep(product)), {}, {
|
|
3343
|
+
variant: cloneDeep(variants)
|
|
3344
|
+
}) : cloneDeep(product);
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
/** Explicit user opening for legacy promotion/gift SKU hosts. Pure readers never call this. */
|
|
3348
|
+
}, {
|
|
3349
|
+
key: "prepareVenueCatalogProductDetail",
|
|
3350
|
+
value: (function () {
|
|
3351
|
+
var _prepareVenueCatalogProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3352
|
+
var owner, scope, generation, source;
|
|
3353
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3354
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3355
|
+
case 0:
|
|
3356
|
+
if (this.isVenueCatalogLocalPricingActive()) {
|
|
3357
|
+
_context31.next = 2;
|
|
3358
|
+
break;
|
|
3359
|
+
}
|
|
3360
|
+
throw venueCatalogError('VENUE_CATALOG_REQUIRED', 'Open a venue catalog before configuring this product.');
|
|
3361
|
+
case 2:
|
|
3362
|
+
owner = this.venueCatalogSessionKey;
|
|
3363
|
+
scope = this.getRuntimeOpenDataScope();
|
|
3364
|
+
generation = this.runtimeInitializationGeneration;
|
|
3365
|
+
source = this.getVenueCatalogLocalPriceSource(params.product_id);
|
|
3366
|
+
if (source) {
|
|
3367
|
+
_context31.next = 8;
|
|
3368
|
+
break;
|
|
3369
|
+
}
|
|
3370
|
+
return _context31.abrupt("return", undefined);
|
|
3371
|
+
case 8:
|
|
3372
|
+
_context31.next = 10;
|
|
3373
|
+
return this.hydrateVenueVariantDetail(source.product, params);
|
|
3374
|
+
case 10:
|
|
3375
|
+
if (!(this.runtimeOpenDataDestroyed || !this.isVenueCatalogLocalPricingActive() || owner !== this.venueCatalogSessionKey || scope !== this.getRuntimeOpenDataScope() || generation !== this.runtimeInitializationGeneration)) {
|
|
3376
|
+
_context31.next = 12;
|
|
3377
|
+
break;
|
|
3378
|
+
}
|
|
3379
|
+
throw venueCatalogError('VENUE_CATALOG_STALE', 'The venue catalog changed while loading product options.');
|
|
3380
|
+
case 12:
|
|
3381
|
+
return _context31.abrupt("return", this.getVenueCatalogHydratedProduct(source.product));
|
|
3382
|
+
case 13:
|
|
3383
|
+
case "end":
|
|
3384
|
+
return _context31.stop();
|
|
3385
|
+
}
|
|
3386
|
+
}, _callee31, this);
|
|
3387
|
+
}));
|
|
3388
|
+
function prepareVenueCatalogProductDetail(_x19) {
|
|
3389
|
+
return _prepareVenueCatalogProductDetail.apply(this, arguments);
|
|
3390
|
+
}
|
|
3391
|
+
return prepareVenueCatalogProductDetail;
|
|
3392
|
+
}())
|
|
3393
|
+
}, {
|
|
3394
|
+
key: "hydrateVenueVariantDetail",
|
|
3395
|
+
value: function () {
|
|
3396
|
+
var _hydrateVenueVariantDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(raw, params) {
|
|
3397
|
+
var _raw$id2,
|
|
3398
|
+
_entry,
|
|
3399
|
+
_this13 = this;
|
|
3400
|
+
var count, productId, entry, owner, scope, generation, core, request, next, assertCurrent;
|
|
3401
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3402
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3403
|
+
case 0:
|
|
3404
|
+
if (!(Number(raw.is_variant) !== 1)) {
|
|
3405
|
+
_context33.next = 2;
|
|
3406
|
+
break;
|
|
3407
|
+
}
|
|
3408
|
+
return _context33.abrupt("return");
|
|
3409
|
+
case 2:
|
|
3410
|
+
count = Number(raw.variant_count) || 0;
|
|
3411
|
+
if (!(Array.isArray(raw.variant) && raw.variant.length > 0 && raw.variant.length >= count)) {
|
|
3412
|
+
_context33.next = 5;
|
|
3413
|
+
break;
|
|
3414
|
+
}
|
|
3415
|
+
return _context33.abrupt("return");
|
|
3416
|
+
case 5:
|
|
3417
|
+
productId = Number((_raw$id2 = raw.id) !== null && _raw$id2 !== void 0 ? _raw$id2 : raw.product_id);
|
|
3418
|
+
entry = this.venueVariantDetails.get(productId);
|
|
3419
|
+
if ((_entry = entry) !== null && _entry !== void 0 && _entry.failed && params.retry === true) {
|
|
3420
|
+
this.venueVariantDetails.delete(productId);
|
|
3421
|
+
entry = undefined;
|
|
3422
|
+
}
|
|
3423
|
+
if (!entry) {
|
|
3424
|
+
owner = this.venueCatalogSessionKey;
|
|
3425
|
+
scope = this.getRuntimeOpenDataScope();
|
|
3426
|
+
generation = this.runtimeInitializationGeneration;
|
|
3427
|
+
core = this.core;
|
|
3428
|
+
request = this.request;
|
|
3429
|
+
next = {
|
|
3430
|
+
promise: Promise.resolve([])
|
|
3431
|
+
};
|
|
3432
|
+
assertCurrent = function assertCurrent() {
|
|
3433
|
+
if (_this13.runtimeOpenDataDestroyed || !_this13.isVenueCatalogLocalPricingActive() || owner !== _this13.venueCatalogSessionKey || scope !== _this13.getRuntimeOpenDataScope() || generation !== _this13.runtimeInitializationGeneration || core !== _this13.core || request !== _this13.request || _this13.venueVariantDetails.get(productId) !== next) {
|
|
3434
|
+
throw venueCatalogError('VENUE_CATALOG_STALE', 'The venue catalog changed while loading product options.');
|
|
3435
|
+
}
|
|
3436
|
+
};
|
|
3437
|
+
this.venueVariantDetails.set(productId, next);
|
|
3438
|
+
next.promise = Promise.resolve().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
3439
|
+
var _response$data$item, _response$data2, _detail$id;
|
|
3440
|
+
var response, detail, variants, _iterator, _step, _this13$store$product, _this13$store$product2, _this13$store$product3, _this13$store$product4, _this13$store$product5, _this13$store$product6, pool, product, hydrated;
|
|
3441
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3442
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3443
|
+
case 0:
|
|
3444
|
+
assertCurrent();
|
|
3445
|
+
_context32.next = 3;
|
|
3446
|
+
return request.get("/product/show/".concat(productId), {
|
|
3447
|
+
open_bundle: 1,
|
|
3448
|
+
with_schedule: 1,
|
|
3449
|
+
is_eject: 1,
|
|
3450
|
+
with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS)
|
|
3451
|
+
}, {
|
|
3452
|
+
useCache: false,
|
|
3453
|
+
customToast: function customToast() {}
|
|
3454
|
+
});
|
|
3455
|
+
case 3:
|
|
3456
|
+
response = _context32.sent;
|
|
3457
|
+
assertCurrent();
|
|
3458
|
+
if (!((response === null || response === void 0 ? void 0 : response.status) === false || (response === null || response === void 0 ? void 0 : response.code) != null && Number(response.code) !== 200)) {
|
|
3459
|
+
_context32.next = 7;
|
|
3460
|
+
break;
|
|
3461
|
+
}
|
|
3462
|
+
throw venueCatalogError('VENUE_VARIANT_DETAIL_FAILED', (response === null || response === void 0 ? void 0 : response.message) || 'Product options could not be loaded.');
|
|
3463
|
+
case 7:
|
|
3464
|
+
detail = (_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;
|
|
3465
|
+
if (!(Number((_detail$id = detail === null || detail === void 0 ? void 0 : detail.id) !== null && _detail$id !== void 0 ? _detail$id : detail === null || detail === void 0 ? void 0 : detail.product_id) !== productId || !Array.isArray(detail === null || detail === void 0 ? void 0 : detail.variant) || !detail.variant.length || detail.variant.length < count)) {
|
|
3466
|
+
_context32.next = 10;
|
|
3467
|
+
break;
|
|
3468
|
+
}
|
|
3469
|
+
throw venueCatalogError('VENUE_VARIANT_DETAIL_INCOMPLETE', 'Complete product variants are unavailable. Please retry.');
|
|
3470
|
+
case 10:
|
|
3471
|
+
variants = detail.variant.map(function (value) {
|
|
3472
|
+
var _variant$_dataVariant, _variant$metadata, _ref42, _ref43, _original$price;
|
|
3473
|
+
var variant = cloneDeep(value);
|
|
3474
|
+
var original = (_variant$_dataVariant = variant._dataVariant) === null || _variant$_dataVariant === void 0 ? void 0 : _variant$_dataVariant.original;
|
|
3475
|
+
var evaluated = variant._dataVariant || Array.isArray((_variant$metadata = variant.metadata) === null || _variant$metadata === void 0 ? void 0 : _variant$metadata.data_variant_ids);
|
|
3476
|
+
var basePrice = (_ref42 = (_ref43 = (_original$price = original === null || original === void 0 ? void 0 : original.price) !== null && _original$price !== void 0 ? _original$price : original === null || original === void 0 ? void 0 : original.base_price) !== null && _ref43 !== void 0 ? _ref43 : variant.base_price) !== null && _ref42 !== void 0 ? _ref42 : evaluated ? undefined : variant.price;
|
|
3477
|
+
if (!Number.isSafeInteger(Number(variant.id)) || Number(variant.id) <= 0 || basePrice === undefined || basePrice === null || basePrice === '' || !Number.isFinite(Number(basePrice))) {
|
|
3478
|
+
throw venueCatalogError('VENUE_VARIANT_DETAIL_INCOMPLETE', 'The base price for a product variant is unavailable.');
|
|
3479
|
+
}
|
|
3480
|
+
// Copy only combination SKU data. The pool's price/data_variants and
|
|
3481
|
+
// pricing metadata remain its original baseline for every later context.
|
|
3482
|
+
variant.price = basePrice;
|
|
3483
|
+
variant.base_price = basePrice;
|
|
3484
|
+
if (variant.selling_price !== undefined) variant.selling_price = basePrice;
|
|
3485
|
+
delete variant._dataVariant;
|
|
3486
|
+
if (variant.metadata) delete variant.metadata.data_variant_ids;
|
|
3487
|
+
return variant;
|
|
3488
|
+
});
|
|
3489
|
+
next.data = variants;
|
|
3490
|
+
_iterator = _createForOfIteratorHelper(_this13.venueCatalogSessions);
|
|
3491
|
+
_context32.prev = 13;
|
|
3492
|
+
_iterator.s();
|
|
3493
|
+
case 15:
|
|
3494
|
+
if ((_step = _iterator.n()).done) {
|
|
3495
|
+
_context32.next = 27;
|
|
3496
|
+
break;
|
|
3497
|
+
}
|
|
3498
|
+
pool = _step.value;
|
|
3499
|
+
if (!(pool.scope !== scope || !pool.pool)) {
|
|
3500
|
+
_context32.next = 19;
|
|
3501
|
+
break;
|
|
3502
|
+
}
|
|
3503
|
+
return _context32.abrupt("continue", 25);
|
|
3504
|
+
case 19:
|
|
3505
|
+
product = pool.pool.products.find(function (row) {
|
|
3506
|
+
return Number(row.id) === productId;
|
|
3507
|
+
});
|
|
3508
|
+
if (product) {
|
|
3509
|
+
_context32.next = 22;
|
|
3510
|
+
break;
|
|
3511
|
+
}
|
|
3512
|
+
return _context32.abrupt("continue", 25);
|
|
3513
|
+
case 22:
|
|
3514
|
+
hydrated = _this13.getVenueCatalogHydratedProduct(product);
|
|
3515
|
+
(_this13$store$product = _this13.store.products) === null || _this13$store$product === void 0 || (_this13$store$product2 = (_this13$store$product3 = _this13$store$product).rememberRawProductQueryResult) === null || _this13$store$product2 === void 0 || _this13$store$product2.call(_this13$store$product3, [cloneDeep(hydrated)]);
|
|
3516
|
+
(_this13$store$product4 = _this13.store.products) === null || _this13$store$product4 === void 0 || (_this13$store$product5 = (_this13$store$product6 = _this13$store$product4).addProduct) === null || _this13$store$product5 === void 0 || _this13$store$product5.call(_this13$store$product6, [cloneDeep(hydrated)]);
|
|
3517
|
+
case 25:
|
|
3518
|
+
_context32.next = 15;
|
|
3519
|
+
break;
|
|
3520
|
+
case 27:
|
|
3521
|
+
_context32.next = 32;
|
|
3522
|
+
break;
|
|
3523
|
+
case 29:
|
|
3524
|
+
_context32.prev = 29;
|
|
3525
|
+
_context32.t0 = _context32["catch"](13);
|
|
3526
|
+
_iterator.e(_context32.t0);
|
|
3527
|
+
case 32:
|
|
3528
|
+
_context32.prev = 32;
|
|
3529
|
+
_iterator.f();
|
|
3530
|
+
return _context32.finish(32);
|
|
3531
|
+
case 35:
|
|
3532
|
+
return _context32.abrupt("return", variants);
|
|
3533
|
+
case 36:
|
|
3534
|
+
case "end":
|
|
3535
|
+
return _context32.stop();
|
|
3536
|
+
}
|
|
3537
|
+
}, _callee32, null, [[13, 29, 32, 35]]);
|
|
3538
|
+
}))).catch(function (error) {
|
|
3539
|
+
next.failed = true;
|
|
3540
|
+
throw error;
|
|
3541
|
+
});
|
|
3542
|
+
entry = next;
|
|
3543
|
+
}
|
|
3544
|
+
_context33.next = 11;
|
|
3545
|
+
return entry.promise;
|
|
3546
|
+
case 11:
|
|
3547
|
+
case "end":
|
|
3548
|
+
return _context33.stop();
|
|
3549
|
+
}
|
|
3550
|
+
}, _callee33, this);
|
|
3551
|
+
}));
|
|
3552
|
+
function hydrateVenueVariantDetail(_x20, _x21) {
|
|
3553
|
+
return _hydrateVenueVariantDetail.apply(this, arguments);
|
|
3554
|
+
}
|
|
3555
|
+
return hydrateVenueVariantDetail;
|
|
3556
|
+
}() /** One complete raw product query per explicitly configured pool for this page lifetime. */
|
|
3557
|
+
}, {
|
|
3558
|
+
key: "createVenueCatalogSession",
|
|
3559
|
+
value: function createVenueCatalogSession(params) {
|
|
3560
|
+
var _this$otherParams30,
|
|
3561
|
+
_params$sessionKey,
|
|
3562
|
+
_this14 = this;
|
|
3563
|
+
if (!isCustomerUserPlatform((_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform)) {
|
|
3564
|
+
throw venueCatalogError('VENUE_CATALOG_PLATFORM_UNSUPPORTED', 'Venue catalog sessions require a customer platform.');
|
|
3565
|
+
}
|
|
3566
|
+
var ids = params.menu_list_ids;
|
|
3567
|
+
if (!Array.isArray(ids) || !ids.length || ids.some(function (id) {
|
|
3568
|
+
return !Number.isSafeInteger(id) || id <= 0;
|
|
3569
|
+
})) {
|
|
3570
|
+
throw venueCatalogError('VENUE_MENU_REQUIRED', 'Choose an explicit menu for this venue product pool.');
|
|
3571
|
+
}
|
|
3572
|
+
var menuIds = _toConsumableArray(new Set(ids)).sort(function (a, b) {
|
|
3573
|
+
return a - b;
|
|
3574
|
+
});
|
|
3575
|
+
var scope = this.getRuntimeOpenDataScope();
|
|
3576
|
+
var generation = this.runtimeInitializationGeneration;
|
|
3577
|
+
var core = this.core;
|
|
3578
|
+
var request = this.request;
|
|
3579
|
+
var entry = {
|
|
3580
|
+
scope: scope,
|
|
3581
|
+
generation: generation,
|
|
3582
|
+
role: params.poolRole
|
|
3583
|
+
};
|
|
3584
|
+
var sessionKey = JSON.stringify([scope, generation, (_params$sessionKey = params.sessionKey) !== null && _params$sessionKey !== void 0 ? _params$sessionKey : null]);
|
|
3585
|
+
if (!this.venueCatalogSessions.size || sessionKey !== this.venueCatalogSessionKey) {
|
|
3586
|
+
// React may create new page pools before disposing the old page's pools.
|
|
3587
|
+
// The explicit session identity prevents reusing old-order occupancy then.
|
|
3588
|
+
this.venueCatalogSessions.clear();
|
|
3589
|
+
this.venueCatalogSessionKey = sessionKey;
|
|
3590
|
+
this.venueCatalogMenus = undefined;
|
|
3591
|
+
this.venueVariantDetails.clear();
|
|
3592
|
+
this.availabilitySessionResourceCache.clear();
|
|
3593
|
+
}
|
|
3594
|
+
this.venueCatalogSessions.add(entry);
|
|
3595
|
+
var assertCurrent = function assertCurrent() {
|
|
3596
|
+
if (!_this14.venueCatalogSessions.has(entry)) {
|
|
3597
|
+
throw venueCatalogError('VENUE_CATALOG_DISPOSED', 'The venue catalog session is closed.');
|
|
3598
|
+
}
|
|
3599
|
+
if (_this14.runtimeOpenDataDestroyed || _this14.core !== core || _this14.request !== request || generation !== _this14.runtimeInitializationGeneration || scope !== _this14.getRuntimeOpenDataScope()) {
|
|
3600
|
+
throw venueCatalogError('VENUE_CATALOG_STALE', 'The venue store context changed. Reopen the booking page.');
|
|
3601
|
+
}
|
|
3602
|
+
};
|
|
3603
|
+
var now = function now() {
|
|
3604
|
+
var _this14$otherParams;
|
|
3605
|
+
var timezone = String(((_this14$otherParams = _this14.otherParams) === null || _this14$otherParams === void 0 ? void 0 : _this14$otherParams.businessTimezone) || _this14.getPickupTimingContextData('timezone') || '').trim();
|
|
3606
|
+
if (!timezone) throw venueCatalogError('VENUE_TIMEZONE_REQUIRED', 'The venue timezone is not ready.');
|
|
3607
|
+
var parts = new Intl.DateTimeFormat('en-GB', {
|
|
3608
|
+
timeZone: timezone,
|
|
3609
|
+
year: 'numeric',
|
|
3610
|
+
month: '2-digit',
|
|
3611
|
+
day: '2-digit',
|
|
3612
|
+
hour: '2-digit',
|
|
3613
|
+
minute: '2-digit',
|
|
3614
|
+
second: '2-digit',
|
|
3615
|
+
hourCycle: 'h23'
|
|
3616
|
+
}).formatToParts(new Date());
|
|
3617
|
+
var part = function part(type) {
|
|
3618
|
+
var _parts$find;
|
|
3619
|
+
return (_parts$find = parts.find(function (item) {
|
|
3620
|
+
return item.type === type;
|
|
3621
|
+
})) === null || _parts$find === void 0 ? void 0 : _parts$find.value;
|
|
3622
|
+
};
|
|
3623
|
+
return "".concat(part('year'), "-").concat(part('month'), "-").concat(part('day'), " ").concat(part('hour'), ":").concat(part('minute'), ":").concat(part('second'));
|
|
3624
|
+
};
|
|
3625
|
+
var snapshot = function snapshot(pool, input) {
|
|
3626
|
+
var _input$product_ids, _this14$core$getPlugi, _this14$core, _ref44, _input$customer_id, _this14$getTempOrder, _user$get;
|
|
3627
|
+
assertCurrent();
|
|
3628
|
+
if (input.menu_list_ids && JSON.stringify(_toConsumableArray(new Set(input.menu_list_ids)).sort(function (a, b) {
|
|
3629
|
+
return a - b;
|
|
3630
|
+
})) !== JSON.stringify(menuIds)) {
|
|
3631
|
+
throw venueCatalogError('VENUE_MENU_SCOPE_CHANGED', 'This catalog session belongs to another menu.');
|
|
3632
|
+
}
|
|
3633
|
+
var current = now();
|
|
3634
|
+
var datetime = input.schedule_datetime || (input.schedule_date ? "".concat(input.schedule_date, " ").concat(current.slice(11)) : current);
|
|
3635
|
+
if (!parseLocalDateTime(datetime.replace('T', ' ')) || input.schedule_date && datetime.slice(0, 10) !== input.schedule_date) {
|
|
3636
|
+
throw venueCatalogError('VENUE_CATALOG_DATETIME_INVALID', 'Choose a valid venue catalog date and time.');
|
|
3637
|
+
}
|
|
3638
|
+
var menus = activeVenueMenus(pool.menus, _this14.getAvailabilityScheduleCatalog(), datetime, Boolean(input.schedule_date && !input.schedule_datetime));
|
|
3639
|
+
var products = pool.products.filter(function (product) {
|
|
3640
|
+
return menus.some(function (menu) {
|
|
3641
|
+
return productMatchesVenueMenu(product, menu);
|
|
3642
|
+
});
|
|
3643
|
+
}).map(function (product) {
|
|
3644
|
+
return _this14.getVenueCatalogHydratedProduct(product);
|
|
3645
|
+
});
|
|
3646
|
+
if ((_input$product_ids = input.product_ids) !== null && _input$product_ids !== void 0 && _input$product_ids.length) products = products.filter(function (product) {
|
|
3647
|
+
return input.product_ids.some(function (id) {
|
|
3648
|
+
return Number(id) === Number(product.id);
|
|
3649
|
+
});
|
|
3650
|
+
});
|
|
3651
|
+
var user = (_this14$core$getPlugi = (_this14$core = _this14.core).getPlugin) === null || _this14$core$getPlugi === void 0 ? void 0 : _this14$core$getPlugi.call(_this14$core, 'user');
|
|
3652
|
+
var queryPayload = {
|
|
3653
|
+
schedule_date: datetime.slice(0, 10),
|
|
3654
|
+
schedule_datetime: datetime,
|
|
3655
|
+
customer_id: (_ref44 = (_input$customer_id = input.customer_id) !== null && _input$customer_id !== void 0 ? _input$customer_id : (_this14$getTempOrder = _this14.getTempOrder()) === null || _this14$getTempOrder === void 0 ? void 0 : _this14$getTempOrder.customer_id) !== null && _ref44 !== void 0 ? _ref44 : 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,
|
|
3656
|
+
strategy_context: _objectSpread(_objectSpread({}, _this14.getPriceQueryStrategyContext()), input.strategy_context || {})
|
|
3657
|
+
};
|
|
3658
|
+
var result = tryResolveClientDataVariants({
|
|
3659
|
+
core: _this14.core,
|
|
3660
|
+
otherParams: _this14.otherParams,
|
|
3661
|
+
products: cloneDeep(products),
|
|
3662
|
+
queryPayload: queryPayload,
|
|
3663
|
+
handledByOsServer: false,
|
|
3664
|
+
scheduleList: _this14.getAvailabilityScheduleCatalog(),
|
|
3665
|
+
menuList: pool.pricingMenus
|
|
3666
|
+
});
|
|
3667
|
+
if (result.status !== 'resolved' && result.status !== 'empty') {
|
|
3668
|
+
throw venueCatalogError('VENUE_LOCAL_PRICE_UNAVAILABLE', 'Complete product pricing rules are not ready. Please retry.');
|
|
3669
|
+
}
|
|
3670
|
+
return result.products.slice().sort(function (a, b) {
|
|
3671
|
+
return Number(b.sort || 0) - Number(a.sort || 0);
|
|
3672
|
+
});
|
|
3673
|
+
};
|
|
3674
|
+
return createVenueCatalogSessionAdapter({
|
|
3675
|
+
assertCurrent: assertCurrent,
|
|
3676
|
+
load: function () {
|
|
3677
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
3678
|
+
var promise, pricingMenus, menus, onlyIds, onlyCollections, productIds, collections, products, pool;
|
|
3679
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3680
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3681
|
+
case 0:
|
|
3682
|
+
if (!_this14.venueCatalogMenus || _this14.venueCatalogMenus.scope !== scope) {
|
|
3683
|
+
promise = request.get('/form/data/v1', {
|
|
3684
|
+
skip: 1,
|
|
3685
|
+
num: 999,
|
|
3686
|
+
code: 'menu_list'
|
|
3687
|
+
}, {
|
|
3688
|
+
useCache: false,
|
|
3689
|
+
customToast: function customToast() {}
|
|
3690
|
+
}).then(function (response) {
|
|
3691
|
+
return readVenueCatalogList(response, 'Venue menus');
|
|
3692
|
+
});
|
|
3693
|
+
_this14.venueCatalogMenus = {
|
|
3694
|
+
scope: scope,
|
|
3695
|
+
promise: promise
|
|
3696
|
+
};
|
|
3697
|
+
void promise.catch(function () {
|
|
3698
|
+
var _this14$venueCatalogM;
|
|
3699
|
+
if (((_this14$venueCatalogM = _this14.venueCatalogMenus) === null || _this14$venueCatalogM === void 0 ? void 0 : _this14$venueCatalogM.promise) === promise) _this14.venueCatalogMenus = undefined;
|
|
3700
|
+
});
|
|
3701
|
+
}
|
|
3702
|
+
_context34.next = 3;
|
|
3703
|
+
return _this14.venueCatalogMenus.promise;
|
|
3704
|
+
case 3:
|
|
3705
|
+
pricingMenus = _context34.sent;
|
|
3706
|
+
menus = validateVenueMenus(pricingMenus, menuIds);
|
|
3707
|
+
assertCurrent();
|
|
3708
|
+
// A menu query with a date may exclude future members. Read the raw ID union
|
|
3709
|
+
// without menu/time/customer pricing filters, then filter collection/all menus locally.
|
|
3710
|
+
onlyIds = menus.every(function (menu) {
|
|
3711
|
+
return menu.partyroom_package.type === 'products';
|
|
3712
|
+
});
|
|
3713
|
+
onlyCollections = menus.every(function (menu) {
|
|
3714
|
+
return menu.partyroom_package.type === 'product_collection';
|
|
3715
|
+
});
|
|
3716
|
+
productIds = onlyIds ? _toConsumableArray(new Set(menus.flatMap(function (menu) {
|
|
3717
|
+
return menu.partyroom_package.products.map(function (product) {
|
|
3718
|
+
return Number(product.product_id);
|
|
3719
|
+
});
|
|
3720
|
+
}))) : undefined;
|
|
3721
|
+
collections = onlyCollections ? _toConsumableArray(new Set(menus.flatMap(function (menu) {
|
|
3722
|
+
return menu.partyroom_package.products.map(function (product) {
|
|
3723
|
+
return String(product.product_collection_id);
|
|
3724
|
+
});
|
|
3725
|
+
}))) : undefined;
|
|
3726
|
+
if (!(onlyIds && !(productIds !== null && productIds !== void 0 && productIds.length))) {
|
|
3727
|
+
_context34.next = 14;
|
|
3728
|
+
break;
|
|
3729
|
+
}
|
|
3730
|
+
_context34.t0 = [];
|
|
3731
|
+
_context34.next = 17;
|
|
3732
|
+
break;
|
|
3733
|
+
case 14:
|
|
3734
|
+
_context34.next = 16;
|
|
3735
|
+
return _this14.store.products.loadVenueCatalogPool({
|
|
3736
|
+
product_ids: productIds,
|
|
3737
|
+
collection: collections,
|
|
3738
|
+
category_ids: params.category_ids,
|
|
3739
|
+
extension_type: params.extension_type,
|
|
3740
|
+
cacheId: _this14.cacheId
|
|
3741
|
+
});
|
|
3742
|
+
case 16:
|
|
3743
|
+
_context34.t0 = _context34.sent;
|
|
3744
|
+
case 17:
|
|
3745
|
+
products = _context34.t0;
|
|
3746
|
+
assertCurrent();
|
|
3747
|
+
pool = {
|
|
3748
|
+
menus: menus,
|
|
3749
|
+
pricingMenus: cloneDeep(pricingMenus),
|
|
3750
|
+
products: products.filter(function (product) {
|
|
3751
|
+
return menus.some(function (menu) {
|
|
3752
|
+
return productMatchesVenueMenu(product, menu);
|
|
3753
|
+
});
|
|
3754
|
+
})
|
|
3755
|
+
};
|
|
3756
|
+
entry.pool = cloneDeep(pool);
|
|
3757
|
+
// Legacy marketing lookups can reuse complete records without changing
|
|
3758
|
+
// either pool's membership or publishing a replacement sales catalog.
|
|
3759
|
+
_this14.store.products.rememberRawProductQueryResult(cloneDeep(pool.products));
|
|
3760
|
+
_this14.store.products.addProduct(cloneDeep(pool.products));
|
|
3761
|
+
return _context34.abrupt("return", pool);
|
|
3762
|
+
case 24:
|
|
3763
|
+
case "end":
|
|
3764
|
+
return _context34.stop();
|
|
3765
|
+
}
|
|
3766
|
+
}, _callee34);
|
|
3767
|
+
}));
|
|
3768
|
+
function load() {
|
|
3769
|
+
return _load.apply(this, arguments);
|
|
3770
|
+
}
|
|
3771
|
+
return load;
|
|
3772
|
+
}(),
|
|
3773
|
+
snapshot: snapshot,
|
|
3774
|
+
prepareDetail: function () {
|
|
3775
|
+
var _prepareDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(pool, query) {
|
|
3776
|
+
var raw;
|
|
3777
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3778
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3779
|
+
case 0:
|
|
3780
|
+
raw = pool.products.find(function (product) {
|
|
3781
|
+
return Number(product.id) === Number(query.product_id);
|
|
3782
|
+
});
|
|
3783
|
+
if (!raw) {
|
|
3784
|
+
_context35.next = 4;
|
|
3785
|
+
break;
|
|
3786
|
+
}
|
|
3787
|
+
_context35.next = 4;
|
|
3788
|
+
return _this14.hydrateVenueVariantDetail(raw, query);
|
|
3789
|
+
case 4:
|
|
3790
|
+
assertCurrent();
|
|
3791
|
+
case 5:
|
|
3792
|
+
case "end":
|
|
3793
|
+
return _context35.stop();
|
|
3794
|
+
}
|
|
3795
|
+
}, _callee35);
|
|
3796
|
+
}));
|
|
3797
|
+
function prepareDetail(_x22, _x23) {
|
|
3798
|
+
return _prepareDetail.apply(this, arguments);
|
|
3799
|
+
}
|
|
3800
|
+
return prepareDetail;
|
|
3801
|
+
}(),
|
|
3802
|
+
quote: function () {
|
|
3803
|
+
var _quote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(pool, query) {
|
|
3804
|
+
var _product$product_id3;
|
|
3805
|
+
var product, productId, booking, datetime, raw, result;
|
|
3806
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3807
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3808
|
+
case 0:
|
|
3809
|
+
product = query.product;
|
|
3810
|
+
productId = Number((_product$product_id3 = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id3 !== void 0 ? _product$product_id3 : product === null || product === void 0 ? void 0 : product.id);
|
|
3811
|
+
booking = query.booking;
|
|
3812
|
+
datetime = booking !== null && booking !== void 0 && booking.start_date ? "".concat(booking.start_date, " ").concat(booking.start_time || '00:00:00') : query.datetime || now();
|
|
3813
|
+
if (snapshot(pool, {
|
|
3814
|
+
product_ids: [productId],
|
|
3815
|
+
schedule_datetime: datetime,
|
|
3816
|
+
customer_id: query.customer_id == null ? undefined : Number(query.customer_id)
|
|
3817
|
+
}).length) {
|
|
3818
|
+
_context36.next = 6;
|
|
3819
|
+
break;
|
|
3820
|
+
}
|
|
3821
|
+
throw venueCatalogError('VENUE_PRODUCT_UNAVAILABLE', 'This product is unavailable in the selected menu at this time.');
|
|
3822
|
+
case 6:
|
|
3823
|
+
raw = pool.products.find(function (row) {
|
|
3824
|
+
return Number(row.id) === productId;
|
|
3825
|
+
});
|
|
3826
|
+
if (raw) {
|
|
3827
|
+
_context36.next = 9;
|
|
3828
|
+
break;
|
|
3829
|
+
}
|
|
3830
|
+
throw venueCatalogError('VENUE_PRODUCT_UNAVAILABLE', 'This product is not in the venue catalog.');
|
|
3831
|
+
case 9:
|
|
3832
|
+
_context36.next = 11;
|
|
3833
|
+
return _this14.calculateVenueCatalogProductBookingPrice(_objectSpread(_objectSpread({}, query), {}, {
|
|
3834
|
+
datetime: datetime
|
|
3835
|
+
}), {
|
|
3836
|
+
product: _this14.getVenueCatalogHydratedProduct(raw),
|
|
3837
|
+
menuList: pool.pricingMenus
|
|
3838
|
+
});
|
|
3839
|
+
case 11:
|
|
3840
|
+
result = _context36.sent;
|
|
3841
|
+
assertCurrent();
|
|
3842
|
+
return _context36.abrupt("return", result);
|
|
3843
|
+
case 14:
|
|
3844
|
+
case "end":
|
|
3845
|
+
return _context36.stop();
|
|
3846
|
+
}
|
|
3847
|
+
}, _callee36);
|
|
3848
|
+
}));
|
|
3849
|
+
function quote(_x24, _x25) {
|
|
3850
|
+
return _quote.apply(this, arguments);
|
|
3851
|
+
}
|
|
3852
|
+
return quote;
|
|
3853
|
+
}(),
|
|
3854
|
+
onRetry: function onRetry() {
|
|
3855
|
+
var _iterator2 = _createForOfIteratorHelper(_this14.venueVariantDetails),
|
|
3856
|
+
_step2;
|
|
3857
|
+
try {
|
|
3858
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
3859
|
+
var _step2$value = _slicedToArray(_step2.value, 2),
|
|
3860
|
+
id = _step2$value[0],
|
|
3861
|
+
detail = _step2$value[1];
|
|
3862
|
+
if (detail.failed) _this14.venueVariantDetails.delete(id);
|
|
3863
|
+
}
|
|
3864
|
+
} catch (err) {
|
|
3865
|
+
_iterator2.e(err);
|
|
3866
|
+
} finally {
|
|
3867
|
+
_iterator2.f();
|
|
3868
|
+
}
|
|
3869
|
+
},
|
|
3870
|
+
onDispose: function onDispose() {
|
|
3871
|
+
_this14.venueCatalogSessions.delete(entry);
|
|
3872
|
+
if (!_this14.venueCatalogSessions.size) {
|
|
3873
|
+
_this14.venueCatalogSessionKey = undefined;
|
|
3874
|
+
_this14.venueCatalogMenus = undefined;
|
|
3875
|
+
_this14.venueVariantDetails.clear();
|
|
3876
|
+
_this14.availabilitySessionResourceCache.clear();
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
});
|
|
3880
|
+
}
|
|
3881
|
+
|
|
3263
3882
|
/**
|
|
3264
3883
|
* Opt-in calendar/card preview batching. Results expire after sixty seconds or a
|
|
3265
3884
|
* runtime change; the next read starts a fresh clock/cache. Selection and submit
|
|
3266
3885
|
* must keep using the ordinary fresh query methods. Call dispose on owner cleanup.
|
|
3267
3886
|
*/
|
|
3268
|
-
)
|
|
3269
3887
|
}, {
|
|
3270
3888
|
key: "createCatalogQueryBatch",
|
|
3271
3889
|
value: function createCatalogQueryBatch() {
|
|
3272
|
-
var
|
|
3890
|
+
var _this15 = this;
|
|
3273
3891
|
return createCatalogQueryBatchAdapter({
|
|
3274
3892
|
runtime: function runtime() {
|
|
3275
|
-
var
|
|
3276
|
-
if (
|
|
3277
|
-
var user = (
|
|
3278
|
-
var productParams = ((
|
|
3893
|
+
var _this15$core$getPlugi, _this15$core, _this15$store$product, _this15$core$getModul, _this15$core2, _this15$core$getModul2, _this15$core3, _this15$core$context, _this15$core$getPlugi2, _this15$core4, _this15$core$getPlugi3, _this15$core5, _user$get2, _getScheduleList, _ref46, _this15$core$context2, _this15$core$context3, _evaluator$getStrateg;
|
|
3894
|
+
if (_this15.runtimeOpenDataDestroyed) throw new Error('The booking service is closed.');
|
|
3895
|
+
var user = (_this15$core$getPlugi = (_this15$core = _this15.core).getPlugin) === null || _this15$core$getPlugi === void 0 ? void 0 : _this15$core$getPlugi.call(_this15$core, 'user');
|
|
3896
|
+
var productParams = ((_this15$store$product = _this15.store.products) === null || _this15$store$product === void 0 ? void 0 : _this15$store$product.otherParams) || _this15.otherParams || {};
|
|
3279
3897
|
var fatherModule = String(productParams.fatherModule || '').trim();
|
|
3280
|
-
var schedule = (fatherModule ? (
|
|
3281
|
-
var evaluator = (
|
|
3898
|
+
var schedule = (fatherModule ? (_this15$core$getModul = (_this15$core2 = _this15.core).getModule) === null || _this15$core$getModul === void 0 ? void 0 : _this15$core$getModul.call(_this15$core2, "".concat(fatherModule, "_schedule")) : null) || ((_this15$core$getModul2 = (_this15$core3 = _this15.core).getModule) === null || _this15$core$getModul2 === void 0 ? void 0 : _this15$core$getModul2.call(_this15$core3, 'schedule'));
|
|
3899
|
+
var evaluator = (_this15$core$context = _this15.core.context) === null || _this15$core$context === void 0 ? void 0 : _this15$core$context.dataVariantEvaluator;
|
|
3282
3900
|
// OpenData hydration is not a catalog input. Its temporary null/reload cycle
|
|
3283
3901
|
// must not expire a batch while a parallel preview reads sales settings.
|
|
3284
|
-
var
|
|
3285
|
-
_openData =
|
|
3286
|
-
otherParams = _objectWithoutProperties(
|
|
3902
|
+
var _ref45 = _this15.otherParams || {},
|
|
3903
|
+
_openData = _ref45.openData,
|
|
3904
|
+
otherParams = _objectWithoutProperties(_ref45, _excluded2);
|
|
3287
3905
|
var _productOpenData = productParams.openData,
|
|
3288
3906
|
productOtherParams = _objectWithoutProperties(productParams, _excluded3);
|
|
3289
3907
|
return {
|
|
3290
|
-
references: [
|
|
3908
|
+
references: [_this15.core, _this15.request, _this15.store.products, _this15.core.server, user, _this15.appPlugin, (_this15$core$getPlugi2 = (_this15$core4 = _this15.core).getPlugin) === null || _this15$core$getPlugi2 === void 0 ? void 0 : _this15$core$getPlugi2.call(_this15$core4, 'request'), (_this15$core$getPlugi3 = (_this15$core5 = _this15.core).getPlugin) === null || _this15$core$getPlugi3 === void 0 ? void 0 : _this15$core$getPlugi3.call(_this15$core5, 'app'), schedule, evaluator],
|
|
3291
3909
|
values: {
|
|
3292
|
-
initialization:
|
|
3293
|
-
scope:
|
|
3294
|
-
requestBaseUrl:
|
|
3295
|
-
customerId: user === null || user === void 0 || (_user$
|
|
3910
|
+
initialization: _this15.runtimeInitializationGeneration,
|
|
3911
|
+
scope: _this15.getRuntimeOpenDataScope(),
|
|
3912
|
+
requestBaseUrl: _this15.request.baseUrl,
|
|
3913
|
+
customerId: 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,
|
|
3296
3914
|
otherParams: otherParams,
|
|
3297
3915
|
productOtherParams: productOtherParams
|
|
3298
3916
|
},
|
|
3299
3917
|
refreshValues: {
|
|
3300
|
-
scheduleList: schedule === null || schedule === void 0 || (_getScheduleList = (
|
|
3301
|
-
contextScheduleList: (
|
|
3302
|
-
contextMenuList: (
|
|
3918
|
+
scheduleList: schedule === null || schedule === void 0 || (_getScheduleList = (_ref46 = schedule).getScheduleList) === null || _getScheduleList === void 0 ? void 0 : _getScheduleList.call(_ref46),
|
|
3919
|
+
contextScheduleList: (_this15$core$context2 = _this15.core.context) === null || _this15$core$context2 === void 0 ? void 0 : _this15$core$context2.scheduleList,
|
|
3920
|
+
contextMenuList: (_this15$core$context3 = _this15.core.context) === null || _this15$core$context3 === void 0 ? void 0 : _this15$core$context3.menuList,
|
|
3303
3921
|
strategyConfigs: evaluator === null || evaluator === void 0 || (_evaluator$getStrateg = evaluator.getStrategyConfigs) === null || _evaluator$getStrateg === void 0 ? void 0 : _evaluator$getStrateg.call(evaluator)
|
|
3304
3922
|
}
|
|
3305
3923
|
};
|
|
3306
3924
|
},
|
|
3307
3925
|
normalize: function normalize(params, now) {
|
|
3308
|
-
var
|
|
3926
|
+
var _this15$core$getPlugi4, _this15$core6, _user$get3, _this15$store$product2, _productParams$busine, _params$with_count, _params$with_schedule, _params$status;
|
|
3309
3927
|
var date = params.schedule_date || dayjs(now).format('YYYY-MM-DD');
|
|
3310
|
-
var user = (
|
|
3928
|
+
var user = (_this15$core$getPlugi4 = (_this15$core6 = _this15.core).getPlugin) === null || _this15$core$getPlugi4 === void 0 ? void 0 : _this15$core$getPlugi4.call(_this15$core6, 'user');
|
|
3311
3929
|
var explicitCustomer = params.customer_id;
|
|
3312
3930
|
if (explicitCustomer != null && (!Number.isSafeInteger(Number(explicitCustomer)) || Number(explicitCustomer) <= 0)) {
|
|
3313
3931
|
throw new Error('Catalog query customer_id must be a positive integer.');
|
|
3314
3932
|
}
|
|
3315
|
-
var fallbackCustomer = user === null || user === void 0 || (_user$
|
|
3933
|
+
var fallbackCustomer = user === null || user === void 0 || (_user$get3 = user.get) === null || _user$get3 === void 0 || (_user$get3 = _user$get3.call(user)) === null || _user$get3 === void 0 ? void 0 : _user$get3.id;
|
|
3316
3934
|
var customer = explicitCustomer !== null && explicitCustomer !== void 0 ? explicitCustomer : Number.isSafeInteger(Number(fallbackCustomer)) && Number(fallbackCustomer) > 0 ? Number(fallbackCustomer) : undefined;
|
|
3317
|
-
var productParams = ((
|
|
3935
|
+
var productParams = ((_this15$store$product2 = _this15.store.products) === null || _this15$store$product2 === void 0 ? void 0 : _this15$store$product2.otherParams) || _this15.otherParams || {};
|
|
3318
3936
|
var channelMap = {
|
|
3319
3937
|
online_store: 'online-store',
|
|
3320
3938
|
scan_to_order: 'online-store',
|
|
@@ -3351,28 +3969,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3351
3969
|
return JSON.stringify(stableValue(params));
|
|
3352
3970
|
},
|
|
3353
3971
|
snapshot: function snapshot(params) {
|
|
3354
|
-
return
|
|
3972
|
+
return _this15.queryCatalogSnapshot(params);
|
|
3355
3973
|
},
|
|
3356
3974
|
detail: function detail(params, snapshot) {
|
|
3357
|
-
return
|
|
3975
|
+
return _this15.loadCatalogProductDetail(params, snapshot);
|
|
3358
3976
|
}
|
|
3359
3977
|
});
|
|
3360
3978
|
}
|
|
3361
3979
|
}, {
|
|
3362
3980
|
key: "loadCatalogProductDetail",
|
|
3363
3981
|
value: function () {
|
|
3364
|
-
var _loadCatalogProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3365
|
-
var _this$
|
|
3982
|
+
var _loadCatalogProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params, loadSnapshot) {
|
|
3983
|
+
var _this$otherParams31, _this$core$server, _this$core$server$has, _this$otherParams32, _this$otherParams33, _this$otherParams$bus3, _this$otherParams34, _this$otherParams35, _this$core$getPlugin, _this$core3, _this$core$getPlugin$, _this$otherParams36, _response$data$item2, _response$data3, _raw$id3, _this$store$products, _this$store$products$;
|
|
3366
3984
|
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;
|
|
3367
|
-
return _regeneratorRuntime().wrap(function
|
|
3368
|
-
while (1) switch (
|
|
3985
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3986
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3369
3987
|
case 0:
|
|
3370
3988
|
_cloneDeep2 = cloneDeep(params), product_id = _cloneDeep2.product_id, _ignoredIds = _cloneDeep2.product_ids, catalogParams = _objectWithoutProperties(_cloneDeep2, _excluded4);
|
|
3371
3989
|
if (!(!Number.isInteger(product_id) || product_id <= 0)) {
|
|
3372
|
-
|
|
3990
|
+
_context37.next = 3;
|
|
3373
3991
|
break;
|
|
3374
3992
|
}
|
|
3375
|
-
return
|
|
3993
|
+
return _context37.abrupt("return", undefined);
|
|
3376
3994
|
case 3:
|
|
3377
3995
|
schedule_date = catalogParams.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
3378
3996
|
schedule_datetime = catalogParams.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
@@ -3380,19 +3998,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3380
3998
|
schedule_date: schedule_date,
|
|
3381
3999
|
schedule_datetime: schedule_datetime
|
|
3382
4000
|
});
|
|
3383
|
-
|
|
4001
|
+
_context37.next = 8;
|
|
3384
4002
|
return loadSnapshot(scopedParams);
|
|
3385
4003
|
case 8:
|
|
3386
|
-
member =
|
|
4004
|
+
member = _context37.sent.find(function (item) {
|
|
3387
4005
|
return Number(item.id) === product_id;
|
|
3388
4006
|
});
|
|
3389
4007
|
if (member) {
|
|
3390
|
-
|
|
4008
|
+
_context37.next = 11;
|
|
3391
4009
|
break;
|
|
3392
4010
|
}
|
|
3393
|
-
return
|
|
4011
|
+
return _context37.abrupt("return", undefined);
|
|
3394
4012
|
case 11:
|
|
3395
|
-
baseUrl = String(this.request.baseUrl || (isCustomerUserPlatform((_this$
|
|
4013
|
+
baseUrl = String(this.request.baseUrl || (isCustomerUserPlatform((_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.platform) ? '/h5' : '/shop')).replace(/\/+$/, '');
|
|
3396
4014
|
localPath = "/product/query/".concat(product_id);
|
|
3397
4015
|
handledByOsServer = ((_this$core$server = this.core.server) === null || _this$core$server === void 0 || (_this$core$server$has = _this$core$server.hasRoute) === null || _this$core$server$has === void 0 ? void 0 : _this$core$server$has.call(_this$core$server, 'get', "".concat(baseUrl).concat(localPath))) === true;
|
|
3398
4016
|
channelMap = {
|
|
@@ -3402,8 +4020,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3402
4020
|
scan_to_order_2: 'online-store',
|
|
3403
4021
|
scan_to_order_3: 'scantoorder3'
|
|
3404
4022
|
};
|
|
3405
|
-
channel = channelMap[(_this$
|
|
3406
|
-
businessCode = (_this$otherParams$bus3 = (_this$
|
|
4023
|
+
channel = channelMap[(_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.channel] || ((_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.channel);
|
|
4024
|
+
businessCode = (_this$otherParams$bus3 = (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.businessCode) !== null && _this$otherParams$bus3 !== void 0 ? _this$otherParams$bus3 : (_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.business_code;
|
|
3407
4025
|
strategy_context = _objectSpread(_objectSpread(_objectSpread({}, channel ? {
|
|
3408
4026
|
channel: channel
|
|
3409
4027
|
} : {}), businessCode ? {
|
|
@@ -3419,35 +4037,35 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3419
4037
|
open_bundle: 1,
|
|
3420
4038
|
with_schedule: 1,
|
|
3421
4039
|
with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS)
|
|
3422
|
-
}, isCustomerUserPlatform((_this$
|
|
4040
|
+
}, isCustomerUserPlatform((_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.platform) ? {} : {
|
|
3423
4041
|
open_quotation: 1
|
|
3424
4042
|
});
|
|
3425
|
-
|
|
4043
|
+
_context37.next = 23;
|
|
3426
4044
|
return this.request.get(baseUrl === '/shop' ? localPath : "/product/show/".concat(product_id), queryPayload, {
|
|
3427
4045
|
osServer: true,
|
|
3428
4046
|
useCache: false,
|
|
3429
4047
|
customToast: function customToast() {}
|
|
3430
4048
|
});
|
|
3431
4049
|
case 23:
|
|
3432
|
-
response =
|
|
4050
|
+
response = _context37.sent;
|
|
3433
4051
|
if (!((response === null || response === void 0 ? void 0 : response.status) === false || Number(response === null || response === void 0 ? void 0 : response.code) >= 400)) {
|
|
3434
|
-
|
|
4052
|
+
_context37.next = 26;
|
|
3435
4053
|
break;
|
|
3436
4054
|
}
|
|
3437
4055
|
throw new Error('[UnifiedBookingSales] Product detail query failed');
|
|
3438
4056
|
case 26:
|
|
3439
|
-
raw = (_response$data$
|
|
3440
|
-
if (!(!raw || Number((_raw$
|
|
3441
|
-
|
|
4057
|
+
raw = (_response$data$item2 = response === null || response === void 0 || (_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : _response$data3.item) !== null && _response$data$item2 !== void 0 ? _response$data$item2 : response === null || response === void 0 ? void 0 : response.data;
|
|
4058
|
+
if (!(!raw || Number((_raw$id3 = raw.id) !== null && _raw$id3 !== void 0 ? _raw$id3 : raw.product_id) !== product_id)) {
|
|
4059
|
+
_context37.next = 29;
|
|
3442
4060
|
break;
|
|
3443
4061
|
}
|
|
3444
|
-
return
|
|
4062
|
+
return _context37.abrupt("return", undefined);
|
|
3445
4063
|
case 29:
|
|
3446
4064
|
if (!(raw.status && raw.status !== 'published')) {
|
|
3447
|
-
|
|
4065
|
+
_context37.next = 31;
|
|
3448
4066
|
break;
|
|
3449
4067
|
}
|
|
3450
|
-
return
|
|
4068
|
+
return _context37.abrupt("return", undefined);
|
|
3451
4069
|
case 31:
|
|
3452
4070
|
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)]);
|
|
3453
4071
|
resolved = resolveClientDataVariants({
|
|
@@ -3458,10 +4076,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3458
4076
|
handledByOsServer: handledByOsServer
|
|
3459
4077
|
})[0]; // Detail owns relation arrays. Never synthesize empty groups from list counts.
|
|
3460
4078
|
if (resolved) {
|
|
3461
|
-
|
|
4079
|
+
_context37.next = 35;
|
|
3462
4080
|
break;
|
|
3463
4081
|
}
|
|
3464
|
-
return
|
|
4082
|
+
return _context37.abrupt("return", undefined);
|
|
3465
4083
|
case 35:
|
|
3466
4084
|
detail = _objectSpread(_objectSpread(_objectSpread({}, member), resolved), {}, {
|
|
3467
4085
|
metadata: _objectSpread(_objectSpread({}, member.metadata || {}), resolved.metadata || {})
|
|
@@ -3470,14 +4088,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3470
4088
|
key = _arr2[_i2];
|
|
3471
4089
|
if (!Object.prototype.hasOwnProperty.call(resolved, key)) delete detail[key];
|
|
3472
4090
|
}
|
|
3473
|
-
return
|
|
4091
|
+
return _context37.abrupt("return", cloneDeep(detail));
|
|
3474
4092
|
case 38:
|
|
3475
4093
|
case "end":
|
|
3476
|
-
return
|
|
4094
|
+
return _context37.stop();
|
|
3477
4095
|
}
|
|
3478
|
-
},
|
|
4096
|
+
}, _callee37, this);
|
|
3479
4097
|
}));
|
|
3480
|
-
function loadCatalogProductDetail(
|
|
4098
|
+
function loadCatalogProductDetail(_x26, _x27) {
|
|
3481
4099
|
return _loadCatalogProductDetail.apply(this, arguments);
|
|
3482
4100
|
}
|
|
3483
4101
|
return loadCatalogProductDetail;
|
|
@@ -3485,21 +4103,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3485
4103
|
}, {
|
|
3486
4104
|
key: "loadCatalogProducts",
|
|
3487
4105
|
value: function () {
|
|
3488
|
-
var _loadCatalogProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4106
|
+
var _loadCatalogProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3489
4107
|
var params,
|
|
3490
4108
|
options,
|
|
3491
4109
|
catalogScope,
|
|
3492
4110
|
schedule_date,
|
|
3493
4111
|
schedule_datetime,
|
|
3494
4112
|
result,
|
|
3495
|
-
|
|
3496
|
-
return _regeneratorRuntime().wrap(function
|
|
3497
|
-
while (1) switch (
|
|
4113
|
+
_args38 = arguments;
|
|
4114
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
4115
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3498
4116
|
case 0:
|
|
3499
|
-
params =
|
|
3500
|
-
options =
|
|
4117
|
+
params = _args38.length > 0 && _args38[0] !== undefined ? _args38[0] : {};
|
|
4118
|
+
options = _args38.length > 1 ? _args38[1] : undefined;
|
|
3501
4119
|
if (this.store.products) {
|
|
3502
|
-
|
|
4120
|
+
_context38.next = 4;
|
|
3503
4121
|
break;
|
|
3504
4122
|
}
|
|
3505
4123
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
@@ -3507,7 +4125,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3507
4125
|
catalogScope = this.otherParams.catalogScopeKey;
|
|
3508
4126
|
schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
3509
4127
|
schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
3510
|
-
|
|
4128
|
+
_context38.next = 9;
|
|
3511
4129
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
3512
4130
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
3513
4131
|
with_schedule: 1
|
|
@@ -3517,21 +4135,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3517
4135
|
cacheId: this.cacheId
|
|
3518
4136
|
}), options);
|
|
3519
4137
|
case 9:
|
|
3520
|
-
result =
|
|
4138
|
+
result = _context38.sent;
|
|
3521
4139
|
if (!(catalogScope !== this.otherParams.catalogScopeKey)) {
|
|
3522
|
-
|
|
4140
|
+
_context38.next = 12;
|
|
3523
4141
|
break;
|
|
3524
4142
|
}
|
|
3525
4143
|
throw Object.assign(new Error('Product scope changed'), {
|
|
3526
4144
|
name: 'AbortError'
|
|
3527
4145
|
});
|
|
3528
4146
|
case 12:
|
|
3529
|
-
return
|
|
4147
|
+
return _context38.abrupt("return", result);
|
|
3530
4148
|
case 13:
|
|
3531
4149
|
case "end":
|
|
3532
|
-
return
|
|
4150
|
+
return _context38.stop();
|
|
3533
4151
|
}
|
|
3534
|
-
},
|
|
4152
|
+
}, _callee38, this);
|
|
3535
4153
|
}));
|
|
3536
4154
|
function loadCatalogProducts() {
|
|
3537
4155
|
return _loadCatalogProducts.apply(this, arguments);
|
|
@@ -3541,25 +4159,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3541
4159
|
}, {
|
|
3542
4160
|
key: "queryProducts",
|
|
3543
4161
|
value: function () {
|
|
3544
|
-
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4162
|
+
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3545
4163
|
var params,
|
|
3546
|
-
|
|
3547
|
-
return _regeneratorRuntime().wrap(function
|
|
3548
|
-
while (1) switch (
|
|
4164
|
+
_args39 = arguments;
|
|
4165
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4166
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3549
4167
|
case 0:
|
|
3550
|
-
params =
|
|
4168
|
+
params = _args39.length > 0 && _args39[0] !== undefined ? _args39[0] : {};
|
|
3551
4169
|
if (this.store.products) {
|
|
3552
|
-
|
|
4170
|
+
_context39.next = 3;
|
|
3553
4171
|
break;
|
|
3554
4172
|
}
|
|
3555
4173
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
3556
4174
|
case 3:
|
|
3557
|
-
return
|
|
4175
|
+
return _context39.abrupt("return", this.store.products.queryProducts(params));
|
|
3558
4176
|
case 4:
|
|
3559
4177
|
case "end":
|
|
3560
|
-
return
|
|
4178
|
+
return _context39.stop();
|
|
3561
4179
|
}
|
|
3562
|
-
},
|
|
4180
|
+
}, _callee39, this);
|
|
3563
4181
|
}));
|
|
3564
4182
|
function queryProducts() {
|
|
3565
4183
|
return _queryProducts.apply(this, arguments);
|
|
@@ -3569,24 +4187,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3569
4187
|
}, {
|
|
3570
4188
|
key: "loadScheduleAvailableDate",
|
|
3571
4189
|
value: (function () {
|
|
3572
|
-
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3573
|
-
return _regeneratorRuntime().wrap(function
|
|
3574
|
-
while (1) switch (
|
|
4190
|
+
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
4191
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4192
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3575
4193
|
case 0:
|
|
3576
4194
|
if (this.store.schedule) {
|
|
3577
|
-
|
|
4195
|
+
_context40.next = 2;
|
|
3578
4196
|
break;
|
|
3579
4197
|
}
|
|
3580
4198
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
3581
4199
|
case 2:
|
|
3582
|
-
return
|
|
4200
|
+
return _context40.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
|
|
3583
4201
|
case 3:
|
|
3584
4202
|
case "end":
|
|
3585
|
-
return
|
|
4203
|
+
return _context40.stop();
|
|
3586
4204
|
}
|
|
3587
|
-
},
|
|
4205
|
+
}, _callee40, this);
|
|
3588
4206
|
}));
|
|
3589
|
-
function loadScheduleAvailableDate(
|
|
4207
|
+
function loadScheduleAvailableDate(_x28) {
|
|
3590
4208
|
return _loadScheduleAvailableDate.apply(this, arguments);
|
|
3591
4209
|
}
|
|
3592
4210
|
return loadScheduleAvailableDate;
|
|
@@ -3600,15 +4218,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3600
4218
|
}, {
|
|
3601
4219
|
key: "loadProductsByScheduleDate",
|
|
3602
4220
|
value: (function () {
|
|
3603
|
-
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4221
|
+
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
3604
4222
|
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;
|
|
3605
|
-
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts,
|
|
3606
|
-
return _regeneratorRuntime().wrap(function
|
|
3607
|
-
while (1) switch (
|
|
4223
|
+
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator3, _step3, _productId, result;
|
|
4224
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4225
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3608
4226
|
case 0:
|
|
3609
4227
|
date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded5);
|
|
3610
4228
|
if (this.store.schedule) {
|
|
3611
|
-
|
|
4229
|
+
_context41.next = 3;
|
|
3612
4230
|
break;
|
|
3613
4231
|
}
|
|
3614
4232
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
@@ -3619,10 +4237,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3619
4237
|
});
|
|
3620
4238
|
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;
|
|
3621
4239
|
if (!(!hasCachedDate && !hasOtherProducts)) {
|
|
3622
|
-
|
|
4240
|
+
_context41.next = 9;
|
|
3623
4241
|
break;
|
|
3624
4242
|
}
|
|
3625
|
-
|
|
4243
|
+
_context41.next = 9;
|
|
3626
4244
|
return this.loadScheduleAvailableDate({
|
|
3627
4245
|
startDate: date,
|
|
3628
4246
|
endDate: date,
|
|
@@ -3642,45 +4260,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3642
4260
|
return !productIdFilter || productIdFilter.has(String(id));
|
|
3643
4261
|
});
|
|
3644
4262
|
if (availableProductIds.length) {
|
|
3645
|
-
|
|
4263
|
+
_context41.next = 17;
|
|
3646
4264
|
break;
|
|
3647
4265
|
}
|
|
3648
4266
|
this.unifiedProductCatalog = [];
|
|
3649
|
-
|
|
4267
|
+
_context41.next = 16;
|
|
3650
4268
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
|
|
3651
4269
|
case 16:
|
|
3652
|
-
return
|
|
4270
|
+
return _context41.abrupt("return", []);
|
|
3653
4271
|
case 17:
|
|
3654
|
-
|
|
4272
|
+
_context41.next = 19;
|
|
3655
4273
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
3656
4274
|
product_ids: availableProductIds,
|
|
3657
4275
|
schedule_date: date
|
|
3658
4276
|
}));
|
|
3659
4277
|
case 19:
|
|
3660
|
-
products =
|
|
4278
|
+
products = _context41.sent;
|
|
3661
4279
|
if (!(products.length || availableProductIds.length <= 1)) {
|
|
3662
|
-
|
|
4280
|
+
_context41.next = 22;
|
|
3663
4281
|
break;
|
|
3664
4282
|
}
|
|
3665
|
-
return
|
|
4283
|
+
return _context41.abrupt("return", products);
|
|
3666
4284
|
case 22:
|
|
3667
4285
|
fallbackProducts = [];
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
4286
|
+
_iterator3 = _createForOfIteratorHelper(availableProductIds);
|
|
4287
|
+
_context41.prev = 24;
|
|
4288
|
+
_iterator3.s();
|
|
3671
4289
|
case 26:
|
|
3672
|
-
if ((
|
|
3673
|
-
|
|
4290
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
4291
|
+
_context41.next = 34;
|
|
3674
4292
|
break;
|
|
3675
4293
|
}
|
|
3676
|
-
|
|
3677
|
-
|
|
4294
|
+
_productId = _step3.value;
|
|
4295
|
+
_context41.next = 30;
|
|
3678
4296
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
3679
|
-
product_ids: [
|
|
4297
|
+
product_ids: [_productId],
|
|
3680
4298
|
schedule_date: date
|
|
3681
4299
|
}));
|
|
3682
4300
|
case 30:
|
|
3683
|
-
result =
|
|
4301
|
+
result = _context41.sent;
|
|
3684
4302
|
result.forEach(function (product) {
|
|
3685
4303
|
var _id;
|
|
3686
4304
|
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;
|
|
@@ -3692,32 +4310,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3692
4310
|
}
|
|
3693
4311
|
});
|
|
3694
4312
|
case 32:
|
|
3695
|
-
|
|
4313
|
+
_context41.next = 26;
|
|
3696
4314
|
break;
|
|
3697
4315
|
case 34:
|
|
3698
|
-
|
|
4316
|
+
_context41.next = 39;
|
|
3699
4317
|
break;
|
|
3700
4318
|
case 36:
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
4319
|
+
_context41.prev = 36;
|
|
4320
|
+
_context41.t0 = _context41["catch"](24);
|
|
4321
|
+
_iterator3.e(_context41.t0);
|
|
3704
4322
|
case 39:
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
return
|
|
4323
|
+
_context41.prev = 39;
|
|
4324
|
+
_iterator3.f();
|
|
4325
|
+
return _context41.finish(39);
|
|
3708
4326
|
case 42:
|
|
3709
4327
|
this.unifiedProductCatalog = [].concat(fallbackProducts);
|
|
3710
|
-
|
|
4328
|
+
_context41.next = 45;
|
|
3711
4329
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
|
|
3712
4330
|
case 45:
|
|
3713
|
-
return
|
|
4331
|
+
return _context41.abrupt("return", fallbackProducts);
|
|
3714
4332
|
case 46:
|
|
3715
4333
|
case "end":
|
|
3716
|
-
return
|
|
4334
|
+
return _context41.stop();
|
|
3717
4335
|
}
|
|
3718
|
-
},
|
|
4336
|
+
}, _callee41, this, [[24, 36, 39, 42]]);
|
|
3719
4337
|
}));
|
|
3720
|
-
function loadProductsByScheduleDate(
|
|
4338
|
+
function loadProductsByScheduleDate(_x29) {
|
|
3721
4339
|
return _loadProductsByScheduleDate.apply(this, arguments);
|
|
3722
4340
|
}
|
|
3723
4341
|
return loadProductsByScheduleDate;
|
|
@@ -3770,7 +4388,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3770
4388
|
}, {
|
|
3771
4389
|
key: "applyPlannerDiscounts",
|
|
3772
4390
|
value: (function () {
|
|
3773
|
-
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4391
|
+
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3774
4392
|
var _params$customerId;
|
|
3775
4393
|
var params,
|
|
3776
4394
|
tempOrder,
|
|
@@ -3782,29 +4400,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3782
4400
|
preferredDiscount,
|
|
3783
4401
|
preferredId,
|
|
3784
4402
|
selectedOtherDiscounts,
|
|
3785
|
-
|
|
3786
|
-
|
|
4403
|
+
_iterator4,
|
|
4404
|
+
_step4,
|
|
3787
4405
|
discount,
|
|
3788
4406
|
discountId,
|
|
3789
4407
|
nextTempOrder,
|
|
3790
|
-
|
|
3791
|
-
return _regeneratorRuntime().wrap(function
|
|
3792
|
-
while (1) switch (
|
|
4408
|
+
_args42 = arguments;
|
|
4409
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4410
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3793
4411
|
case 0:
|
|
3794
|
-
params =
|
|
4412
|
+
params = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
|
|
3795
4413
|
tempOrder = this.getTempOrder();
|
|
3796
4414
|
requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
3797
4415
|
parsedCustomerId = Number(requestedCustomerId);
|
|
3798
4416
|
customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
|
|
3799
|
-
|
|
4417
|
+
_context42.next = 7;
|
|
3800
4418
|
return this.getSummary();
|
|
3801
4419
|
case 7:
|
|
3802
|
-
summaryBefore =
|
|
4420
|
+
summaryBefore = _context42.sent;
|
|
3803
4421
|
if (customerId) {
|
|
3804
|
-
|
|
4422
|
+
_context42.next = 10;
|
|
3805
4423
|
break;
|
|
3806
4424
|
}
|
|
3807
|
-
return
|
|
4425
|
+
return _context42.abrupt("return", buildPlannerDiscountResult({
|
|
3808
4426
|
customerId: null,
|
|
3809
4427
|
discountList: this.getDiscountList(),
|
|
3810
4428
|
products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
|
|
@@ -3813,7 +4431,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3813
4431
|
status: 'no_customer'
|
|
3814
4432
|
}));
|
|
3815
4433
|
case 10:
|
|
3816
|
-
|
|
4434
|
+
_context42.next = 12;
|
|
3817
4435
|
return this.loadDiscountConfig({
|
|
3818
4436
|
customerId: customerId,
|
|
3819
4437
|
action: 'create'
|
|
@@ -3825,7 +4443,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3825
4443
|
return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
|
|
3826
4444
|
});
|
|
3827
4445
|
if (!preferredDiscount) {
|
|
3828
|
-
|
|
4446
|
+
_context42.next = 40;
|
|
3829
4447
|
break;
|
|
3830
4448
|
}
|
|
3831
4449
|
// A requested card is an explicit UI choice, not a best-effort preference. Clear prior
|
|
@@ -3836,99 +4454,99 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3836
4454
|
var _resolvePlannerDiscou2;
|
|
3837
4455
|
return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
|
|
3838
4456
|
});
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
4457
|
+
_iterator4 = _createForOfIteratorHelper(selectedOtherDiscounts);
|
|
4458
|
+
_context42.prev = 18;
|
|
4459
|
+
_iterator4.s();
|
|
3842
4460
|
case 20:
|
|
3843
|
-
if ((
|
|
3844
|
-
|
|
4461
|
+
if ((_step4 = _iterator4.n()).done) {
|
|
4462
|
+
_context42.next = 28;
|
|
3845
4463
|
break;
|
|
3846
4464
|
}
|
|
3847
|
-
discount =
|
|
4465
|
+
discount = _step4.value;
|
|
3848
4466
|
discountId = Number(resolvePlannerDiscountId(discount));
|
|
3849
4467
|
if (!Number.isFinite(discountId)) {
|
|
3850
|
-
|
|
4468
|
+
_context42.next = 26;
|
|
3851
4469
|
break;
|
|
3852
4470
|
}
|
|
3853
|
-
|
|
4471
|
+
_context42.next = 26;
|
|
3854
4472
|
return this.setDiscountSelected({
|
|
3855
4473
|
discountId: discountId,
|
|
3856
4474
|
isSelected: false
|
|
3857
4475
|
});
|
|
3858
4476
|
case 26:
|
|
3859
|
-
|
|
4477
|
+
_context42.next = 20;
|
|
3860
4478
|
break;
|
|
3861
4479
|
case 28:
|
|
3862
|
-
|
|
4480
|
+
_context42.next = 33;
|
|
3863
4481
|
break;
|
|
3864
4482
|
case 30:
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
4483
|
+
_context42.prev = 30;
|
|
4484
|
+
_context42.t0 = _context42["catch"](18);
|
|
4485
|
+
_iterator4.e(_context42.t0);
|
|
3868
4486
|
case 33:
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
return
|
|
4487
|
+
_context42.prev = 33;
|
|
4488
|
+
_iterator4.f();
|
|
4489
|
+
return _context42.finish(33);
|
|
3872
4490
|
case 36:
|
|
3873
|
-
|
|
4491
|
+
_context42.next = 38;
|
|
3874
4492
|
return this.setDiscountSelected({
|
|
3875
4493
|
discountId: Number(preferredId),
|
|
3876
4494
|
isSelected: true
|
|
3877
4495
|
});
|
|
3878
4496
|
case 38:
|
|
3879
|
-
|
|
4497
|
+
_context42.next = 49;
|
|
3880
4498
|
break;
|
|
3881
4499
|
case 40:
|
|
3882
4500
|
if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
|
|
3883
|
-
|
|
4501
|
+
_context42.next = 46;
|
|
3884
4502
|
break;
|
|
3885
4503
|
}
|
|
3886
4504
|
if (!(params.applyBestDiscount !== false)) {
|
|
3887
|
-
|
|
4505
|
+
_context42.next = 44;
|
|
3888
4506
|
break;
|
|
3889
4507
|
}
|
|
3890
|
-
|
|
4508
|
+
_context42.next = 44;
|
|
3891
4509
|
return this.bestDiscount();
|
|
3892
4510
|
case 44:
|
|
3893
|
-
|
|
4511
|
+
_context42.next = 49;
|
|
3894
4512
|
break;
|
|
3895
4513
|
case 46:
|
|
3896
4514
|
if (!(params.applyBestDiscount !== false)) {
|
|
3897
|
-
|
|
4515
|
+
_context42.next = 49;
|
|
3898
4516
|
break;
|
|
3899
4517
|
}
|
|
3900
|
-
|
|
4518
|
+
_context42.next = 49;
|
|
3901
4519
|
return this.bestDiscount();
|
|
3902
4520
|
case 49:
|
|
3903
4521
|
nextTempOrder = this.getTempOrder();
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
4522
|
+
_context42.t1 = buildPlannerDiscountResult;
|
|
4523
|
+
_context42.t2 = customerId;
|
|
4524
|
+
_context42.t3 = this.getDiscountList();
|
|
4525
|
+
_context42.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
|
|
4526
|
+
_context42.t5 = summaryBefore;
|
|
4527
|
+
_context42.next = 57;
|
|
3910
4528
|
return this.getSummary();
|
|
3911
4529
|
case 57:
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
customerId:
|
|
3918
|
-
discountList:
|
|
3919
|
-
products:
|
|
3920
|
-
summaryBefore:
|
|
3921
|
-
summaryAfter:
|
|
3922
|
-
status:
|
|
3923
|
-
preferredDiscountId:
|
|
3924
|
-
preferredDiscountFound:
|
|
4530
|
+
_context42.t6 = _context42.sent;
|
|
4531
|
+
_context42.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
|
|
4532
|
+
_context42.t8 = preferredDiscountId;
|
|
4533
|
+
_context42.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
|
|
4534
|
+
_context42.t10 = {
|
|
4535
|
+
customerId: _context42.t2,
|
|
4536
|
+
discountList: _context42.t3,
|
|
4537
|
+
products: _context42.t4,
|
|
4538
|
+
summaryBefore: _context42.t5,
|
|
4539
|
+
summaryAfter: _context42.t6,
|
|
4540
|
+
status: _context42.t7,
|
|
4541
|
+
preferredDiscountId: _context42.t8,
|
|
4542
|
+
preferredDiscountFound: _context42.t9
|
|
3925
4543
|
};
|
|
3926
|
-
return
|
|
4544
|
+
return _context42.abrupt("return", (0, _context42.t1)(_context42.t10));
|
|
3927
4545
|
case 63:
|
|
3928
4546
|
case "end":
|
|
3929
|
-
return
|
|
4547
|
+
return _context42.stop();
|
|
3930
4548
|
}
|
|
3931
|
-
},
|
|
4549
|
+
}, _callee42, this, [[18, 30, 33, 36]]);
|
|
3932
4550
|
}));
|
|
3933
4551
|
function applyPlannerDiscounts() {
|
|
3934
4552
|
return _applyPlannerDiscounts.apply(this, arguments);
|
|
@@ -3938,16 +4556,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3938
4556
|
}, {
|
|
3939
4557
|
key: "buildUnifiedOrderProduct",
|
|
3940
4558
|
value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
|
|
3941
|
-
var
|
|
4559
|
+
var _ref47, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref48, _sourceProduct$produc, _ref49, _ref50, _sourceProduct$quanti, _sourceProduct$price, _ref51, _ref52, _sourceProduct$sellin;
|
|
3942
4560
|
var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
|
|
3943
|
-
var quotationShelfId = (
|
|
4561
|
+
var quotationShelfId = (_ref47 = (_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 && _ref47 !== void 0 ? _ref47 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
|
|
3944
4562
|
var orderProduct = this.transformBaseProductToOrderProduct({
|
|
3945
4563
|
payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
|
|
3946
4564
|
id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
|
|
3947
|
-
product_id: (
|
|
3948
|
-
quantity: (
|
|
4565
|
+
product_id: (_ref48 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref48 !== void 0 ? _ref48 : product === null || product === void 0 ? void 0 : product.id,
|
|
4566
|
+
quantity: (_ref49 = (_ref50 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref50 !== void 0 ? _ref50 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref49 !== void 0 ? _ref49 : 1,
|
|
3949
4567
|
price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
|
|
3950
|
-
selling_price: (
|
|
4568
|
+
selling_price: (_ref51 = (_ref52 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref52 !== void 0 ? _ref52 : normalizedProductRaw.selling_price) !== null && _ref51 !== void 0 ? _ref51 : normalizedProductRaw.price,
|
|
3951
4569
|
metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
|
|
3952
4570
|
}),
|
|
3953
4571
|
sourceProduct: sourceProduct
|
|
@@ -3972,29 +4590,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3972
4590
|
}, {
|
|
3973
4591
|
key: "removeExistingStagedLines",
|
|
3974
4592
|
value: (function () {
|
|
3975
|
-
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4593
|
+
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(ownershipKey) {
|
|
3976
4594
|
var _this$getTempOrder2;
|
|
3977
4595
|
var existingLines;
|
|
3978
|
-
return _regeneratorRuntime().wrap(function
|
|
3979
|
-
while (1) switch (
|
|
4596
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4597
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3980
4598
|
case 0:
|
|
3981
4599
|
existingLines = (((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.products) || []).filter(function (product) {
|
|
3982
4600
|
var _product$metadata5;
|
|
3983
4601
|
return (product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5[ownershipKey]) === true;
|
|
3984
4602
|
});
|
|
3985
4603
|
if (!(existingLines.length > 0)) {
|
|
3986
|
-
|
|
4604
|
+
_context43.next = 4;
|
|
3987
4605
|
break;
|
|
3988
4606
|
}
|
|
3989
|
-
|
|
4607
|
+
_context43.next = 4;
|
|
3990
4608
|
return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
|
|
3991
4609
|
case 4:
|
|
3992
4610
|
case "end":
|
|
3993
|
-
return
|
|
4611
|
+
return _context43.stop();
|
|
3994
4612
|
}
|
|
3995
|
-
},
|
|
4613
|
+
}, _callee43, this);
|
|
3996
4614
|
}));
|
|
3997
|
-
function removeExistingStagedLines(
|
|
4615
|
+
function removeExistingStagedLines(_x30) {
|
|
3998
4616
|
return _removeExistingStagedLines.apply(this, arguments);
|
|
3999
4617
|
}
|
|
4000
4618
|
return removeExistingStagedLines;
|
|
@@ -4002,80 +4620,80 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4002
4620
|
}, {
|
|
4003
4621
|
key: "stageProducts",
|
|
4004
4622
|
value: function () {
|
|
4005
|
-
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4623
|
+
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params, ownershipKey) {
|
|
4006
4624
|
var _params$rawProducts;
|
|
4007
4625
|
var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i3, _arr3, sourceProduct, productInput;
|
|
4008
|
-
return _regeneratorRuntime().wrap(function
|
|
4009
|
-
while (1) switch (
|
|
4626
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4627
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4010
4628
|
case 0:
|
|
4011
4629
|
productIds = params.productIds || [];
|
|
4012
4630
|
if (productIds.length) {
|
|
4013
|
-
|
|
4631
|
+
_context44.next = 3;
|
|
4014
4632
|
break;
|
|
4015
4633
|
}
|
|
4016
|
-
return
|
|
4634
|
+
return _context44.abrupt("return", this.getTempOrder());
|
|
4017
4635
|
case 3:
|
|
4018
4636
|
if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
|
|
4019
|
-
|
|
4637
|
+
_context44.next = 7;
|
|
4020
4638
|
break;
|
|
4021
4639
|
}
|
|
4022
4640
|
this.unifiedProductCatalog = params.rawProducts;
|
|
4023
|
-
|
|
4641
|
+
_context44.next = 12;
|
|
4024
4642
|
break;
|
|
4025
4643
|
case 7:
|
|
4026
4644
|
existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
|
|
4027
|
-
var _product$
|
|
4028
|
-
return String((_product$
|
|
4645
|
+
var _product$id2;
|
|
4646
|
+
return String((_product$id2 = product.id) !== null && _product$id2 !== void 0 ? _product$id2 : product.product_id);
|
|
4029
4647
|
}));
|
|
4030
4648
|
missingIds = productIds.filter(function (id) {
|
|
4031
4649
|
return !existingIds.has(String(id));
|
|
4032
4650
|
});
|
|
4033
4651
|
if (!(missingIds.length || params.productLoadParams)) {
|
|
4034
|
-
|
|
4652
|
+
_context44.next = 12;
|
|
4035
4653
|
break;
|
|
4036
4654
|
}
|
|
4037
|
-
|
|
4655
|
+
_context44.next = 12;
|
|
4038
4656
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
4039
4657
|
product_ids: productIds.map(Number).filter(Number.isFinite)
|
|
4040
4658
|
}));
|
|
4041
4659
|
case 12:
|
|
4042
|
-
|
|
4660
|
+
_context44.next = 14;
|
|
4043
4661
|
return this.removeExistingStagedLines(ownershipKey);
|
|
4044
4662
|
case 14:
|
|
4045
4663
|
productIdSet = new Set(productIds.map(function (id) {
|
|
4046
4664
|
return String(id);
|
|
4047
4665
|
}));
|
|
4048
4666
|
selectedProducts = (this.unifiedProductCatalog || []).filter(function (product) {
|
|
4049
|
-
var _product$
|
|
4050
|
-
return productIdSet.has(String((_product$
|
|
4667
|
+
var _product$id3;
|
|
4668
|
+
return productIdSet.has(String((_product$id3 = product.id) !== null && _product$id3 !== void 0 ? _product$id3 : product.product_id));
|
|
4051
4669
|
});
|
|
4052
4670
|
_i3 = 0, _arr3 = selectedProducts;
|
|
4053
4671
|
case 17:
|
|
4054
4672
|
if (!(_i3 < _arr3.length)) {
|
|
4055
|
-
|
|
4673
|
+
_context44.next = 26;
|
|
4056
4674
|
break;
|
|
4057
4675
|
}
|
|
4058
4676
|
sourceProduct = _arr3[_i3];
|
|
4059
4677
|
productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
|
|
4060
4678
|
if (!productInput) {
|
|
4061
|
-
|
|
4679
|
+
_context44.next = 23;
|
|
4062
4680
|
break;
|
|
4063
4681
|
}
|
|
4064
|
-
|
|
4682
|
+
_context44.next = 23;
|
|
4065
4683
|
return this.addProductToOrder(productInput);
|
|
4066
4684
|
case 23:
|
|
4067
4685
|
_i3++;
|
|
4068
|
-
|
|
4686
|
+
_context44.next = 17;
|
|
4069
4687
|
break;
|
|
4070
4688
|
case 26:
|
|
4071
|
-
return
|
|
4689
|
+
return _context44.abrupt("return", this.getTempOrder());
|
|
4072
4690
|
case 27:
|
|
4073
4691
|
case "end":
|
|
4074
|
-
return
|
|
4692
|
+
return _context44.stop();
|
|
4075
4693
|
}
|
|
4076
|
-
},
|
|
4694
|
+
}, _callee44, this);
|
|
4077
4695
|
}));
|
|
4078
|
-
function stageProducts(
|
|
4696
|
+
function stageProducts(_x31, _x32) {
|
|
4079
4697
|
return _stageProducts.apply(this, arguments);
|
|
4080
4698
|
}
|
|
4081
4699
|
return stageProducts;
|
|
@@ -4087,18 +4705,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4087
4705
|
}, {
|
|
4088
4706
|
key: "stageRetailProducts",
|
|
4089
4707
|
value: (function () {
|
|
4090
|
-
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4091
|
-
return _regeneratorRuntime().wrap(function
|
|
4092
|
-
while (1) switch (
|
|
4708
|
+
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
4709
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4710
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4093
4711
|
case 0:
|
|
4094
|
-
return
|
|
4712
|
+
return _context45.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
|
|
4095
4713
|
case 1:
|
|
4096
4714
|
case "end":
|
|
4097
|
-
return
|
|
4715
|
+
return _context45.stop();
|
|
4098
4716
|
}
|
|
4099
|
-
},
|
|
4717
|
+
}, _callee45, this);
|
|
4100
4718
|
}));
|
|
4101
|
-
function stageRetailProducts(
|
|
4719
|
+
function stageRetailProducts(_x33) {
|
|
4102
4720
|
return _stageRetailProducts.apply(this, arguments);
|
|
4103
4721
|
}
|
|
4104
4722
|
return stageRetailProducts;
|
|
@@ -4117,51 +4735,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4117
4735
|
}, {
|
|
4118
4736
|
key: "addRetailProduct",
|
|
4119
4737
|
value: (function () {
|
|
4120
|
-
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4738
|
+
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
4121
4739
|
var _params$quantity,
|
|
4122
|
-
|
|
4740
|
+
_ref53,
|
|
4123
4741
|
_params$productId,
|
|
4124
4742
|
_params$product,
|
|
4125
4743
|
_params$product2,
|
|
4126
4744
|
_metadata2,
|
|
4127
|
-
|
|
4745
|
+
_this16 = this,
|
|
4128
4746
|
_metadata3;
|
|
4129
4747
|
var quantity, productId, sourceProduct, products, orderProduct, order, meta, scopeKey, purchaseDatetime, identity, isCurrentOrder, guard, _order, _meta, parentUid, _scopeKey, _purchaseDatetime, normalizedPurchaseDatetime, _identity, _isCurrentOrder, _guard;
|
|
4130
|
-
return _regeneratorRuntime().wrap(function
|
|
4131
|
-
while (1) switch (
|
|
4748
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4749
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4132
4750
|
case 0:
|
|
4133
4751
|
quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
|
|
4134
4752
|
if (!(!Number.isFinite(quantity) || quantity <= 0)) {
|
|
4135
|
-
|
|
4753
|
+
_context46.next = 3;
|
|
4136
4754
|
break;
|
|
4137
4755
|
}
|
|
4138
4756
|
throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
|
|
4139
4757
|
case 3:
|
|
4140
|
-
productId = (
|
|
4758
|
+
productId = (_ref53 = (_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 && _ref53 !== void 0 ? _ref53 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
|
|
4141
4759
|
sourceProduct = params.product;
|
|
4142
4760
|
if (!sourceProduct && productId !== undefined && productId !== null) {
|
|
4143
4761
|
sourceProduct = this.unifiedProductCatalog.find(function (product) {
|
|
4144
|
-
var _product$
|
|
4145
|
-
return String((_product$
|
|
4762
|
+
var _product$id4;
|
|
4763
|
+
return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
|
|
4146
4764
|
});
|
|
4147
4765
|
}
|
|
4148
4766
|
if (!(!sourceProduct && productId !== undefined && productId !== null)) {
|
|
4149
|
-
|
|
4767
|
+
_context46.next = 11;
|
|
4150
4768
|
break;
|
|
4151
4769
|
}
|
|
4152
|
-
|
|
4770
|
+
_context46.next = 9;
|
|
4153
4771
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
4154
4772
|
product_ids: [Number(productId)].filter(Number.isFinite)
|
|
4155
4773
|
}));
|
|
4156
4774
|
case 9:
|
|
4157
|
-
products =
|
|
4775
|
+
products = _context46.sent;
|
|
4158
4776
|
sourceProduct = products.find(function (product) {
|
|
4159
|
-
var _product$
|
|
4160
|
-
return String((_product$
|
|
4777
|
+
var _product$id5;
|
|
4778
|
+
return String((_product$id5 = product.id) !== null && _product$id5 !== void 0 ? _product$id5 : product.product_id) === String(productId);
|
|
4161
4779
|
});
|
|
4162
4780
|
case 11:
|
|
4163
4781
|
if (sourceProduct) {
|
|
4164
|
-
|
|
4782
|
+
_context46.next = 13;
|
|
4165
4783
|
break;
|
|
4166
4784
|
}
|
|
4167
4785
|
throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
|
|
@@ -4170,13 +4788,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4170
4788
|
quantity: quantity
|
|
4171
4789
|
}), 'unified_booking_sales_retail');
|
|
4172
4790
|
if (orderProduct) {
|
|
4173
|
-
|
|
4791
|
+
_context46.next = 16;
|
|
4174
4792
|
break;
|
|
4175
4793
|
}
|
|
4176
4794
|
throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
|
|
4177
4795
|
case 16:
|
|
4178
4796
|
if (!(((_metadata2 = orderProduct.metadata) === null || _metadata2 === void 0 ? void 0 : _metadata2.venue_booking_role) === 'tickets_extra')) {
|
|
4179
|
-
|
|
4797
|
+
_context46.next = 31;
|
|
4180
4798
|
break;
|
|
4181
4799
|
}
|
|
4182
4800
|
order = this.getTempOrder();
|
|
@@ -4185,7 +4803,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4185
4803
|
purchaseDatetime = String(meta.venue_booking_service_datetime || '');
|
|
4186
4804
|
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];
|
|
4187
4805
|
isCurrentOrder = function isCurrentOrder() {
|
|
4188
|
-
return
|
|
4806
|
+
return _this16.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];
|
|
4189
4807
|
};
|
|
4190
4808
|
guard = function guard() {
|
|
4191
4809
|
var _params$availabilityC;
|
|
@@ -4194,7 +4812,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4194
4812
|
var _line$metadata, _line$metadata2;
|
|
4195
4813
|
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;
|
|
4196
4814
|
})) {
|
|
4197
|
-
throw
|
|
4815
|
+
throw _this16.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '门票订单或购买时间已变化,请重新确认附加商品');
|
|
4198
4816
|
}
|
|
4199
4817
|
};
|
|
4200
4818
|
guard();
|
|
@@ -4210,7 +4828,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4210
4828
|
status: 'disable',
|
|
4211
4829
|
required: 0
|
|
4212
4830
|
};
|
|
4213
|
-
return
|
|
4831
|
+
return _context46.abrupt("return", this.addProductToOrder(orderProduct, undefined, {
|
|
4214
4832
|
disableMerge: true,
|
|
4215
4833
|
availabilityCommitGuard: guard,
|
|
4216
4834
|
availabilityCommitTargetGuard: isCurrentOrder,
|
|
@@ -4218,7 +4836,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4218
4836
|
}));
|
|
4219
4837
|
case 31:
|
|
4220
4838
|
if (!(((_metadata3 = orderProduct.metadata) === null || _metadata3 === void 0 ? void 0 : _metadata3.venue_booking_role) === 'party_extra')) {
|
|
4221
|
-
|
|
4839
|
+
_context46.next = 47;
|
|
4222
4840
|
break;
|
|
4223
4841
|
}
|
|
4224
4842
|
_order = this.getTempOrder();
|
|
@@ -4230,7 +4848,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4230
4848
|
normalizedPurchaseDatetime = _purchaseDatetime.length === 16 ? "".concat(_purchaseDatetime, ":00") : _purchaseDatetime;
|
|
4231
4849
|
_identity = [_order === null || _order === void 0 ? void 0 : _order.order_id, _order === null || _order === void 0 ? void 0 : _order.external_sale_number];
|
|
4232
4850
|
_isCurrentOrder = function _isCurrentOrder() {
|
|
4233
|
-
return
|
|
4851
|
+
return _this16.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];
|
|
4234
4852
|
};
|
|
4235
4853
|
_guard = function _guard() {
|
|
4236
4854
|
var _params$availabilityC2, _parent$metadata, _parent$metadata2;
|
|
@@ -4238,7 +4856,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4238
4856
|
var parent = ((_order === null || _order === void 0 ? void 0 : _order.products) || []).find(function (line) {
|
|
4239
4857
|
return getProductLineUid(line) === parentUid;
|
|
4240
4858
|
});
|
|
4241
|
-
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
|
|
4859
|
+
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 _this16.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'Party 主商品或附加商品报价上下文已变化,请重新确认附加商品');
|
|
4242
4860
|
};
|
|
4243
4861
|
_guard();
|
|
4244
4862
|
delete orderProduct.unique_identification_number;
|
|
@@ -4251,25 +4869,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4251
4869
|
status: 'disable',
|
|
4252
4870
|
required: 0
|
|
4253
4871
|
};
|
|
4254
|
-
return
|
|
4872
|
+
return _context46.abrupt("return", this.addProductToOrder(orderProduct, undefined, {
|
|
4255
4873
|
disableMerge: true,
|
|
4256
4874
|
availabilityCommitGuard: _guard,
|
|
4257
4875
|
availabilityCommitTargetGuard: _isCurrentOrder,
|
|
4258
4876
|
salesNotes: params.salesNotes
|
|
4259
4877
|
}));
|
|
4260
4878
|
case 47:
|
|
4261
|
-
return
|
|
4879
|
+
return _context46.abrupt("return", this.addProductToOrder(orderProduct, undefined, _objectSpread(_objectSpread({}, params.availabilityCommitGuard ? {
|
|
4262
4880
|
availabilityCommitGuard: params.availabilityCommitGuard
|
|
4263
4881
|
} : {}), params.salesNotes ? {
|
|
4264
4882
|
salesNotes: params.salesNotes
|
|
4265
4883
|
} : {})));
|
|
4266
4884
|
case 48:
|
|
4267
4885
|
case "end":
|
|
4268
|
-
return
|
|
4886
|
+
return _context46.stop();
|
|
4269
4887
|
}
|
|
4270
|
-
},
|
|
4888
|
+
}, _callee46, this);
|
|
4271
4889
|
}));
|
|
4272
|
-
function addRetailProduct(
|
|
4890
|
+
function addRetailProduct(_x34) {
|
|
4273
4891
|
return _addRetailProduct.apply(this, arguments);
|
|
4274
4892
|
}
|
|
4275
4893
|
return addRetailProduct;
|
|
@@ -4324,7 +4942,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4324
4942
|
key: "assertAvailabilityPrepareParams",
|
|
4325
4943
|
value: function assertAvailabilityPrepareParams(params) {
|
|
4326
4944
|
var _params$dateRange3, _params$dateRange4;
|
|
4327
|
-
if (params.occupancyCachePolicy !== undefined && params.occupancyCachePolicy !== 'cache_first') {
|
|
4945
|
+
if (params.occupancyCachePolicy !== undefined && params.occupancyCachePolicy !== 'cache_first' && params.occupancyCachePolicy !== 'session') {
|
|
4328
4946
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'Unknown occupancyCachePolicy');
|
|
4329
4947
|
}
|
|
4330
4948
|
assertAvailabilityCatalogProductIds(params.productIds, 'prepare.productIds');
|
|
@@ -4372,7 +4990,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4372
4990
|
}, {
|
|
4373
4991
|
key: "buildAvailabilityOperatingHoursSnapshot",
|
|
4374
4992
|
value: function buildAvailabilityOperatingHoursSnapshot(params) {
|
|
4375
|
-
var
|
|
4993
|
+
var _this17 = this;
|
|
4376
4994
|
var descriptor = params.prepare._availabilityOperatingHours || {
|
|
4377
4995
|
source: params.prepare.businessHours ? 'prepare_business_hours' : 'default_business_hours',
|
|
4378
4996
|
scheduleIds: []
|
|
@@ -4382,7 +5000,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4382
5000
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4383
5001
|
startAt: "".concat(date, "T").concat(params.businessHours.startTime, ":00"),
|
|
4384
5002
|
endAt: "".concat(date, "T").concat(params.businessHours.endTime, ":00"),
|
|
4385
|
-
fixedOffsetMinutes:
|
|
5003
|
+
fixedOffsetMinutes: _this17.getAvailabilityRuntimeOffsetMinutes(),
|
|
4386
5004
|
rollOverEnd: true
|
|
4387
5005
|
});
|
|
4388
5006
|
return range ? [{
|
|
@@ -4417,7 +5035,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4417
5035
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4418
5036
|
startAt: slot.start_at,
|
|
4419
5037
|
endAt: slot.end_at,
|
|
4420
|
-
fixedOffsetMinutes:
|
|
5038
|
+
fixedOffsetMinutes: _this17.getAvailabilityRuntimeOffsetMinutes(),
|
|
4421
5039
|
rollOverEnd: true
|
|
4422
5040
|
});
|
|
4423
5041
|
return range ? [{
|
|
@@ -4433,7 +5051,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4433
5051
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4434
5052
|
startAt: slot.start_at,
|
|
4435
5053
|
endAt: slot.end_at,
|
|
4436
|
-
fixedOffsetMinutes:
|
|
5054
|
+
fixedOffsetMinutes: _this17.getAvailabilityRuntimeOffsetMinutes(),
|
|
4437
5055
|
rollOverEnd: true
|
|
4438
5056
|
});
|
|
4439
5057
|
return range ? [{
|
|
@@ -4460,51 +5078,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4460
5078
|
}, {
|
|
4461
5079
|
key: "loadAvailabilityProducts",
|
|
4462
5080
|
value: function () {
|
|
4463
|
-
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4464
|
-
var
|
|
5081
|
+
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
5082
|
+
var _this18 = this,
|
|
4465
5083
|
_prepare$catalogScope3,
|
|
4466
5084
|
_prepare$catalogScope4,
|
|
4467
5085
|
_prepare$resourceIds;
|
|
4468
5086
|
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;
|
|
4469
|
-
return _regeneratorRuntime().wrap(function
|
|
4470
|
-
while (1) switch (
|
|
5087
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
5088
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4471
5089
|
case 0:
|
|
4472
5090
|
prepare = params.prepare, dateRange = params.dateRange;
|
|
4473
5091
|
explicitProductIds = prepare.productIds || [];
|
|
4474
5092
|
publishCatalog = prepare.publishCatalog !== false;
|
|
4475
5093
|
loadProducts = function loadProducts(query) {
|
|
4476
5094
|
var _prepare$catalogScope;
|
|
4477
|
-
return publishCatalog ?
|
|
5095
|
+
return publishCatalog ? _this18.loadProducts(query) : ((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'productList' ? _this18.queryCatalogSnapshot(query) : _this18.loadCatalogProducts(query);
|
|
4478
5096
|
};
|
|
4479
5097
|
rawProducts = [];
|
|
4480
5098
|
if (!Array.isArray(prepare.rawProducts)) {
|
|
4481
|
-
|
|
5099
|
+
_context47.next = 10;
|
|
4482
5100
|
break;
|
|
4483
5101
|
}
|
|
4484
5102
|
rawProducts = prepare.rawProducts;
|
|
4485
5103
|
if (publishCatalog) this.unifiedProductCatalog = _toConsumableArray(rawProducts);
|
|
4486
|
-
|
|
5104
|
+
_context47.next = 36;
|
|
4487
5105
|
break;
|
|
4488
5106
|
case 10:
|
|
4489
5107
|
if (!(explicitProductIds.length > 0)) {
|
|
4490
|
-
|
|
5108
|
+
_context47.next = 16;
|
|
4491
5109
|
break;
|
|
4492
5110
|
}
|
|
4493
|
-
|
|
5111
|
+
_context47.next = 13;
|
|
4494
5112
|
return loadProducts(_objectSpread(_objectSpread({}, !publishCatalog && ((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList' ? prepare.catalogScope.params : {}), {}, {
|
|
4495
5113
|
product_ids: explicitProductIds,
|
|
4496
5114
|
schedule_date: dateRange.startDate
|
|
4497
5115
|
}));
|
|
4498
5116
|
case 13:
|
|
4499
|
-
rawProducts =
|
|
4500
|
-
|
|
5117
|
+
rawProducts = _context47.sent;
|
|
5118
|
+
_context47.next = 36;
|
|
4501
5119
|
break;
|
|
4502
5120
|
case 16:
|
|
4503
5121
|
if (!(((_prepare$catalogScope3 = prepare.catalogScope) === null || _prepare$catalogScope3 === void 0 ? void 0 : _prepare$catalogScope3.type) === 'schedule')) {
|
|
4504
|
-
|
|
5122
|
+
_context47.next = 32;
|
|
4505
5123
|
break;
|
|
4506
5124
|
}
|
|
4507
|
-
|
|
5125
|
+
_context47.next = 19;
|
|
4508
5126
|
return this.loadScheduleAvailableDate({
|
|
4509
5127
|
startDate: dateRange.startDate,
|
|
4510
5128
|
endDate: dateRange.endDate,
|
|
@@ -4520,44 +5138,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4520
5138
|
});
|
|
4521
5139
|
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)) || [])));
|
|
4522
5140
|
if (!(productIds.length > 0)) {
|
|
4523
|
-
|
|
5141
|
+
_context47.next = 29;
|
|
4524
5142
|
break;
|
|
4525
5143
|
}
|
|
4526
5144
|
assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
|
|
4527
|
-
|
|
5145
|
+
_context47.next = 26;
|
|
4528
5146
|
return loadProducts({
|
|
4529
5147
|
product_ids: productIds,
|
|
4530
5148
|
schedule_date: dateRange.startDate
|
|
4531
5149
|
});
|
|
4532
5150
|
case 26:
|
|
4533
|
-
rawProducts =
|
|
4534
|
-
|
|
5151
|
+
rawProducts = _context47.sent;
|
|
5152
|
+
_context47.next = 30;
|
|
4535
5153
|
break;
|
|
4536
5154
|
case 29:
|
|
4537
5155
|
if (publishCatalog) this.unifiedProductCatalog = [];
|
|
4538
5156
|
case 30:
|
|
4539
|
-
|
|
5157
|
+
_context47.next = 36;
|
|
4540
5158
|
break;
|
|
4541
5159
|
case 32:
|
|
4542
5160
|
if (!(((_prepare$catalogScope4 = prepare.catalogScope) === null || _prepare$catalogScope4 === void 0 ? void 0 : _prepare$catalogScope4.type) === 'productList')) {
|
|
4543
|
-
|
|
5161
|
+
_context47.next = 36;
|
|
4544
5162
|
break;
|
|
4545
5163
|
}
|
|
4546
|
-
|
|
5164
|
+
_context47.next = 35;
|
|
4547
5165
|
return loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
|
|
4548
5166
|
schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
|
|
4549
5167
|
}));
|
|
4550
5168
|
case 35:
|
|
4551
|
-
rawProducts =
|
|
5169
|
+
rawProducts = _context47.sent;
|
|
4552
5170
|
case 36:
|
|
4553
5171
|
normalized = rawProducts.map(function (product) {
|
|
4554
|
-
return normalizeProductForAvailability(product, params.scheduleList,
|
|
5172
|
+
return normalizeProductForAvailability(product, params.scheduleList, _this18.getAvailabilityRuntimeOffsetMinutes());
|
|
4555
5173
|
});
|
|
4556
5174
|
if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
|
|
4557
|
-
|
|
5175
|
+
_context47.next = 39;
|
|
4558
5176
|
break;
|
|
4559
5177
|
}
|
|
4560
|
-
return
|
|
5178
|
+
return _context47.abrupt("return", normalized.filter(function (product) {
|
|
4561
5179
|
var _product$requirementG2;
|
|
4562
5180
|
return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
|
|
4563
5181
|
var _group$resourceIds3;
|
|
@@ -4570,16 +5188,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4570
5188
|
}));
|
|
4571
5189
|
case 39:
|
|
4572
5190
|
productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
|
|
4573
|
-
return
|
|
5191
|
+
return _context47.abrupt("return", productIdSet ? normalized.filter(function (product) {
|
|
4574
5192
|
return productIdSet.has(String(product.id));
|
|
4575
5193
|
}) : normalized);
|
|
4576
5194
|
case 41:
|
|
4577
5195
|
case "end":
|
|
4578
|
-
return
|
|
5196
|
+
return _context47.stop();
|
|
4579
5197
|
}
|
|
4580
|
-
},
|
|
5198
|
+
}, _callee47, this);
|
|
4581
5199
|
}));
|
|
4582
|
-
function loadAvailabilityProducts(
|
|
5200
|
+
function loadAvailabilityProducts(_x35) {
|
|
4583
5201
|
return _loadAvailabilityProducts.apply(this, arguments);
|
|
4584
5202
|
}
|
|
4585
5203
|
return loadAvailabilityProducts;
|
|
@@ -4592,12 +5210,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4592
5210
|
}, {
|
|
4593
5211
|
key: "fetchAvailabilityResourcesV2",
|
|
4594
5212
|
value: (function () {
|
|
4595
|
-
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5213
|
+
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
|
|
4596
5214
|
var response, data, message;
|
|
4597
|
-
return _regeneratorRuntime().wrap(function
|
|
4598
|
-
while (1) switch (
|
|
5215
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5216
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4599
5217
|
case 0:
|
|
4600
|
-
|
|
5218
|
+
_context48.next = 2;
|
|
4601
5219
|
return this.request.get('/schedule/resource/list/v2', {
|
|
4602
5220
|
start_date: params.dateRange.startDate,
|
|
4603
5221
|
end_date: params.dateRange.endDate,
|
|
@@ -4607,10 +5225,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4607
5225
|
useCache: false
|
|
4608
5226
|
});
|
|
4609
5227
|
case 2:
|
|
4610
|
-
response =
|
|
5228
|
+
response = _context48.sent;
|
|
4611
5229
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
4612
5230
|
if (!(params.strictResponse && (response === null || response === void 0 ? void 0 : response.status) === false)) {
|
|
4613
|
-
|
|
5231
|
+
_context48.next = 7;
|
|
4614
5232
|
break;
|
|
4615
5233
|
}
|
|
4616
5234
|
message = response === null || response === void 0 ? void 0 : response.message;
|
|
@@ -4619,31 +5237,31 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4619
5237
|
});
|
|
4620
5238
|
case 7:
|
|
4621
5239
|
if (!Array.isArray(data)) {
|
|
4622
|
-
|
|
5240
|
+
_context48.next = 9;
|
|
4623
5241
|
break;
|
|
4624
5242
|
}
|
|
4625
|
-
return
|
|
5243
|
+
return _context48.abrupt("return", data);
|
|
4626
5244
|
case 9:
|
|
4627
5245
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
|
|
4628
|
-
|
|
5246
|
+
_context48.next = 11;
|
|
4629
5247
|
break;
|
|
4630
5248
|
}
|
|
4631
|
-
return
|
|
5249
|
+
return _context48.abrupt("return", data.list);
|
|
4632
5250
|
case 11:
|
|
4633
5251
|
if (!params.strictResponse) {
|
|
4634
|
-
|
|
5252
|
+
_context48.next = 13;
|
|
4635
5253
|
break;
|
|
4636
5254
|
}
|
|
4637
5255
|
throw new Error('Booking resource details returned an invalid response.');
|
|
4638
5256
|
case 13:
|
|
4639
|
-
return
|
|
5257
|
+
return _context48.abrupt("return", []);
|
|
4640
5258
|
case 14:
|
|
4641
5259
|
case "end":
|
|
4642
|
-
return
|
|
5260
|
+
return _context48.stop();
|
|
4643
5261
|
}
|
|
4644
|
-
},
|
|
5262
|
+
}, _callee48, this);
|
|
4645
5263
|
}));
|
|
4646
|
-
function fetchAvailabilityResourcesV2(
|
|
5264
|
+
function fetchAvailabilityResourcesV2(_x36) {
|
|
4647
5265
|
return _fetchAvailabilityResourcesV.apply(this, arguments);
|
|
4648
5266
|
}
|
|
4649
5267
|
return fetchAvailabilityResourcesV2;
|
|
@@ -4651,32 +5269,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4651
5269
|
}, {
|
|
4652
5270
|
key: "queryBookingResourceDetails",
|
|
4653
5271
|
value: (function () {
|
|
4654
|
-
var _queryBookingResourceDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4655
|
-
var
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
5272
|
+
var _queryBookingResourceDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
5273
|
+
var _this19 = this,
|
|
5274
|
+
_this$otherParams37;
|
|
5275
|
+
var date, resourceIds, core, request, generation, scope, assertCurrent, resourceQuery, timezone, resources, byId;
|
|
5276
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
5277
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4659
5278
|
case 0:
|
|
4660
5279
|
date = params === null || params === void 0 ? void 0 : params.date;
|
|
4661
|
-
|
|
5280
|
+
_context49.prev = 1;
|
|
4662
5281
|
if (!(typeof date !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(date))) {
|
|
4663
|
-
|
|
5282
|
+
_context49.next = 4;
|
|
4664
5283
|
break;
|
|
4665
5284
|
}
|
|
4666
5285
|
throw new Error('date');
|
|
4667
5286
|
case 4:
|
|
4668
5287
|
parseLocalDate(date);
|
|
4669
|
-
|
|
5288
|
+
_context49.next = 10;
|
|
4670
5289
|
break;
|
|
4671
5290
|
case 7:
|
|
4672
|
-
|
|
4673
|
-
|
|
5291
|
+
_context49.prev = 7;
|
|
5292
|
+
_context49.t0 = _context49["catch"](1);
|
|
4674
5293
|
throw this.createAvailabilityFacadeError('INVALID_DATE_RANGE', 'A valid booking date is required to load resource details.');
|
|
4675
5294
|
case 10:
|
|
4676
5295
|
if (!(!Array.isArray(params === null || params === void 0 ? void 0 : params.resourceIds) || !params.resourceIds.length || params.resourceIds.some(function (id) {
|
|
4677
5296
|
return !['number', 'string'].includes(_typeof(id)) || !/^\d+$/.test(String(id)) || !Number.isSafeInteger(Number(id)) || Number(id) <= 0;
|
|
4678
5297
|
}))) {
|
|
4679
|
-
|
|
5298
|
+
_context49.next = 12;
|
|
4680
5299
|
break;
|
|
4681
5300
|
}
|
|
4682
5301
|
throw this.createAvailabilityFacadeError('INVALID_TARGET_FILTER', 'Selected resource IDs are required to load resource details.');
|
|
@@ -4689,22 +5308,48 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4689
5308
|
generation = this.runtimeInitializationGeneration;
|
|
4690
5309
|
scope = this.getRuntimeOpenDataScope();
|
|
4691
5310
|
assertCurrent = function assertCurrent() {
|
|
4692
|
-
if (
|
|
4693
|
-
throw
|
|
5311
|
+
if (_this19.runtimeOpenDataDestroyed || !request || core !== _this19.core || request !== _this19.request || generation !== _this19.runtimeInitializationGeneration || scope !== _this19.getRuntimeOpenDataScope()) {
|
|
5312
|
+
throw _this19.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'Booking settings changed. Please reload the resource details.');
|
|
4694
5313
|
}
|
|
4695
5314
|
};
|
|
4696
5315
|
assertCurrent();
|
|
4697
|
-
|
|
4698
|
-
return this.fetchAvailabilityResourcesV2({
|
|
5316
|
+
resourceQuery = {
|
|
4699
5317
|
dateRange: {
|
|
4700
5318
|
startDate: date,
|
|
4701
5319
|
endDate: date
|
|
4702
5320
|
},
|
|
4703
|
-
resourceIds: resourceIds
|
|
5321
|
+
resourceIds: resourceIds
|
|
5322
|
+
}; // Match normalizeAvailabilityPrepareDescriptor so confirmation reuses exactly
|
|
5323
|
+
// the same resource/date coverage as the selection projection.
|
|
5324
|
+
timezone = String(((_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.businessTimezone) || Intl.DateTimeFormat().resolvedOptions().timeZone || 'Asia/Shanghai').trim();
|
|
5325
|
+
if (!this.isVenueCatalogLocalPricingActive()) {
|
|
5326
|
+
_context49.next = 27;
|
|
5327
|
+
break;
|
|
5328
|
+
}
|
|
5329
|
+
_context49.next = 24;
|
|
5330
|
+
return this.availabilitySessionResourceCache.load(_objectSpread(_objectSpread({
|
|
5331
|
+
scopeKey: "".concat(scope, ":").concat(this.buildAvailabilityRemoteResourceScopeKey(timezone)),
|
|
5332
|
+
timezoneName: timezone
|
|
5333
|
+
}, resourceQuery), {}, {
|
|
5334
|
+
fetch: function fetch(query) {
|
|
5335
|
+
return _this19.fetchAvailabilityResourcesV2(_objectSpread(_objectSpread({}, query), {}, {
|
|
5336
|
+
strictResponse: true
|
|
5337
|
+
}));
|
|
5338
|
+
}
|
|
5339
|
+
}));
|
|
5340
|
+
case 24:
|
|
5341
|
+
_context49.t1 = _context49.sent;
|
|
5342
|
+
_context49.next = 30;
|
|
5343
|
+
break;
|
|
5344
|
+
case 27:
|
|
5345
|
+
_context49.next = 29;
|
|
5346
|
+
return this.fetchAvailabilityResourcesV2(_objectSpread(_objectSpread({}, resourceQuery), {}, {
|
|
4704
5347
|
strictResponse: true
|
|
4705
|
-
});
|
|
4706
|
-
case
|
|
4707
|
-
|
|
5348
|
+
}));
|
|
5349
|
+
case 29:
|
|
5350
|
+
_context49.t1 = _context49.sent;
|
|
5351
|
+
case 30:
|
|
5352
|
+
resources = _context49.t1;
|
|
4708
5353
|
assertCurrent();
|
|
4709
5354
|
byId = new Map(resources.filter(isRecord).map(function (resource) {
|
|
4710
5355
|
return [String(resource.id), resource];
|
|
@@ -4712,21 +5357,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4712
5357
|
if (!resourceIds.some(function (id) {
|
|
4713
5358
|
return !byId.has(id);
|
|
4714
5359
|
})) {
|
|
4715
|
-
|
|
5360
|
+
_context49.next = 35;
|
|
4716
5361
|
break;
|
|
4717
5362
|
}
|
|
4718
5363
|
throw this.createAvailabilityFacadeError('INVALID_TARGET_FILTER', 'A selected booking resource is no longer available.');
|
|
4719
|
-
case
|
|
4720
|
-
return
|
|
5364
|
+
case 35:
|
|
5365
|
+
return _context49.abrupt("return", cloneDeep(resourceIds.map(function (id) {
|
|
4721
5366
|
return byId.get(id);
|
|
4722
5367
|
})));
|
|
4723
|
-
case
|
|
5368
|
+
case 36:
|
|
4724
5369
|
case "end":
|
|
4725
|
-
return
|
|
5370
|
+
return _context49.stop();
|
|
4726
5371
|
}
|
|
4727
|
-
},
|
|
5372
|
+
}, _callee49, this, [[1, 7]]);
|
|
4728
5373
|
}));
|
|
4729
|
-
function queryBookingResourceDetails(
|
|
5374
|
+
function queryBookingResourceDetails(_x37) {
|
|
4730
5375
|
return _queryBookingResourceDetails.apply(this, arguments);
|
|
4731
5376
|
}
|
|
4732
5377
|
return queryBookingResourceDetails;
|
|
@@ -4734,17 +5379,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4734
5379
|
}, {
|
|
4735
5380
|
key: "fetchAndPublishAvailabilityResourcesV2",
|
|
4736
5381
|
value: function () {
|
|
4737
|
-
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5382
|
+
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
|
|
4738
5383
|
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources, epoch, covering, coveredResources;
|
|
4739
|
-
return _regeneratorRuntime().wrap(function
|
|
4740
|
-
while (1) switch (
|
|
5384
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
5385
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4741
5386
|
case 0:
|
|
4742
5387
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4743
5388
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4744
|
-
|
|
5389
|
+
_context50.next = 3;
|
|
4745
5390
|
break;
|
|
4746
5391
|
}
|
|
4747
|
-
return
|
|
5392
|
+
return _context50.abrupt("return", []);
|
|
4748
5393
|
case 3:
|
|
4749
5394
|
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
4750
5395
|
cacheParams = {
|
|
@@ -4755,7 +5400,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4755
5400
|
};
|
|
4756
5401
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
4757
5402
|
if (!cachedRawResources) {
|
|
4758
|
-
|
|
5403
|
+
_context50.next = 9;
|
|
4759
5404
|
break;
|
|
4760
5405
|
}
|
|
4761
5406
|
if (params.useCacheOnHit) {
|
|
@@ -4767,10 +5412,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4767
5412
|
console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
|
|
4768
5413
|
});
|
|
4769
5414
|
}
|
|
4770
|
-
return
|
|
5415
|
+
return _context50.abrupt("return", cachedRawResources);
|
|
4771
5416
|
case 9:
|
|
4772
5417
|
if (!(params.maxAgeMs !== undefined)) {
|
|
4773
|
-
|
|
5418
|
+
_context50.next = 20;
|
|
4774
5419
|
break;
|
|
4775
5420
|
}
|
|
4776
5421
|
// A visible-month request can cover a concurrent day/resource-subset preview.
|
|
@@ -4784,14 +5429,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4784
5429
|
});
|
|
4785
5430
|
});
|
|
4786
5431
|
if (!covering) {
|
|
4787
|
-
|
|
5432
|
+
_context50.next = 20;
|
|
4788
5433
|
break;
|
|
4789
5434
|
}
|
|
4790
|
-
|
|
5435
|
+
_context50.next = 15;
|
|
4791
5436
|
return covering.promise;
|
|
4792
5437
|
case 15:
|
|
4793
5438
|
if (!(epoch !== this.availabilityRemoteResourceEpoch)) {
|
|
4794
|
-
|
|
5439
|
+
_context50.next = 17;
|
|
4795
5440
|
break;
|
|
4796
5441
|
}
|
|
4797
5442
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'Resource settings changed while loading. Please prepare again.');
|
|
@@ -4800,26 +5445,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4800
5445
|
// response may have invalidated cells, in which case fetch this exact range below.
|
|
4801
5446
|
coveredResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
4802
5447
|
if (!coveredResources) {
|
|
4803
|
-
|
|
5448
|
+
_context50.next = 20;
|
|
4804
5449
|
break;
|
|
4805
5450
|
}
|
|
4806
|
-
return
|
|
5451
|
+
return _context50.abrupt("return", coveredResources);
|
|
4807
5452
|
case 20:
|
|
4808
|
-
|
|
5453
|
+
_context50.next = 22;
|
|
4809
5454
|
return this.refreshAvailabilityRemoteResourceQuery({
|
|
4810
5455
|
timezone: params.timezone,
|
|
4811
5456
|
dateRange: params.dateRange,
|
|
4812
5457
|
resourceIds: normalizedResourceIds
|
|
4813
5458
|
});
|
|
4814
5459
|
case 22:
|
|
4815
|
-
return
|
|
5460
|
+
return _context50.abrupt("return", _context50.sent);
|
|
4816
5461
|
case 23:
|
|
4817
5462
|
case "end":
|
|
4818
|
-
return
|
|
5463
|
+
return _context50.stop();
|
|
4819
5464
|
}
|
|
4820
|
-
},
|
|
5465
|
+
}, _callee50, this);
|
|
4821
5466
|
}));
|
|
4822
|
-
function fetchAndPublishAvailabilityResourcesV2(
|
|
5467
|
+
function fetchAndPublishAvailabilityResourcesV2(_x38) {
|
|
4823
5468
|
return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
|
|
4824
5469
|
}
|
|
4825
5470
|
return fetchAndPublishAvailabilityResourcesV2;
|
|
@@ -4827,18 +5472,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4827
5472
|
}, {
|
|
4828
5473
|
key: "refreshAvailabilityRemoteResourceQuery",
|
|
4829
5474
|
value: function () {
|
|
4830
|
-
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4831
|
-
var
|
|
5475
|
+
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
|
|
5476
|
+
var _this20 = this;
|
|
4832
5477
|
var normalizedResourceIds, queryKey, epoch, existing, writeVersion, scopeKey, promise, current;
|
|
4833
|
-
return _regeneratorRuntime().wrap(function
|
|
4834
|
-
while (1) switch (
|
|
5478
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
5479
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
4835
5480
|
case 0:
|
|
4836
5481
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4837
5482
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4838
|
-
|
|
5483
|
+
_context51.next = 3;
|
|
4839
5484
|
break;
|
|
4840
5485
|
}
|
|
4841
|
-
return
|
|
5486
|
+
return _context51.abrupt("return", []);
|
|
4842
5487
|
case 3:
|
|
4843
5488
|
queryKey = this.buildAvailabilityRemoteResourceQueryKey({
|
|
4844
5489
|
timezone: params.timezone,
|
|
@@ -4848,13 +5493,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4848
5493
|
epoch = this.availabilityRemoteResourceEpoch;
|
|
4849
5494
|
existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4850
5495
|
if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
|
|
4851
|
-
|
|
5496
|
+
_context51.next = 10;
|
|
4852
5497
|
break;
|
|
4853
5498
|
}
|
|
4854
|
-
|
|
5499
|
+
_context51.next = 9;
|
|
4855
5500
|
return existing.promise;
|
|
4856
5501
|
case 9:
|
|
4857
|
-
return
|
|
5502
|
+
return _context51.abrupt("return", _context51.sent);
|
|
4858
5503
|
case 10:
|
|
4859
5504
|
this.availabilityRemoteResourceQuerySequence += 1;
|
|
4860
5505
|
writeVersion = this.availabilityRemoteResourceQuerySequence;
|
|
@@ -4863,8 +5508,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4863
5508
|
dateRange: params.dateRange,
|
|
4864
5509
|
resourceIds: normalizedResourceIds
|
|
4865
5510
|
}).then(function (rawResources) {
|
|
4866
|
-
if (epoch ===
|
|
4867
|
-
|
|
5511
|
+
if (epoch === _this20.availabilityRemoteResourceEpoch) {
|
|
5512
|
+
_this20.availabilityRemoteOccupancyCache.publish({
|
|
4868
5513
|
scopeKey: scopeKey,
|
|
4869
5514
|
timezoneName: params.timezone,
|
|
4870
5515
|
resourceIds: normalizedResourceIds,
|
|
@@ -4882,25 +5527,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4882
5527
|
resourceIds: _toConsumableArray(normalizedResourceIds),
|
|
4883
5528
|
promise: promise
|
|
4884
5529
|
});
|
|
4885
|
-
|
|
4886
|
-
|
|
5530
|
+
_context51.prev = 15;
|
|
5531
|
+
_context51.next = 18;
|
|
4887
5532
|
return promise;
|
|
4888
5533
|
case 18:
|
|
4889
|
-
return
|
|
5534
|
+
return _context51.abrupt("return", _context51.sent);
|
|
4890
5535
|
case 19:
|
|
4891
|
-
|
|
5536
|
+
_context51.prev = 19;
|
|
4892
5537
|
current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4893
5538
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4894
5539
|
this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
|
|
4895
5540
|
}
|
|
4896
|
-
return
|
|
5541
|
+
return _context51.finish(19);
|
|
4897
5542
|
case 23:
|
|
4898
5543
|
case "end":
|
|
4899
|
-
return
|
|
5544
|
+
return _context51.stop();
|
|
4900
5545
|
}
|
|
4901
|
-
},
|
|
5546
|
+
}, _callee51, this, [[15,, 19, 23]]);
|
|
4902
5547
|
}));
|
|
4903
|
-
function refreshAvailabilityRemoteResourceQuery(
|
|
5548
|
+
function refreshAvailabilityRemoteResourceQuery(_x39) {
|
|
4904
5549
|
return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
|
|
4905
5550
|
}
|
|
4906
5551
|
return refreshAvailabilityRemoteResourceQuery;
|
|
@@ -4908,34 +5553,60 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4908
5553
|
}, {
|
|
4909
5554
|
key: "loadAvailabilityResources",
|
|
4910
5555
|
value: function () {
|
|
4911
|
-
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4912
|
-
var
|
|
4913
|
-
|
|
4914
|
-
|
|
5556
|
+
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
|
|
5557
|
+
var _this21 = this;
|
|
5558
|
+
var resourceIds, _rawResources, cachedRawResources, remoteQuery, rawResources;
|
|
5559
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
5560
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
4915
5561
|
case 0:
|
|
4916
5562
|
resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
|
|
4917
5563
|
if (!(resourceIds.length === 0)) {
|
|
4918
|
-
|
|
5564
|
+
_context52.next = 3;
|
|
4919
5565
|
break;
|
|
4920
5566
|
}
|
|
4921
|
-
return
|
|
5567
|
+
return _context52.abrupt("return", {
|
|
4922
5568
|
resources: [],
|
|
4923
5569
|
resourceOccupancies: []
|
|
4924
5570
|
});
|
|
4925
5571
|
case 3:
|
|
5572
|
+
if (!(params.fetchPolicy === 'session')) {
|
|
5573
|
+
_context52.next = 8;
|
|
5574
|
+
break;
|
|
5575
|
+
}
|
|
5576
|
+
_context52.next = 6;
|
|
5577
|
+
return this.availabilitySessionResourceCache.load({
|
|
5578
|
+
scopeKey: "".concat(this.getRuntimeOpenDataScope(), ":").concat(this.buildAvailabilityRemoteResourceScopeKey(params.timezone)),
|
|
5579
|
+
timezoneName: params.timezone,
|
|
5580
|
+
resourceIds: resourceIds,
|
|
5581
|
+
dateRange: params.dateRange,
|
|
5582
|
+
fetch: function fetch(query) {
|
|
5583
|
+
return _this21.fetchAvailabilityResourcesV2(_objectSpread(_objectSpread({}, query), {}, {
|
|
5584
|
+
strictResponse: true
|
|
5585
|
+
}));
|
|
5586
|
+
}
|
|
5587
|
+
});
|
|
5588
|
+
case 6:
|
|
5589
|
+
_rawResources = _context52.sent;
|
|
5590
|
+
return _context52.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
5591
|
+
rawResources: _rawResources,
|
|
5592
|
+
scheduleList: params.scheduleList,
|
|
5593
|
+
dateRange: params.dateRange,
|
|
5594
|
+
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
5595
|
+
}));
|
|
5596
|
+
case 8:
|
|
4926
5597
|
if (!(Array.isArray(params.rawResources) && params.fetchPolicy !== 'refresh')) {
|
|
4927
|
-
|
|
5598
|
+
_context52.next = 10;
|
|
4928
5599
|
break;
|
|
4929
5600
|
}
|
|
4930
|
-
return
|
|
5601
|
+
return _context52.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4931
5602
|
rawResources: params.rawResources,
|
|
4932
5603
|
scheduleList: params.scheduleList,
|
|
4933
5604
|
dateRange: params.dateRange,
|
|
4934
5605
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4935
5606
|
}));
|
|
4936
|
-
case
|
|
5607
|
+
case 10:
|
|
4937
5608
|
if (!(params.fetchPolicy === 'cache_only')) {
|
|
4938
|
-
|
|
5609
|
+
_context52.next = 15;
|
|
4939
5610
|
break;
|
|
4940
5611
|
}
|
|
4941
5612
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read({
|
|
@@ -4944,60 +5615,60 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4944
5615
|
dateRange: params.dateRange
|
|
4945
5616
|
});
|
|
4946
5617
|
if (!cachedRawResources) {
|
|
4947
|
-
|
|
5618
|
+
_context52.next = 14;
|
|
4948
5619
|
break;
|
|
4949
5620
|
}
|
|
4950
|
-
return
|
|
5621
|
+
return _context52.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4951
5622
|
rawResources: cachedRawResources,
|
|
4952
5623
|
scheduleList: params.scheduleList,
|
|
4953
5624
|
dateRange: params.dateRange,
|
|
4954
5625
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4955
5626
|
}));
|
|
4956
|
-
case
|
|
4957
|
-
return
|
|
5627
|
+
case 14:
|
|
5628
|
+
return _context52.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
|
|
4958
5629
|
resources: [],
|
|
4959
5630
|
resourceOccupancies: []
|
|
4960
5631
|
});
|
|
4961
|
-
case
|
|
5632
|
+
case 15:
|
|
4962
5633
|
remoteQuery = {
|
|
4963
5634
|
timezone: params.timezone,
|
|
4964
5635
|
dateRange: params.dateRange,
|
|
4965
5636
|
resourceIds: resourceIds
|
|
4966
5637
|
};
|
|
4967
5638
|
if (!(params.fetchPolicy === 'refresh')) {
|
|
4968
|
-
|
|
5639
|
+
_context52.next = 22;
|
|
4969
5640
|
break;
|
|
4970
5641
|
}
|
|
4971
|
-
|
|
5642
|
+
_context52.next = 19;
|
|
4972
5643
|
return this.refreshAvailabilityRemoteResourceQuery(remoteQuery);
|
|
4973
|
-
case
|
|
4974
|
-
|
|
4975
|
-
|
|
5644
|
+
case 19:
|
|
5645
|
+
_context52.t0 = _context52.sent;
|
|
5646
|
+
_context52.next = 25;
|
|
4976
5647
|
break;
|
|
4977
|
-
case
|
|
4978
|
-
|
|
5648
|
+
case 22:
|
|
5649
|
+
_context52.next = 24;
|
|
4979
5650
|
return this.fetchAndPublishAvailabilityResourcesV2(_objectSpread(_objectSpread({}, remoteQuery), {}, {
|
|
4980
5651
|
useCacheOnHit: params.fetchPolicy !== 'cache_first'
|
|
4981
5652
|
}, params.fetchPolicy === 'cache_first' ? {
|
|
4982
5653
|
maxAgeMs: PREVIEW_OCCUPANCY_CACHE_MAX_AGE_MS
|
|
4983
5654
|
} : {}));
|
|
4984
|
-
case
|
|
4985
|
-
|
|
4986
|
-
case
|
|
4987
|
-
rawResources =
|
|
4988
|
-
return
|
|
5655
|
+
case 24:
|
|
5656
|
+
_context52.t0 = _context52.sent;
|
|
5657
|
+
case 25:
|
|
5658
|
+
rawResources = _context52.t0;
|
|
5659
|
+
return _context52.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4989
5660
|
rawResources: rawResources,
|
|
4990
5661
|
scheduleList: params.scheduleList,
|
|
4991
5662
|
dateRange: params.dateRange,
|
|
4992
5663
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4993
5664
|
}));
|
|
4994
|
-
case
|
|
5665
|
+
case 27:
|
|
4995
5666
|
case "end":
|
|
4996
|
-
return
|
|
5667
|
+
return _context52.stop();
|
|
4997
5668
|
}
|
|
4998
|
-
},
|
|
5669
|
+
}, _callee52, this);
|
|
4999
5670
|
}));
|
|
5000
|
-
function loadAvailabilityResources(
|
|
5671
|
+
function loadAvailabilityResources(_x40) {
|
|
5001
5672
|
return _loadAvailabilityResources.apply(this, arguments);
|
|
5002
5673
|
}
|
|
5003
5674
|
return loadAvailabilityResources;
|
|
@@ -5017,7 +5688,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5017
5688
|
var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
|
|
5018
5689
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
5019
5690
|
productLineUids.forEach(function (requestedUid) {
|
|
5020
|
-
var
|
|
5691
|
+
var _ref54, _product$booking_uid2, _product$metadata6;
|
|
5021
5692
|
var product = products.find(function (line) {
|
|
5022
5693
|
return getProductLineUid(line) === String(requestedUid);
|
|
5023
5694
|
});
|
|
@@ -5027,7 +5698,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5027
5698
|
});
|
|
5028
5699
|
}
|
|
5029
5700
|
var productUid = getProductLineUid(product);
|
|
5030
|
-
var linkedBookingUid = String((
|
|
5701
|
+
var linkedBookingUid = String((_ref54 = (_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 && _ref54 !== void 0 ? _ref54 : '');
|
|
5031
5702
|
var linkedBookings = bookings.filter(function (booking) {
|
|
5032
5703
|
var _booking$product_uid;
|
|
5033
5704
|
return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
|
|
@@ -5070,24 +5741,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5070
5741
|
}, {
|
|
5071
5742
|
key: "collectCartResourceOccupancies",
|
|
5072
5743
|
value: function collectCartResourceOccupancies(tempOrder, exclusions) {
|
|
5073
|
-
var
|
|
5744
|
+
var _this22 = this;
|
|
5074
5745
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
5075
5746
|
return bookings.flatMap(function (booking) {
|
|
5076
|
-
var
|
|
5747
|
+
var _ref55, _booking$product_uid2, _booking$metadata2;
|
|
5077
5748
|
var bookingUid = getBookingUid(booking);
|
|
5078
|
-
var productUid = String((
|
|
5749
|
+
var productUid = String((_ref55 = (_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 && _ref55 !== void 0 ? _ref55 : '');
|
|
5079
5750
|
var scheduleEventId = toNumberId(booking.schedule_event_id);
|
|
5080
5751
|
var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
|
|
5081
5752
|
var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
|
|
5082
5753
|
var resources = Array.isArray(booking.resources) ? booking.resources : [];
|
|
5083
5754
|
return resources.flatMap(function (resource) {
|
|
5084
|
-
var
|
|
5085
|
-
var resourceId = (
|
|
5755
|
+
var _ref56, _resource$resource_id, _ref57, _resource$capacity;
|
|
5756
|
+
var resourceId = (_ref56 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref56 !== void 0 ? _ref56 : resource.id;
|
|
5086
5757
|
if (resourceId == null || !startAt || !endAt) return [];
|
|
5087
5758
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
5088
5759
|
startAt: startAt,
|
|
5089
5760
|
endAt: endAt,
|
|
5090
|
-
fixedOffsetMinutes:
|
|
5761
|
+
fixedOffsetMinutes: _this22.getAvailabilityRuntimeOffsetMinutes(),
|
|
5091
5762
|
rollOverEnd: false
|
|
5092
5763
|
});
|
|
5093
5764
|
if (!range) return [];
|
|
@@ -5095,7 +5766,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5095
5766
|
resourceId: resourceId,
|
|
5096
5767
|
startAt: range.startAt,
|
|
5097
5768
|
endAt: range.endAt,
|
|
5098
|
-
pax: Math.max(1, Number((
|
|
5769
|
+
pax: Math.max(1, Number((_ref57 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref57 !== void 0 ? _ref57 : 1) || 1),
|
|
5099
5770
|
source: 'cart',
|
|
5100
5771
|
scheduleEventId: scheduleEventId,
|
|
5101
5772
|
bookingUid: bookingUid || undefined,
|
|
@@ -5105,7 +5776,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5105
5776
|
resource: resource
|
|
5106
5777
|
}
|
|
5107
5778
|
};
|
|
5108
|
-
return
|
|
5779
|
+
return _this22.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
|
|
5109
5780
|
});
|
|
5110
5781
|
});
|
|
5111
5782
|
}
|
|
@@ -5172,16 +5843,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5172
5843
|
}, {
|
|
5173
5844
|
key: "assertContextualQueryFreshness",
|
|
5174
5845
|
value: function assertContextualQueryFreshness(context, request) {
|
|
5175
|
-
var
|
|
5846
|
+
var _this23 = this;
|
|
5176
5847
|
if (request.target === 'time') {
|
|
5177
5848
|
request.candidates.forEach(function (candidate) {
|
|
5178
|
-
|
|
5849
|
+
_this23.assertAvailabilityCandidateFreshness(context, candidate);
|
|
5179
5850
|
});
|
|
5180
5851
|
return;
|
|
5181
5852
|
}
|
|
5182
5853
|
if (request.target === 'resource') {
|
|
5183
5854
|
request.selectedRanges.forEach(function (candidate) {
|
|
5184
|
-
|
|
5855
|
+
_this23.assertAvailabilityCandidateFreshness(context, candidate);
|
|
5185
5856
|
});
|
|
5186
5857
|
}
|
|
5187
5858
|
}
|
|
@@ -5228,8 +5899,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5228
5899
|
}, {
|
|
5229
5900
|
key: "buildAvailabilityProjectionSnapshot",
|
|
5230
5901
|
value: function () {
|
|
5231
|
-
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5232
|
-
var
|
|
5902
|
+
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(params) {
|
|
5903
|
+
var _this24 = this;
|
|
5233
5904
|
var options,
|
|
5234
5905
|
normalizedPrepareParams,
|
|
5235
5906
|
timezoneLabel,
|
|
@@ -5250,11 +5921,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5250
5921
|
durationCandidateAnchorAt,
|
|
5251
5922
|
orderRevision,
|
|
5252
5923
|
projection,
|
|
5253
|
-
|
|
5254
|
-
return _regeneratorRuntime().wrap(function
|
|
5255
|
-
while (1) switch (
|
|
5924
|
+
_args53 = arguments;
|
|
5925
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5926
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
5256
5927
|
case 0:
|
|
5257
|
-
options =
|
|
5928
|
+
options = _args53.length > 1 && _args53[1] !== undefined ? _args53[1] : {};
|
|
5258
5929
|
normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
5259
5930
|
timezoneLabel = String(normalizedPrepareParams.timezone);
|
|
5260
5931
|
dateRange = normalizedPrepareParams.dateRange;
|
|
@@ -5268,15 +5939,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5268
5939
|
scheduleList: scheduleList,
|
|
5269
5940
|
businessHours: businessHours
|
|
5270
5941
|
});
|
|
5271
|
-
|
|
5942
|
+
_context53.next = 11;
|
|
5272
5943
|
return this.loadAvailabilityProducts({
|
|
5273
5944
|
prepare: normalizedPrepareParams,
|
|
5274
5945
|
dateRange: dateRange,
|
|
5275
5946
|
scheduleList: scheduleList
|
|
5276
5947
|
});
|
|
5277
5948
|
case 11:
|
|
5278
|
-
products =
|
|
5279
|
-
|
|
5949
|
+
products = _context53.sent;
|
|
5950
|
+
_context53.next = 14;
|
|
5280
5951
|
return this.loadAvailabilityResources({
|
|
5281
5952
|
timezone: timezoneLabel,
|
|
5282
5953
|
dateRange: dateRange,
|
|
@@ -5284,19 +5955,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5284
5955
|
products: products,
|
|
5285
5956
|
rawResources: normalizedPrepareParams.rawResources,
|
|
5286
5957
|
scheduleList: scheduleList,
|
|
5287
|
-
//
|
|
5288
|
-
|
|
5958
|
+
// Explicit Venue sessions retain physical occupancy coverage across preview,
|
|
5959
|
+
// selection and commit. Cart-derived occupancy is still rebuilt below.
|
|
5960
|
+
fetchPolicy: normalizedPrepareParams.occupancyCachePolicy === 'session' ? 'session' : options.resourceFetchPolicy || (normalizedPrepareParams.refreshOccupancies ? 'refresh' : normalizedPrepareParams.occupancyCachePolicy === 'cache_first' ? 'cache_first' : 'default'),
|
|
5289
5961
|
fallbackResources: options.fallbackResources
|
|
5290
5962
|
});
|
|
5291
5963
|
case 14:
|
|
5292
|
-
loadedResources =
|
|
5964
|
+
loadedResources = _context53.sent;
|
|
5293
5965
|
tempOrder = this.getTempOrder();
|
|
5294
5966
|
exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
|
|
5295
5967
|
injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
|
|
5296
5968
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
5297
5969
|
startAt: occupancy.startAt,
|
|
5298
5970
|
endAt: occupancy.endAt,
|
|
5299
|
-
fixedOffsetMinutes:
|
|
5971
|
+
fixedOffsetMinutes: _this24.getAvailabilityRuntimeOffsetMinutes(),
|
|
5300
5972
|
rollOverEnd: false
|
|
5301
5973
|
});
|
|
5302
5974
|
if (!range) return [];
|
|
@@ -5306,7 +5978,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5306
5978
|
})];
|
|
5307
5979
|
});
|
|
5308
5980
|
remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
|
|
5309
|
-
return !
|
|
5981
|
+
return !_this24.occupancyIsExcluded(occupancy, exclusions);
|
|
5310
5982
|
});
|
|
5311
5983
|
cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
|
|
5312
5984
|
preparedAt = this.getAvailabilityRuntimeDateTime();
|
|
@@ -5335,18 +6007,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5335
6007
|
prepareParams: normalizedPrepareParams,
|
|
5336
6008
|
durationCandidateAnchorAt: durationCandidateAnchorAt
|
|
5337
6009
|
});
|
|
5338
|
-
return
|
|
6010
|
+
return _context53.abrupt("return", {
|
|
5339
6011
|
projection: projection,
|
|
5340
6012
|
prepareParams: normalizedPrepareParams,
|
|
5341
6013
|
orderRevision: orderRevision
|
|
5342
6014
|
});
|
|
5343
6015
|
case 26:
|
|
5344
6016
|
case "end":
|
|
5345
|
-
return
|
|
6017
|
+
return _context53.stop();
|
|
5346
6018
|
}
|
|
5347
|
-
},
|
|
6019
|
+
}, _callee53, this);
|
|
5348
6020
|
}));
|
|
5349
|
-
function buildAvailabilityProjectionSnapshot(
|
|
6021
|
+
function buildAvailabilityProjectionSnapshot(_x41) {
|
|
5350
6022
|
return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
|
|
5351
6023
|
}
|
|
5352
6024
|
return buildAvailabilityProjectionSnapshot;
|
|
@@ -5354,10 +6026,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5354
6026
|
}, {
|
|
5355
6027
|
key: "getSharedPreparedAvailabilitySnapshot",
|
|
5356
6028
|
value: function () {
|
|
5357
|
-
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6029
|
+
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(params) {
|
|
5358
6030
|
var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
|
|
5359
|
-
return _regeneratorRuntime().wrap(function
|
|
5360
|
-
while (1) switch (
|
|
6031
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
6032
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
5361
6033
|
case 0:
|
|
5362
6034
|
lifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
5363
6035
|
normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
@@ -5376,15 +6048,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5376
6048
|
}
|
|
5377
6049
|
})) : this.buildAvailabilityPrepareKey(normalizedParams);
|
|
5378
6050
|
if (!hasRawInputs) {
|
|
5379
|
-
|
|
6051
|
+
_context54.next = 11;
|
|
5380
6052
|
break;
|
|
5381
6053
|
}
|
|
5382
|
-
|
|
6054
|
+
_context54.next = 7;
|
|
5383
6055
|
return this.buildAvailabilityProjectionSnapshot(normalizedParams);
|
|
5384
6056
|
case 7:
|
|
5385
|
-
snapshot =
|
|
6057
|
+
snapshot = _context54.sent;
|
|
5386
6058
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
5387
|
-
|
|
6059
|
+
_context54.next = 10;
|
|
5388
6060
|
break;
|
|
5389
6061
|
}
|
|
5390
6062
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -5393,7 +6065,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5393
6065
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
5394
6066
|
});
|
|
5395
6067
|
case 10:
|
|
5396
|
-
return
|
|
6068
|
+
return _context54.abrupt("return", {
|
|
5397
6069
|
prepareKey: prepareKey,
|
|
5398
6070
|
snapshot: snapshot
|
|
5399
6071
|
});
|
|
@@ -5407,13 +6079,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5407
6079
|
promise: promise
|
|
5408
6080
|
});
|
|
5409
6081
|
}
|
|
5410
|
-
|
|
5411
|
-
|
|
6082
|
+
_context54.prev = 14;
|
|
6083
|
+
_context54.next = 17;
|
|
5412
6084
|
return promise;
|
|
5413
6085
|
case 17:
|
|
5414
|
-
_snapshot =
|
|
6086
|
+
_snapshot = _context54.sent;
|
|
5415
6087
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
5416
|
-
|
|
6088
|
+
_context54.next = 20;
|
|
5417
6089
|
break;
|
|
5418
6090
|
}
|
|
5419
6091
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -5422,24 +6094,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5422
6094
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
5423
6095
|
});
|
|
5424
6096
|
case 20:
|
|
5425
|
-
return
|
|
6097
|
+
return _context54.abrupt("return", {
|
|
5426
6098
|
prepareKey: prepareKey,
|
|
5427
6099
|
snapshot: _snapshot
|
|
5428
6100
|
});
|
|
5429
6101
|
case 21:
|
|
5430
|
-
|
|
6102
|
+
_context54.prev = 21;
|
|
5431
6103
|
current = this.availabilityPrepareInFlight.get(prepareKey);
|
|
5432
6104
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
5433
6105
|
this.availabilityPrepareInFlight.delete(prepareKey);
|
|
5434
6106
|
}
|
|
5435
|
-
return
|
|
6107
|
+
return _context54.finish(21);
|
|
5436
6108
|
case 25:
|
|
5437
6109
|
case "end":
|
|
5438
|
-
return
|
|
6110
|
+
return _context54.stop();
|
|
5439
6111
|
}
|
|
5440
|
-
},
|
|
6112
|
+
}, _callee54, this, [[14,, 21, 25]]);
|
|
5441
6113
|
}));
|
|
5442
|
-
function getSharedPreparedAvailabilitySnapshot(
|
|
6114
|
+
function getSharedPreparedAvailabilitySnapshot(_x42) {
|
|
5443
6115
|
return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
|
|
5444
6116
|
}
|
|
5445
6117
|
return getSharedPreparedAvailabilitySnapshot;
|
|
@@ -5447,51 +6119,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5447
6119
|
}, {
|
|
5448
6120
|
key: "refreshAvailabilityContextProjection",
|
|
5449
6121
|
value: function () {
|
|
5450
|
-
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5451
|
-
var
|
|
6122
|
+
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
|
|
6123
|
+
var _this25 = this;
|
|
5452
6124
|
var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
|
|
5453
|
-
return _regeneratorRuntime().wrap(function
|
|
5454
|
-
while (1) switch (
|
|
6125
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
6126
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
5455
6127
|
case 0:
|
|
5456
6128
|
existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
5457
6129
|
if (!existingInFlight) {
|
|
5458
|
-
|
|
6130
|
+
_context56.next = 5;
|
|
5459
6131
|
break;
|
|
5460
6132
|
}
|
|
5461
|
-
|
|
6133
|
+
_context56.next = 4;
|
|
5462
6134
|
return existingInFlight;
|
|
5463
6135
|
case 4:
|
|
5464
|
-
return
|
|
6136
|
+
return _context56.abrupt("return", _context56.sent);
|
|
5465
6137
|
case 5:
|
|
5466
6138
|
context = this.getAvailabilityContextEntry(params.contextId);
|
|
5467
6139
|
expectedVersion = context.activeVersion;
|
|
5468
6140
|
expectedRefreshNonce = context.refreshNonce;
|
|
5469
6141
|
expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
5470
|
-
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6142
|
+
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
|
|
5471
6143
|
var snapshot, currentContext, projectionEntry;
|
|
5472
|
-
return _regeneratorRuntime().wrap(function
|
|
5473
|
-
while (1) switch (
|
|
6144
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
6145
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
5474
6146
|
case 0:
|
|
5475
|
-
|
|
5476
|
-
return
|
|
6147
|
+
_context55.next = 2;
|
|
6148
|
+
return _this25.buildAvailabilityProjectionSnapshot(_this25.cloneAvailabilityPrepareParams(context.prepareParams), {
|
|
5477
6149
|
durationCandidateAnchorAt: context.durationCandidateAnchorAt
|
|
5478
6150
|
});
|
|
5479
6151
|
case 2:
|
|
5480
|
-
snapshot =
|
|
5481
|
-
currentContext =
|
|
6152
|
+
snapshot = _context55.sent;
|
|
6153
|
+
currentContext = _this25.availabilityContextRegistry.get(params.contextId);
|
|
5482
6154
|
if (currentContext) {
|
|
5483
|
-
|
|
6155
|
+
_context55.next = 6;
|
|
5484
6156
|
break;
|
|
5485
6157
|
}
|
|
5486
|
-
return
|
|
6158
|
+
return _context55.abrupt("return", null);
|
|
5487
6159
|
case 6:
|
|
5488
|
-
if (!(expectedLifecycleGeneration !==
|
|
5489
|
-
|
|
6160
|
+
if (!(expectedLifecycleGeneration !== _this25.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
|
|
6161
|
+
_context55.next = 8;
|
|
5490
6162
|
break;
|
|
5491
6163
|
}
|
|
5492
|
-
return
|
|
6164
|
+
return _context55.abrupt("return", null);
|
|
5493
6165
|
case 8:
|
|
5494
|
-
projectionEntry =
|
|
6166
|
+
projectionEntry = _this25.storeAvailabilityProjectionEntry({
|
|
5495
6167
|
contextId: currentContext.contextId,
|
|
5496
6168
|
prepareParams: snapshot.prepareParams,
|
|
5497
6169
|
prepareKey: currentContext.prepareKey,
|
|
@@ -5499,8 +6171,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5499
6171
|
orderRevision: snapshot.orderRevision,
|
|
5500
6172
|
incrementVersion: true
|
|
5501
6173
|
});
|
|
5502
|
-
|
|
5503
|
-
return
|
|
6174
|
+
_context55.next = 11;
|
|
6175
|
+
return _this25.emitAvailabilityDiagnostic({
|
|
5504
6176
|
action: 'refresh',
|
|
5505
6177
|
contextId: currentContext.contextId,
|
|
5506
6178
|
contextVersion: projectionEntry.contextVersion,
|
|
@@ -5511,33 +6183,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5511
6183
|
reason: params.reason
|
|
5512
6184
|
});
|
|
5513
6185
|
case 11:
|
|
5514
|
-
return
|
|
6186
|
+
return _context55.abrupt("return", projectionEntry);
|
|
5515
6187
|
case 12:
|
|
5516
6188
|
case "end":
|
|
5517
|
-
return
|
|
6189
|
+
return _context55.stop();
|
|
5518
6190
|
}
|
|
5519
|
-
},
|
|
6191
|
+
}, _callee55);
|
|
5520
6192
|
}))();
|
|
5521
6193
|
this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
|
|
5522
|
-
|
|
5523
|
-
|
|
6194
|
+
_context56.prev = 11;
|
|
6195
|
+
_context56.next = 14;
|
|
5524
6196
|
return refreshPromise;
|
|
5525
6197
|
case 14:
|
|
5526
|
-
return
|
|
6198
|
+
return _context56.abrupt("return", _context56.sent);
|
|
5527
6199
|
case 15:
|
|
5528
|
-
|
|
6200
|
+
_context56.prev = 15;
|
|
5529
6201
|
current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
5530
6202
|
if (current === refreshPromise) {
|
|
5531
6203
|
this.availabilityProjectionRefreshInFlight.delete(params.contextId);
|
|
5532
6204
|
}
|
|
5533
|
-
return
|
|
6205
|
+
return _context56.finish(15);
|
|
5534
6206
|
case 19:
|
|
5535
6207
|
case "end":
|
|
5536
|
-
return
|
|
6208
|
+
return _context56.stop();
|
|
5537
6209
|
}
|
|
5538
|
-
},
|
|
6210
|
+
}, _callee56, this, [[11,, 15, 19]]);
|
|
5539
6211
|
}));
|
|
5540
|
-
function refreshAvailabilityContextProjection(
|
|
6212
|
+
function refreshAvailabilityContextProjection(_x43) {
|
|
5541
6213
|
return _refreshAvailabilityContextProjection.apply(this, arguments);
|
|
5542
6214
|
}
|
|
5543
6215
|
return refreshAvailabilityContextProjection;
|
|
@@ -5545,53 +6217,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5545
6217
|
}, {
|
|
5546
6218
|
key: "ensureAvailabilityContextProjection",
|
|
5547
6219
|
value: function () {
|
|
5548
|
-
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6220
|
+
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(contextId, reason) {
|
|
5549
6221
|
var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
|
|
5550
|
-
return _regeneratorRuntime().wrap(function
|
|
5551
|
-
while (1) switch (
|
|
6222
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
|
6223
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
5552
6224
|
case 0:
|
|
5553
6225
|
retries = 0;
|
|
5554
6226
|
case 1:
|
|
5555
6227
|
if (!(retries < 3)) {
|
|
5556
|
-
|
|
6228
|
+
_context57.next = 19;
|
|
5557
6229
|
break;
|
|
5558
6230
|
}
|
|
5559
6231
|
context = this.getAvailabilityContextEntry(contextId);
|
|
5560
6232
|
currentOrderRevision = this.getCurrentOrderRevision();
|
|
5561
6233
|
projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
|
|
5562
6234
|
if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
|
|
5563
|
-
|
|
6235
|
+
_context57.next = 7;
|
|
5564
6236
|
break;
|
|
5565
6237
|
}
|
|
5566
|
-
return
|
|
6238
|
+
return _context57.abrupt("return", {
|
|
5567
6239
|
context: context,
|
|
5568
6240
|
projectionEntry: projectionEntry,
|
|
5569
6241
|
refreshed: false
|
|
5570
6242
|
});
|
|
5571
6243
|
case 7:
|
|
5572
|
-
|
|
6244
|
+
_context57.next = 9;
|
|
5573
6245
|
return this.refreshAvailabilityContextProjection({
|
|
5574
6246
|
contextId: contextId,
|
|
5575
6247
|
reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
|
|
5576
6248
|
previousOrderRevision: context.lastKnownOrderRevision
|
|
5577
6249
|
});
|
|
5578
6250
|
case 9:
|
|
5579
|
-
refreshedProjectionEntry =
|
|
6251
|
+
refreshedProjectionEntry = _context57.sent;
|
|
5580
6252
|
if (refreshedProjectionEntry) {
|
|
5581
|
-
|
|
6253
|
+
_context57.next = 13;
|
|
5582
6254
|
break;
|
|
5583
6255
|
}
|
|
5584
6256
|
retries += 1;
|
|
5585
|
-
return
|
|
6257
|
+
return _context57.abrupt("continue", 1);
|
|
5586
6258
|
case 13:
|
|
5587
6259
|
if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
5588
|
-
|
|
6260
|
+
_context57.next = 16;
|
|
5589
6261
|
break;
|
|
5590
6262
|
}
|
|
5591
6263
|
retries += 1;
|
|
5592
|
-
return
|
|
6264
|
+
return _context57.abrupt("continue", 1);
|
|
5593
6265
|
case 16:
|
|
5594
|
-
return
|
|
6266
|
+
return _context57.abrupt("return", {
|
|
5595
6267
|
context: this.getAvailabilityContextEntry(contextId),
|
|
5596
6268
|
projectionEntry: refreshedProjectionEntry,
|
|
5597
6269
|
refreshed: true
|
|
@@ -5603,11 +6275,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5603
6275
|
});
|
|
5604
6276
|
case 20:
|
|
5605
6277
|
case "end":
|
|
5606
|
-
return
|
|
6278
|
+
return _context57.stop();
|
|
5607
6279
|
}
|
|
5608
|
-
},
|
|
6280
|
+
}, _callee57, this);
|
|
5609
6281
|
}));
|
|
5610
|
-
function ensureAvailabilityContextProjection(
|
|
6282
|
+
function ensureAvailabilityContextProjection(_x44, _x45) {
|
|
5611
6283
|
return _ensureAvailabilityContextProjection.apply(this, arguments);
|
|
5612
6284
|
}
|
|
5613
6285
|
return ensureAvailabilityContextProjection;
|
|
@@ -5615,18 +6287,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5615
6287
|
}, {
|
|
5616
6288
|
key: "tryAcquireAvailabilityCommitLock",
|
|
5617
6289
|
value: function () {
|
|
5618
|
-
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6290
|
+
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(contextId) {
|
|
5619
6291
|
var _currentContext$activ;
|
|
5620
6292
|
var _waitingContext$activ, waitingContext, currentContext;
|
|
5621
|
-
return _regeneratorRuntime().wrap(function
|
|
5622
|
-
while (1) switch (
|
|
6293
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
|
6294
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
5623
6295
|
case 0:
|
|
5624
6296
|
if (!this.availabilityCommitLocks.has(contextId)) {
|
|
5625
|
-
|
|
6297
|
+
_context58.next = 5;
|
|
5626
6298
|
break;
|
|
5627
6299
|
}
|
|
5628
6300
|
waitingContext = this.availabilityContextRegistry.get(contextId);
|
|
5629
|
-
|
|
6301
|
+
_context58.next = 4;
|
|
5630
6302
|
return this.emitAvailabilityDiagnostic({
|
|
5631
6303
|
action: 'commit_lock_wait',
|
|
5632
6304
|
contextId: contextId,
|
|
@@ -5643,7 +6315,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5643
6315
|
case 5:
|
|
5644
6316
|
this.availabilityCommitLocks.add(contextId);
|
|
5645
6317
|
currentContext = this.availabilityContextRegistry.get(contextId);
|
|
5646
|
-
|
|
6318
|
+
_context58.next = 9;
|
|
5647
6319
|
return this.emitAvailabilityDiagnostic({
|
|
5648
6320
|
action: 'commit_lock_acquired',
|
|
5649
6321
|
contextId: contextId,
|
|
@@ -5655,11 +6327,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5655
6327
|
});
|
|
5656
6328
|
case 9:
|
|
5657
6329
|
case "end":
|
|
5658
|
-
return
|
|
6330
|
+
return _context58.stop();
|
|
5659
6331
|
}
|
|
5660
|
-
},
|
|
6332
|
+
}, _callee58, this);
|
|
5661
6333
|
}));
|
|
5662
|
-
function tryAcquireAvailabilityCommitLock(
|
|
6334
|
+
function tryAcquireAvailabilityCommitLock(_x46) {
|
|
5663
6335
|
return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
|
|
5664
6336
|
}
|
|
5665
6337
|
return tryAcquireAvailabilityCommitLock;
|
|
@@ -5667,15 +6339,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5667
6339
|
}, {
|
|
5668
6340
|
key: "releaseAvailabilityCommitLock",
|
|
5669
6341
|
value: function () {
|
|
5670
|
-
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6342
|
+
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(contextId) {
|
|
5671
6343
|
var _releasedContext$acti;
|
|
5672
6344
|
var releasedContext;
|
|
5673
|
-
return _regeneratorRuntime().wrap(function
|
|
5674
|
-
while (1) switch (
|
|
6345
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
|
6346
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
5675
6347
|
case 0:
|
|
5676
6348
|
this.availabilityCommitLocks.delete(contextId);
|
|
5677
6349
|
releasedContext = this.availabilityContextRegistry.get(contextId);
|
|
5678
|
-
|
|
6350
|
+
_context59.next = 4;
|
|
5679
6351
|
return this.emitAvailabilityDiagnostic({
|
|
5680
6352
|
action: 'commit_lock_released',
|
|
5681
6353
|
contextId: contextId,
|
|
@@ -5687,11 +6359,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5687
6359
|
});
|
|
5688
6360
|
case 4:
|
|
5689
6361
|
case "end":
|
|
5690
|
-
return
|
|
6362
|
+
return _context59.stop();
|
|
5691
6363
|
}
|
|
5692
|
-
},
|
|
6364
|
+
}, _callee59, this);
|
|
5693
6365
|
}));
|
|
5694
|
-
function releaseAvailabilityCommitLock(
|
|
6366
|
+
function releaseAvailabilityCommitLock(_x47) {
|
|
5695
6367
|
return _releaseAvailabilityCommitLock.apply(this, arguments);
|
|
5696
6368
|
}
|
|
5697
6369
|
return releaseAvailabilityCommitLock;
|
|
@@ -5699,20 +6371,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5699
6371
|
}, {
|
|
5700
6372
|
key: "prepareAvailabilityProjection",
|
|
5701
6373
|
value: (function () {
|
|
5702
|
-
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6374
|
+
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
|
|
5703
6375
|
var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
|
|
5704
|
-
return _regeneratorRuntime().wrap(function
|
|
5705
|
-
while (1) switch (
|
|
6376
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
|
6377
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
5706
6378
|
case 0:
|
|
5707
6379
|
this.assertAvailabilityPrepareParams(params);
|
|
5708
|
-
|
|
6380
|
+
_context60.next = 3;
|
|
5709
6381
|
return this.resolveAvailabilityPrepareDefaults(params);
|
|
5710
6382
|
case 3:
|
|
5711
|
-
paramsWithDefaults =
|
|
5712
|
-
|
|
6383
|
+
paramsWithDefaults = _context60.sent;
|
|
6384
|
+
_context60.next = 6;
|
|
5713
6385
|
return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
|
|
5714
6386
|
case 6:
|
|
5715
|
-
_yield$this$getShared =
|
|
6387
|
+
_yield$this$getShared = _context60.sent;
|
|
5716
6388
|
prepareKey = _yield$this$getShared.prepareKey;
|
|
5717
6389
|
snapshot = _yield$this$getShared.snapshot;
|
|
5718
6390
|
contextId = this.createAvailabilityContextId();
|
|
@@ -5733,7 +6405,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5733
6405
|
refreshed: false,
|
|
5734
6406
|
reason: 'prepare'
|
|
5735
6407
|
};
|
|
5736
|
-
|
|
6408
|
+
_context60.next = 16;
|
|
5737
6409
|
return this.emitAvailabilityDiagnostic({
|
|
5738
6410
|
action: 'prepare',
|
|
5739
6411
|
contextId: contextId,
|
|
@@ -5744,17 +6416,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5744
6416
|
reason: 'prepare'
|
|
5745
6417
|
});
|
|
5746
6418
|
case 16:
|
|
5747
|
-
|
|
6419
|
+
_context60.next = 18;
|
|
5748
6420
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
|
|
5749
6421
|
case 18:
|
|
5750
|
-
return
|
|
6422
|
+
return _context60.abrupt("return", handle);
|
|
5751
6423
|
case 19:
|
|
5752
6424
|
case "end":
|
|
5753
|
-
return
|
|
6425
|
+
return _context60.stop();
|
|
5754
6426
|
}
|
|
5755
|
-
},
|
|
6427
|
+
}, _callee60, this);
|
|
5756
6428
|
}));
|
|
5757
|
-
function prepareAvailabilityProjection(
|
|
6429
|
+
function prepareAvailabilityProjection(_x48) {
|
|
5758
6430
|
return _prepareAvailabilityProjection.apply(this, arguments);
|
|
5759
6431
|
}
|
|
5760
6432
|
return prepareAvailabilityProjection;
|
|
@@ -5762,10 +6434,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5762
6434
|
}, {
|
|
5763
6435
|
key: "getProductTimeRanges",
|
|
5764
6436
|
value: (function () {
|
|
5765
|
-
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6437
|
+
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(contextId) {
|
|
5766
6438
|
var _this$otherParams$pla,
|
|
5767
|
-
_this$
|
|
5768
|
-
|
|
6439
|
+
_this$otherParams38,
|
|
6440
|
+
_this26 = this;
|
|
5769
6441
|
var request,
|
|
5770
6442
|
_yield$this$ensureAva,
|
|
5771
6443
|
context,
|
|
@@ -5774,24 +6446,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5774
6446
|
strictAvailability,
|
|
5775
6447
|
isPosAvailabilityRequest,
|
|
5776
6448
|
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
5777
|
-
|
|
5778
|
-
return _regeneratorRuntime().wrap(function
|
|
5779
|
-
while (1) switch (
|
|
6449
|
+
_args61 = arguments;
|
|
6450
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
|
6451
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
5780
6452
|
case 0:
|
|
5781
|
-
request =
|
|
5782
|
-
|
|
6453
|
+
request = _args61.length > 1 && _args61[1] !== undefined ? _args61[1] : {};
|
|
6454
|
+
_context61.next = 3;
|
|
5783
6455
|
return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
|
|
5784
6456
|
case 3:
|
|
5785
|
-
_yield$this$ensureAva =
|
|
6457
|
+
_yield$this$ensureAva = _context61.sent;
|
|
5786
6458
|
context = _yield$this$ensureAva.context;
|
|
5787
6459
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
5788
6460
|
contextVersion = context.activeVersion;
|
|
5789
6461
|
strictAvailability = context.prepareParams.strictAvailability === true;
|
|
5790
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$
|
|
6462
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase() === 'pos';
|
|
5791
6463
|
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && !strictAvailability && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
5792
6464
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
5793
6465
|
});
|
|
5794
|
-
return
|
|
6466
|
+
return _context61.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
|
|
5795
6467
|
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
5796
6468
|
} : {}), strictAvailability ? {
|
|
5797
6469
|
allowOutsideOperatingHoursForRequestedStartTimes: false
|
|
@@ -5803,17 +6475,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5803
6475
|
}).map(function (group) {
|
|
5804
6476
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
5805
6477
|
ranges: group.ranges.map(function (candidate) {
|
|
5806
|
-
return
|
|
6478
|
+
return _this26.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
|
|
5807
6479
|
})
|
|
5808
6480
|
});
|
|
5809
6481
|
}));
|
|
5810
6482
|
case 11:
|
|
5811
6483
|
case "end":
|
|
5812
|
-
return
|
|
6484
|
+
return _context61.stop();
|
|
5813
6485
|
}
|
|
5814
|
-
},
|
|
6486
|
+
}, _callee61, this);
|
|
5815
6487
|
}));
|
|
5816
|
-
function getProductTimeRanges(
|
|
6488
|
+
function getProductTimeRanges(_x49) {
|
|
5817
6489
|
return _getProductTimeRanges.apply(this, arguments);
|
|
5818
6490
|
}
|
|
5819
6491
|
return getProductTimeRanges;
|
|
@@ -5821,22 +6493,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5821
6493
|
}, {
|
|
5822
6494
|
key: "queryBookingAvailability",
|
|
5823
6495
|
value: (function () {
|
|
5824
|
-
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5825
|
-
var _this$otherParams$pla2, _this$
|
|
6496
|
+
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(contextId, request) {
|
|
6497
|
+
var _this$otherParams$pla2, _this$otherParams39;
|
|
5826
6498
|
var _yield$this$ensureAva2, context, projectionEntry, refreshed, strictAvailability, isPosAvailabilityRequest, result, contextVersion, contextualResult;
|
|
5827
|
-
return _regeneratorRuntime().wrap(function
|
|
5828
|
-
while (1) switch (
|
|
6499
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
6500
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
5829
6501
|
case 0:
|
|
5830
|
-
|
|
6502
|
+
_context62.next = 2;
|
|
5831
6503
|
return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
|
|
5832
6504
|
case 2:
|
|
5833
|
-
_yield$this$ensureAva2 =
|
|
6505
|
+
_yield$this$ensureAva2 = _context62.sent;
|
|
5834
6506
|
context = _yield$this$ensureAva2.context;
|
|
5835
6507
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
5836
6508
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
5837
6509
|
this.assertContextualQueryFreshness(context, request);
|
|
5838
6510
|
strictAvailability = context.prepareParams.strictAvailability === true;
|
|
5839
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$
|
|
6511
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
5840
6512
|
result = queryAvailabilityProjection(projectionEntry.projection, request, {
|
|
5841
6513
|
useExactDurationCandidateMinute: isPosAvailabilityRequest && !strictAvailability,
|
|
5842
6514
|
allowExcludedScheduleDateOverride: isPosAvailabilityRequest && !strictAvailability
|
|
@@ -5867,18 +6539,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5867
6539
|
});
|
|
5868
6540
|
})
|
|
5869
6541
|
}) : result;
|
|
5870
|
-
return
|
|
6542
|
+
return _context62.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
|
|
5871
6543
|
contextId: context.contextId,
|
|
5872
6544
|
contextVersion: contextVersion,
|
|
5873
6545
|
refreshed: refreshed
|
|
5874
6546
|
}));
|
|
5875
6547
|
case 13:
|
|
5876
6548
|
case "end":
|
|
5877
|
-
return
|
|
6549
|
+
return _context62.stop();
|
|
5878
6550
|
}
|
|
5879
|
-
},
|
|
6551
|
+
}, _callee62, this);
|
|
5880
6552
|
}));
|
|
5881
|
-
function queryBookingAvailability(
|
|
6553
|
+
function queryBookingAvailability(_x50, _x51) {
|
|
5882
6554
|
return _queryBookingAvailability.apply(this, arguments);
|
|
5883
6555
|
}
|
|
5884
6556
|
return queryBookingAvailability;
|
|
@@ -5949,9 +6621,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5949
6621
|
}, {
|
|
5950
6622
|
key: "findLinkedBooking",
|
|
5951
6623
|
value: function findLinkedBooking(product) {
|
|
5952
|
-
var
|
|
6624
|
+
var _ref59, _product$booking_uid3, _product$metadata7, _this$getTempOrder4;
|
|
5953
6625
|
var productUid = getProductLineUid(product);
|
|
5954
|
-
var bookingUid = String((
|
|
6626
|
+
var bookingUid = String((_ref59 = (_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 && _ref59 !== void 0 ? _ref59 : '');
|
|
5955
6627
|
return (((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.bookings) || []).find(function (booking) {
|
|
5956
6628
|
var _booking$product_uid3;
|
|
5957
6629
|
return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
|
|
@@ -5962,19 +6634,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5962
6634
|
}, {
|
|
5963
6635
|
key: "commitAvailabilitySelection",
|
|
5964
6636
|
value: (function () {
|
|
5965
|
-
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6637
|
+
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(contextId, params) {
|
|
5966
6638
|
var _this$availabilityCon,
|
|
5967
6639
|
_params$availabilityC3,
|
|
5968
6640
|
_this$store$order11,
|
|
5969
6641
|
_this$store$order11$e,
|
|
5970
|
-
|
|
5971
|
-
var normalizedContextId, isEditingSelection, isPartyReplacement, strictAvailability, hasCommitGuard, guardedOrder, getGuardedCommitIdentity, guardedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount,
|
|
5972
|
-
return _regeneratorRuntime().wrap(function
|
|
5973
|
-
while (1) switch (
|
|
6642
|
+
_this27 = this;
|
|
6643
|
+
var normalizedContextId, isEditingSelection, isPartyReplacement, strictAvailability, hasCommitGuard, guardedOrder, getGuardedCommitIdentity, guardedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref60, _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$otherParams40, _params$orderProduct$3, _params$orderProduct6, _existingBooking$hold, _existingBooking$meta, _ref61, _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, _ref62, _transformed$product_4, update, _this$getTempOrder5, _this$getTempOrder6, _params$salesNotes, _params$salesNotes2, _ref63, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
|
|
6644
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6645
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
5974
6646
|
case 0:
|
|
5975
6647
|
normalizedContextId = String(contextId || '').trim();
|
|
5976
6648
|
if (normalizedContextId) {
|
|
5977
|
-
|
|
6649
|
+
_context63.next = 3;
|
|
5978
6650
|
break;
|
|
5979
6651
|
}
|
|
5980
6652
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
|
|
@@ -5984,7 +6656,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5984
6656
|
isEditingSelection = params.mode === 'edit' || params.mode === 'replace';
|
|
5985
6657
|
isPartyReplacement = params.mode === 'replace' || params.relatedRetailProducts !== undefined;
|
|
5986
6658
|
if (!(isPartyReplacement && (!isEditingSelection || !Array.isArray(params.relatedRetailProducts)))) {
|
|
5987
|
-
|
|
6659
|
+
_context63.next = 7;
|
|
5988
6660
|
break;
|
|
5989
6661
|
}
|
|
5990
6662
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'Party replacement requires edit/replace mode and the confirmed complete extras array');
|
|
@@ -5996,27 +6668,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5996
6668
|
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);
|
|
5997
6669
|
guardedOrder = hasCommitGuard ? this.getTempOrder() : null;
|
|
5998
6670
|
getGuardedCommitIdentity = function getGuardedCommitIdentity() {
|
|
5999
|
-
var
|
|
6671
|
+
var _this27$otherParams$s, _this27$otherParams, _this27$otherParams2, _this27$core, _this27$getTempOrder, _this27$getTempOrder2;
|
|
6000
6672
|
return JSON.stringify(stableValue({
|
|
6001
|
-
scope:
|
|
6002
|
-
shopId: (
|
|
6003
|
-
contextShopId: (
|
|
6004
|
-
orderId: (
|
|
6005
|
-
externalSaleNumber: (
|
|
6673
|
+
scope: _this27.getAvailabilityScopeDescriptor(),
|
|
6674
|
+
shopId: (_this27$otherParams$s = (_this27$otherParams = _this27.otherParams) === null || _this27$otherParams === void 0 ? void 0 : _this27$otherParams.shop_id) !== null && _this27$otherParams$s !== void 0 ? _this27$otherParams$s : (_this27$otherParams2 = _this27.otherParams) === null || _this27$otherParams2 === void 0 ? void 0 : _this27$otherParams2.shopId,
|
|
6675
|
+
contextShopId: (_this27$core = _this27.core) === null || _this27$core === void 0 || (_this27$core = _this27$core.context) === null || _this27$core === void 0 ? void 0 : _this27$core.shop_id,
|
|
6676
|
+
orderId: (_this27$getTempOrder = _this27.getTempOrder()) === null || _this27$getTempOrder === void 0 ? void 0 : _this27$getTempOrder.order_id,
|
|
6677
|
+
externalSaleNumber: (_this27$getTempOrder2 = _this27.getTempOrder()) === null || _this27$getTempOrder2 === void 0 ? void 0 : _this27$getTempOrder2.external_sale_number
|
|
6006
6678
|
}));
|
|
6007
6679
|
};
|
|
6008
6680
|
guardedCommitIdentity = hasCommitGuard ? getGuardedCommitIdentity() : '';
|
|
6009
6681
|
availabilityCommitTargetGuard = function availabilityCommitTargetGuard() {
|
|
6010
|
-
return
|
|
6682
|
+
return _this27.getTempOrder() === guardedOrder && getGuardedCommitIdentity() === guardedCommitIdentity;
|
|
6011
6683
|
};
|
|
6012
6684
|
guardedCommitPublished = false;
|
|
6013
|
-
|
|
6685
|
+
_context63.next = 18;
|
|
6014
6686
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
6015
6687
|
case 18:
|
|
6016
|
-
|
|
6688
|
+
_context63.prev = 18;
|
|
6017
6689
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
6018
6690
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
6019
|
-
|
|
6691
|
+
_context63.next = 22;
|
|
6020
6692
|
break;
|
|
6021
6693
|
}
|
|
6022
6694
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
@@ -6024,16 +6696,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6024
6696
|
});
|
|
6025
6697
|
case 22:
|
|
6026
6698
|
if (!(isEditingSelection && bookingCount !== 1)) {
|
|
6027
|
-
|
|
6699
|
+
_context63.next = 24;
|
|
6028
6700
|
break;
|
|
6029
6701
|
}
|
|
6030
6702
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
6031
6703
|
bookingCount: bookingCount
|
|
6032
6704
|
});
|
|
6033
6705
|
case 24:
|
|
6034
|
-
orderProductQuantity = (
|
|
6706
|
+
orderProductQuantity = (_ref60 = (_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 && _ref60 !== void 0 ? _ref60 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
|
|
6035
6707
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
6036
|
-
|
|
6708
|
+
_context63.next = 27;
|
|
6037
6709
|
break;
|
|
6038
6710
|
}
|
|
6039
6711
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
@@ -6043,22 +6715,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6043
6715
|
case 27:
|
|
6044
6716
|
partySize = Number(params.partySize);
|
|
6045
6717
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
6046
|
-
|
|
6718
|
+
_context63.next = 30;
|
|
6047
6719
|
break;
|
|
6048
6720
|
}
|
|
6049
6721
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
6050
6722
|
partySize: params.partySize
|
|
6051
6723
|
});
|
|
6052
6724
|
case 30:
|
|
6053
|
-
|
|
6725
|
+
_context63.next = 32;
|
|
6054
6726
|
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
6055
6727
|
case 32:
|
|
6056
|
-
_yield$this$ensureAva3 =
|
|
6728
|
+
_yield$this$ensureAva3 = _context63.sent;
|
|
6057
6729
|
context = _yield$this$ensureAva3.context;
|
|
6058
6730
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
6059
6731
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
6060
6732
|
if (!refreshed) {
|
|
6061
|
-
|
|
6733
|
+
_context63.next = 38;
|
|
6062
6734
|
break;
|
|
6063
6735
|
}
|
|
6064
6736
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -6069,11 +6741,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6069
6741
|
case 38:
|
|
6070
6742
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
6071
6743
|
if (!isEditingSelection) {
|
|
6072
|
-
|
|
6744
|
+
_context63.next = 44;
|
|
6073
6745
|
break;
|
|
6074
6746
|
}
|
|
6075
6747
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
6076
|
-
|
|
6748
|
+
_context63.next = 42;
|
|
6077
6749
|
break;
|
|
6078
6750
|
}
|
|
6079
6751
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -6082,11 +6754,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6082
6754
|
editingProductLineUids: boundEditingUids
|
|
6083
6755
|
});
|
|
6084
6756
|
case 42:
|
|
6085
|
-
|
|
6757
|
+
_context63.next = 46;
|
|
6086
6758
|
break;
|
|
6087
6759
|
case 44:
|
|
6088
6760
|
if (!(boundEditingUids.length > 0)) {
|
|
6089
|
-
|
|
6761
|
+
_context63.next = 46;
|
|
6090
6762
|
break;
|
|
6091
6763
|
}
|
|
6092
6764
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
@@ -6095,7 +6767,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6095
6767
|
});
|
|
6096
6768
|
case 46:
|
|
6097
6769
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
6098
|
-
|
|
6770
|
+
_context63.next = 48;
|
|
6099
6771
|
break;
|
|
6100
6772
|
}
|
|
6101
6773
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -6105,7 +6777,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6105
6777
|
});
|
|
6106
6778
|
case 48:
|
|
6107
6779
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
6108
|
-
|
|
6780
|
+
_context63.next = 50;
|
|
6109
6781
|
break;
|
|
6110
6782
|
}
|
|
6111
6783
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -6116,7 +6788,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6116
6788
|
});
|
|
6117
6789
|
case 50:
|
|
6118
6790
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
6119
|
-
|
|
6791
|
+
_context63.next = 52;
|
|
6120
6792
|
break;
|
|
6121
6793
|
}
|
|
6122
6794
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -6128,7 +6800,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6128
6800
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
6129
6801
|
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;
|
|
6130
6802
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
6131
|
-
|
|
6803
|
+
_context63.next = 56;
|
|
6132
6804
|
break;
|
|
6133
6805
|
}
|
|
6134
6806
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
@@ -6137,14 +6809,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6137
6809
|
});
|
|
6138
6810
|
case 56:
|
|
6139
6811
|
if (!(isEditingSelection && !params.productLineUid)) {
|
|
6140
|
-
|
|
6812
|
+
_context63.next = 58;
|
|
6141
6813
|
break;
|
|
6142
6814
|
}
|
|
6143
6815
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
6144
6816
|
case 58:
|
|
6145
6817
|
editingLine = isEditingSelection ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
6146
6818
|
if (!(isEditingSelection && !editingLine)) {
|
|
6147
|
-
|
|
6819
|
+
_context63.next = 61;
|
|
6148
6820
|
break;
|
|
6149
6821
|
}
|
|
6150
6822
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
@@ -6152,7 +6824,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6152
6824
|
});
|
|
6153
6825
|
case 61:
|
|
6154
6826
|
if (!(editingLine && params.mode !== 'replace' && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
6155
|
-
|
|
6827
|
+
_context63.next = 63;
|
|
6156
6828
|
break;
|
|
6157
6829
|
}
|
|
6158
6830
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -6162,7 +6834,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6162
6834
|
});
|
|
6163
6835
|
case 63:
|
|
6164
6836
|
if (Array.isArray(params.requirementSelections)) {
|
|
6165
|
-
|
|
6837
|
+
_context63.next = 65;
|
|
6166
6838
|
break;
|
|
6167
6839
|
}
|
|
6168
6840
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
@@ -6179,7 +6851,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6179
6851
|
};
|
|
6180
6852
|
prepareParams = baseProjection.meta.prepareParams;
|
|
6181
6853
|
if (prepareParams) {
|
|
6182
|
-
|
|
6854
|
+
_context63.next = 70;
|
|
6183
6855
|
break;
|
|
6184
6856
|
}
|
|
6185
6857
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
@@ -6191,7 +6863,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6191
6863
|
})),
|
|
6192
6864
|
includesInjectedRawOccupancies: true
|
|
6193
6865
|
};
|
|
6194
|
-
|
|
6866
|
+
_context63.next = 73;
|
|
6195
6867
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
6196
6868
|
editingProductLineUids: isEditingSelection && params.productLineUid ? [params.productLineUid] : []
|
|
6197
6869
|
}), {
|
|
@@ -6200,13 +6872,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6200
6872
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
6201
6873
|
});
|
|
6202
6874
|
case 73:
|
|
6203
|
-
commitSnapshot =
|
|
6875
|
+
commitSnapshot = _context63.sent;
|
|
6204
6876
|
refreshedProjection = commitSnapshot.projection;
|
|
6205
6877
|
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 : ''))) {
|
|
6206
|
-
|
|
6878
|
+
_context63.next = 80;
|
|
6207
6879
|
break;
|
|
6208
6880
|
}
|
|
6209
|
-
|
|
6881
|
+
_context63.next = 78;
|
|
6210
6882
|
return this.refreshAvailabilityContextProjection({
|
|
6211
6883
|
contextId: normalizedContextId,
|
|
6212
6884
|
reason: 'commit_order_revision_changed',
|
|
@@ -6227,7 +6899,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6227
6899
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
6228
6900
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
6229
6901
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
6230
|
-
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$
|
|
6902
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$otherParams40 = this.otherParams) === null || _this$otherParams40 === void 0 ? void 0 : _this$otherParams40.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos' && !strictAvailability;
|
|
6231
6903
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
6232
6904
|
productIds: [params.candidate.productId],
|
|
6233
6905
|
dateRange: {
|
|
@@ -6253,7 +6925,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6253
6925
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
6254
6926
|
});
|
|
6255
6927
|
if (refreshedCandidateBase) {
|
|
6256
|
-
|
|
6928
|
+
_context63.next = 88;
|
|
6257
6929
|
break;
|
|
6258
6930
|
}
|
|
6259
6931
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -6266,7 +6938,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6266
6938
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
6267
6939
|
});
|
|
6268
6940
|
if (product) {
|
|
6269
|
-
|
|
6941
|
+
_context63.next = 91;
|
|
6270
6942
|
break;
|
|
6271
6943
|
}
|
|
6272
6944
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
@@ -6303,7 +6975,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6303
6975
|
});
|
|
6304
6976
|
}
|
|
6305
6977
|
if (validation.ok) {
|
|
6306
|
-
|
|
6978
|
+
_context63.next = 96;
|
|
6307
6979
|
break;
|
|
6308
6980
|
}
|
|
6309
6981
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -6326,7 +6998,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6326
6998
|
incrementVersion: true
|
|
6327
6999
|
});
|
|
6328
7000
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
6329
|
-
|
|
7001
|
+
_context63.next = 100;
|
|
6330
7002
|
return this.emitAvailabilityDiagnostic({
|
|
6331
7003
|
action: 'refresh',
|
|
6332
7004
|
contextId: normalizedContextId,
|
|
@@ -6350,9 +7022,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6350
7022
|
availabilityCommitGuard = hasCommitGuard ? function () {
|
|
6351
7023
|
var _params$availabilityC4;
|
|
6352
7024
|
(_params$availabilityC4 = params.availabilityCommitGuard) === null || _params$availabilityC4 === void 0 || _params$availabilityC4.call(params);
|
|
6353
|
-
|
|
7025
|
+
_this27.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
6354
7026
|
if (!availabilityCommitTargetGuard()) {
|
|
6355
|
-
throw
|
|
7027
|
+
throw _this27.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '预约加购期间订单或业务已变化');
|
|
6356
7028
|
}
|
|
6357
7029
|
if (!strictAvailability) return;
|
|
6358
7030
|
var currentValidation = validateAvailabilitySelection(refreshedProjection, {
|
|
@@ -6370,7 +7042,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6370
7042
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
6371
7043
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
6372
7044
|
if (!(isEditingSelection && !existingBookingUid)) {
|
|
6373
|
-
|
|
7045
|
+
_context63.next = 107;
|
|
6374
7046
|
break;
|
|
6375
7047
|
}
|
|
6376
7048
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
@@ -6385,7 +7057,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6385
7057
|
resources: refreshedProjection.resources,
|
|
6386
7058
|
bookingUid: existingBookingUid || undefined,
|
|
6387
7059
|
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,
|
|
6388
|
-
holderIds: (
|
|
7060
|
+
holderIds: (_ref61 = (_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 && _ref61 !== void 0 ? _ref61 : 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
|
|
6389
7061
|
});
|
|
6390
7062
|
if (params.mode === 'replace') {
|
|
6391
7063
|
// A different product must not inherit the previous product/resource's completed forms.
|
|
@@ -6397,7 +7069,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6397
7069
|
quantity: bookingCount
|
|
6398
7070
|
}), 'unified_booking_sales', product);
|
|
6399
7071
|
if (transformed) {
|
|
6400
|
-
|
|
7072
|
+
_context63.next = 113;
|
|
6401
7073
|
break;
|
|
6402
7074
|
}
|
|
6403
7075
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
@@ -6418,12 +7090,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6418
7090
|
productLineUids = [];
|
|
6419
7091
|
bookingUids = [];
|
|
6420
7092
|
if (!(isPartyReplacement && editingLine && params.productLineUid)) {
|
|
6421
|
-
|
|
7093
|
+
_context63.next = 130;
|
|
6422
7094
|
break;
|
|
6423
7095
|
}
|
|
6424
7096
|
relatedRetailProducts = params.relatedRetailProducts.map(function (source) {
|
|
6425
7097
|
var _line$metadata3;
|
|
6426
|
-
var line =
|
|
7098
|
+
var line = _this27.buildUnifiedOrderProduct(source, 'unified_booking_sales_retail');
|
|
6427
7099
|
if (!line) throw new AvailabilityError('INVALID_TARGET_FILTER', '无法生成附加商品订单行');
|
|
6428
7100
|
if (((_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.venue_booking_role) === 'party_extra') {
|
|
6429
7101
|
line.holder_config = {
|
|
@@ -6444,7 +7116,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6444
7116
|
}
|
|
6445
7117
|
return line;
|
|
6446
7118
|
});
|
|
6447
|
-
|
|
7119
|
+
_context63.next = 123;
|
|
6448
7120
|
return this.store.order.replaceBookingProductWithRelatedRetail({
|
|
6449
7121
|
productLineUid: params.productLineUid,
|
|
6450
7122
|
product: transformed,
|
|
@@ -6459,11 +7131,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6459
7131
|
bookingUid = existingBookingUid;
|
|
6460
7132
|
productLineUids = [productLineUid];
|
|
6461
7133
|
bookingUids = [bookingUid];
|
|
6462
|
-
|
|
7134
|
+
_context63.next = 164;
|
|
6463
7135
|
break;
|
|
6464
7136
|
case 130:
|
|
6465
7137
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
6466
|
-
|
|
7138
|
+
_context63.next = 150;
|
|
6467
7139
|
break;
|
|
6468
7140
|
}
|
|
6469
7141
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -6475,7 +7147,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6475
7147
|
});
|
|
6476
7148
|
update = _objectSpread(_objectSpread({
|
|
6477
7149
|
product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
|
|
6478
|
-
product_variant_id: (
|
|
7150
|
+
product_variant_id: (_ref62 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref62 !== void 0 ? _ref62 : 0,
|
|
6479
7151
|
unique_identification_number: params.productLineUid,
|
|
6480
7152
|
updates: transformed,
|
|
6481
7153
|
booking: booking
|
|
@@ -6485,27 +7157,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6485
7157
|
allow_booking_discount_reapply: params.allowBookingDiscountReapply
|
|
6486
7158
|
} : {});
|
|
6487
7159
|
if (!availabilityCommitGuard) {
|
|
6488
|
-
|
|
7160
|
+
_context63.next = 142;
|
|
6489
7161
|
break;
|
|
6490
7162
|
}
|
|
6491
|
-
|
|
7163
|
+
_context63.next = 139;
|
|
6492
7164
|
return this.updateOrderProducts([update], {
|
|
6493
7165
|
beforeApply: availabilityCommitGuard,
|
|
6494
7166
|
isCurrentOrder: availabilityCommitTargetGuard
|
|
6495
7167
|
});
|
|
6496
7168
|
case 139:
|
|
6497
7169
|
guardedCommitPublished = true;
|
|
6498
|
-
|
|
7170
|
+
_context63.next = 144;
|
|
6499
7171
|
break;
|
|
6500
7172
|
case 142:
|
|
6501
|
-
|
|
7173
|
+
_context63.next = 144;
|
|
6502
7174
|
return this.updateOrderProduct(update);
|
|
6503
7175
|
case 144:
|
|
6504
7176
|
productLineUid = params.productLineUid;
|
|
6505
7177
|
bookingUid = existingBookingUid;
|
|
6506
7178
|
productLineUids = [productLineUid];
|
|
6507
7179
|
bookingUids = [bookingUid];
|
|
6508
|
-
|
|
7180
|
+
_context63.next = 164;
|
|
6509
7181
|
break;
|
|
6510
7182
|
case 150:
|
|
6511
7183
|
beforeProductLineUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || []).map(function (line) {
|
|
@@ -6515,7 +7187,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6515
7187
|
return getBookingUid(item);
|
|
6516
7188
|
}).filter(Boolean));
|
|
6517
7189
|
availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
|
|
6518
|
-
|
|
7190
|
+
_context63.next = 155;
|
|
6519
7191
|
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 ? {
|
|
6520
7192
|
salesNotes: params.salesNotes
|
|
6521
7193
|
} : {}), availabilityCommitGuard ? {
|
|
@@ -6523,7 +7195,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6523
7195
|
availabilityCommitTargetGuard: availabilityCommitTargetGuard
|
|
6524
7196
|
} : {}) : undefined);
|
|
6525
7197
|
case 155:
|
|
6526
|
-
products =
|
|
7198
|
+
products = _context63.sent;
|
|
6527
7199
|
guardedCommitPublished = hasCommitGuard;
|
|
6528
7200
|
addedLines = products.filter(function (line) {
|
|
6529
7201
|
var _line$product_id, _line$metadata4;
|
|
@@ -6532,7 +7204,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6532
7204
|
productLineUids = addedLines.map(function (line) {
|
|
6533
7205
|
return getProductLineUid(line);
|
|
6534
7206
|
}).filter(Boolean);
|
|
6535
|
-
addedBookings = (((
|
|
7207
|
+
addedBookings = (((_ref63 = hasCommitGuard ? guardedOrder : this.getTempOrder()) === null || _ref63 === void 0 ? void 0 : _ref63.bookings) || []).filter(function (item) {
|
|
6536
7208
|
var _item$metadata;
|
|
6537
7209
|
return ((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeBookingUids.has(getBookingUid(item));
|
|
6538
7210
|
});
|
|
@@ -6541,8 +7213,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6541
7213
|
}).filter(Boolean);
|
|
6542
7214
|
if (bookingUids.length === 0) {
|
|
6543
7215
|
bookingUids = addedLines.map(function (line) {
|
|
6544
|
-
var
|
|
6545
|
-
return String((
|
|
7216
|
+
var _ref64, _line$booking_uid, _line$metadata5;
|
|
7217
|
+
return String((_ref64 = (_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 && _ref64 !== void 0 ? _ref64 : '');
|
|
6546
7218
|
}).filter(Boolean);
|
|
6547
7219
|
}
|
|
6548
7220
|
productLineUid = productLineUids[productLineUids.length - 1] || '';
|
|
@@ -6563,60 +7235,60 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6563
7235
|
bookingUids: bookingUids
|
|
6564
7236
|
};
|
|
6565
7237
|
if (!targetStillCurrent) {
|
|
6566
|
-
|
|
7238
|
+
_context63.next = 182;
|
|
6567
7239
|
break;
|
|
6568
7240
|
}
|
|
6569
7241
|
// A notification failure after publication must not invite a duplicate add.
|
|
6570
7242
|
emit = function emit() {
|
|
6571
|
-
return
|
|
7243
|
+
return _this27.core.effects.emit("".concat(_this27.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
6572
7244
|
};
|
|
6573
7245
|
if (!guardedCommitPublished) {
|
|
6574
|
-
|
|
7246
|
+
_context63.next = 180;
|
|
6575
7247
|
break;
|
|
6576
7248
|
}
|
|
6577
|
-
|
|
6578
|
-
|
|
7249
|
+
_context63.prev = 171;
|
|
7250
|
+
_context63.next = 174;
|
|
6579
7251
|
return emit();
|
|
6580
7252
|
case 174:
|
|
6581
|
-
|
|
7253
|
+
_context63.next = 178;
|
|
6582
7254
|
break;
|
|
6583
7255
|
case 176:
|
|
6584
|
-
|
|
6585
|
-
|
|
7256
|
+
_context63.prev = 176;
|
|
7257
|
+
_context63.t0 = _context63["catch"](171);
|
|
6586
7258
|
case 178:
|
|
6587
|
-
|
|
7259
|
+
_context63.next = 182;
|
|
6588
7260
|
break;
|
|
6589
7261
|
case 180:
|
|
6590
|
-
|
|
7262
|
+
_context63.next = 182;
|
|
6591
7263
|
return emit();
|
|
6592
7264
|
case 182:
|
|
6593
|
-
return
|
|
7265
|
+
return _context63.abrupt("return", result);
|
|
6594
7266
|
case 183:
|
|
6595
|
-
|
|
7267
|
+
_context63.prev = 183;
|
|
6596
7268
|
release = this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
6597
7269
|
if (!guardedCommitPublished) {
|
|
6598
|
-
|
|
7270
|
+
_context63.next = 190;
|
|
6599
7271
|
break;
|
|
6600
7272
|
}
|
|
6601
|
-
|
|
7273
|
+
_context63.next = 188;
|
|
6602
7274
|
return release.catch(function () {
|
|
6603
7275
|
return undefined;
|
|
6604
7276
|
});
|
|
6605
7277
|
case 188:
|
|
6606
|
-
|
|
7278
|
+
_context63.next = 192;
|
|
6607
7279
|
break;
|
|
6608
7280
|
case 190:
|
|
6609
|
-
|
|
7281
|
+
_context63.next = 192;
|
|
6610
7282
|
return release;
|
|
6611
7283
|
case 192:
|
|
6612
|
-
return
|
|
7284
|
+
return _context63.finish(183);
|
|
6613
7285
|
case 193:
|
|
6614
7286
|
case "end":
|
|
6615
|
-
return
|
|
7287
|
+
return _context63.stop();
|
|
6616
7288
|
}
|
|
6617
|
-
},
|
|
7289
|
+
}, _callee63, this, [[18,, 183, 193], [171, 176]]);
|
|
6618
7290
|
}));
|
|
6619
|
-
function commitAvailabilitySelection(
|
|
7291
|
+
function commitAvailabilitySelection(_x52, _x53) {
|
|
6620
7292
|
return _commitAvailabilitySelection.apply(this, arguments);
|
|
6621
7293
|
}
|
|
6622
7294
|
return commitAvailabilitySelection;
|