@pisell/pisellos 0.10.72 → 0.10.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BookingContext/index.d.ts +2 -2
- package/dist/modules/BookingContext/index.js +55 -25
- package/dist/modules/BookingContext/types.d.ts +2 -0
- package/dist/modules/Order/index.js +8 -7
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/clientDataVariants.js +6 -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 +6 -1
- package/dist/solution/UnifiedBookingSales/index.js +498 -316
- package/dist/solution/UnifiedBookingSales/types.d.ts +16 -1
- package/dist/solution/UnifiedBookingSales/types.js +3 -1
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/BookingContext/index.d.ts +2 -2
- package/lib/modules/BookingContext/index.js +42 -10
- package/lib/modules/BookingContext/types.d.ts +2 -0
- package/lib/modules/Order/index.js +4 -3
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/clientDataVariants.js +6 -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 +6 -1
- package/lib/solution/UnifiedBookingSales/index.js +123 -6
- package/lib/solution/UnifiedBookingSales/types.d.ts +16 -1
- package/lib/solution/UnifiedBookingSales/types.js +2 -1
- package/package.json +1 -1
|
@@ -1331,6 +1331,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1331
1331
|
_defineProperty(_assertThisInitialized(_this), "runtimeOpenDataModule", null);
|
|
1332
1332
|
_defineProperty(_assertThisInitialized(_this), "runtimeOpenDataCore", void 0);
|
|
1333
1333
|
_defineProperty(_assertThisInitialized(_this), "runtimeOpenDataGeneration", 0);
|
|
1334
|
+
_defineProperty(_assertThisInitialized(_this), "runtimeInitializationGeneration", 0);
|
|
1334
1335
|
_defineProperty(_assertThisInitialized(_this), "runtimeOpenDataDestroyed", false);
|
|
1335
1336
|
_defineProperty(_assertThisInitialized(_this), "unifiedProductCatalog", []);
|
|
1336
1337
|
_defineProperty(_assertThisInitialized(_this), "availabilityRuntimeOffsetMinutes", null);
|
|
@@ -1357,30 +1358,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1357
1358
|
value: function () {
|
|
1358
1359
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core) {
|
|
1359
1360
|
var options,
|
|
1360
|
-
|
|
1361
|
+
initializationGeneration,
|
|
1362
|
+
initialization,
|
|
1363
|
+
scope,
|
|
1364
|
+
openDataModule,
|
|
1361
1365
|
_args = arguments;
|
|
1362
1366
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1363
1367
|
while (1) switch (_context.prev = _context.next) {
|
|
1364
1368
|
case 0:
|
|
1365
1369
|
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
1370
|
+
initializationGeneration = ++this.runtimeInitializationGeneration;
|
|
1366
1371
|
this.resetRuntimeOpenData();
|
|
1367
1372
|
this.runtimeOpenDataDestroyed = false;
|
|
1368
|
-
openDataGeneration = this.runtimeOpenDataGeneration;
|
|
1369
1373
|
this.availabilityScheduleCatalog = null;
|
|
1370
1374
|
this.availabilityRuntimeOffsetMinutes = captureRuntimeOffsetMinutes();
|
|
1371
1375
|
this.clearAvailabilityRemoteResourceState();
|
|
1372
1376
|
this.resetAllergyItemRuleState();
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1377
|
+
// BaseSales synchronously installs this runtime before its first await. Cache
|
|
1378
|
+
// refreshes during that await are valid; they are not a new initialization.
|
|
1379
|
+
initialization = _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "initialize", this).call(this, core, options);
|
|
1380
|
+
scope = this.getRuntimeOpenDataScope();
|
|
1381
|
+
openDataModule = this.store.openData;
|
|
1382
|
+
_context.next = 13;
|
|
1383
|
+
return initialization;
|
|
1384
|
+
case 13:
|
|
1385
|
+
if (!(this.runtimeOpenDataDestroyed || initializationGeneration !== this.runtimeInitializationGeneration)) {
|
|
1386
|
+
_context.next = 15;
|
|
1387
|
+
break;
|
|
1388
|
+
}
|
|
1389
|
+
return _context.abrupt("return");
|
|
1390
|
+
case 15:
|
|
1391
|
+
if (!(core !== this.core || openDataModule !== this.store.openData || scope !== this.getRuntimeOpenDataScope())) {
|
|
1392
|
+
_context.next = 17;
|
|
1378
1393
|
break;
|
|
1379
1394
|
}
|
|
1380
1395
|
throw new Error('Store settings changed. Please try again.');
|
|
1381
|
-
case
|
|
1396
|
+
case 17:
|
|
1382
1397
|
this.captureAvailabilityScheduleCatalog();
|
|
1383
|
-
case
|
|
1398
|
+
case 18:
|
|
1384
1399
|
case "end":
|
|
1385
1400
|
return _context.stop();
|
|
1386
1401
|
}
|
|
@@ -1737,17 +1752,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1737
1752
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1738
1753
|
while (1) switch (_context4.prev = _context4.next) {
|
|
1739
1754
|
case 0:
|
|
1755
|
+
this.runtimeInitializationGeneration += 1;
|
|
1740
1756
|
this.runtimeOpenDataDestroyed = true;
|
|
1741
1757
|
this.clearOpenDataCache();
|
|
1742
1758
|
this.availabilityScheduleCatalog = null;
|
|
1743
1759
|
this.availabilityRuntimeOffsetMinutes = null;
|
|
1744
|
-
_context4.next =
|
|
1760
|
+
_context4.next = 7;
|
|
1745
1761
|
return this.resetAvailabilityProjectionState('destroy');
|
|
1746
|
-
case
|
|
1762
|
+
case 7:
|
|
1747
1763
|
this.resetAllergyItemRuleState();
|
|
1748
|
-
_context4.next =
|
|
1764
|
+
_context4.next = 10;
|
|
1749
1765
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "destroy", this).call(this);
|
|
1750
|
-
case
|
|
1766
|
+
case 10:
|
|
1751
1767
|
case "end":
|
|
1752
1768
|
return _context4.stop();
|
|
1753
1769
|
}
|
|
@@ -3962,13 +3978,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3962
3978
|
return _stageRetailProducts.apply(this, arguments);
|
|
3963
3979
|
}
|
|
3964
3980
|
return stageRetailProducts;
|
|
3965
|
-
}()
|
|
3981
|
+
}() /** Explicit capability: order-scoped Tickets extras use guarded writes without implicit SKU merging. */)
|
|
3982
|
+
}, {
|
|
3983
|
+
key: "supportsVenueTicketExtras",
|
|
3984
|
+
value: function supportsVenueTicketExtras() {
|
|
3985
|
+
return true;
|
|
3986
|
+
}
|
|
3987
|
+
|
|
3966
3988
|
/**
|
|
3967
3989
|
* Adds one retail line without replacing the cart's existing retail selection.
|
|
3968
3990
|
* This is intentionally separate from stageRetailProducts(), whose contract is
|
|
3969
3991
|
* "replace the staged selection" for demo and wizard-like callers.
|
|
3970
3992
|
*/
|
|
3971
|
-
)
|
|
3972
3993
|
}, {
|
|
3973
3994
|
key: "addRetailProduct",
|
|
3974
3995
|
value: (function () {
|
|
@@ -3979,8 +4000,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3979
4000
|
_params$product,
|
|
3980
4001
|
_params$product2,
|
|
3981
4002
|
_metadata2,
|
|
3982
|
-
_this10 = this
|
|
3983
|
-
|
|
4003
|
+
_this10 = this,
|
|
4004
|
+
_metadata3;
|
|
4005
|
+
var quantity, productId, sourceProduct, products, orderProduct, order, meta, scopeKey, purchaseDatetime, identity, isCurrentOrder, guard, _order, _meta, parentUid, _scopeKey, _purchaseDatetime, normalizedPurchaseDatetime, _identity, _isCurrentOrder, _guard;
|
|
3984
4006
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3985
4007
|
while (1) switch (_context38.prev = _context38.next) {
|
|
3986
4008
|
case 0:
|
|
@@ -4029,44 +4051,95 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4029
4051
|
}
|
|
4030
4052
|
throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
|
|
4031
4053
|
case 16:
|
|
4032
|
-
if (!(((_metadata2 = orderProduct.metadata) === null || _metadata2 === void 0 ? void 0 : _metadata2.venue_booking_role) === '
|
|
4033
|
-
_context38.next =
|
|
4054
|
+
if (!(((_metadata2 = orderProduct.metadata) === null || _metadata2 === void 0 ? void 0 : _metadata2.venue_booking_role) === 'tickets_extra')) {
|
|
4055
|
+
_context38.next = 31;
|
|
4034
4056
|
break;
|
|
4035
4057
|
}
|
|
4036
4058
|
order = this.getTempOrder();
|
|
4037
4059
|
meta = orderProduct.metadata;
|
|
4038
|
-
parentUid = String(meta.venue_booking_parent_uid || '');
|
|
4039
4060
|
scopeKey = String(meta.venue_booking_scope_key || '');
|
|
4040
|
-
|
|
4041
|
-
identity = [order === null || order === void 0 ? void 0 : order.order_id, order === null || order === void 0 ? void 0 : order.external_sale_number];
|
|
4061
|
+
purchaseDatetime = String(meta.venue_booking_service_datetime || '');
|
|
4062
|
+
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];
|
|
4042
4063
|
isCurrentOrder = function isCurrentOrder() {
|
|
4043
|
-
return _this10.getTempOrder() === order && (order === null || order === void 0 ? void 0 : order.order_id) === identity[0] && (order === null || order === void 0 ? void 0 : order.external_sale_number) === identity[1];
|
|
4064
|
+
return _this10.getTempOrder() === order && (order === null || order === void 0 ? void 0 : order.order_id) === identity[0] && (order === null || order === void 0 ? void 0 : order.external_sale_number) === identity[1] && (order === null || order === void 0 ? void 0 : order.customer_id) === identity[2];
|
|
4044
4065
|
};
|
|
4045
4066
|
guard = function guard() {
|
|
4046
|
-
var _params$availabilityC
|
|
4067
|
+
var _params$availabilityC;
|
|
4047
4068
|
(_params$availabilityC = params.availabilityCommitGuard) === null || _params$availabilityC === void 0 || _params$availabilityC.call(params);
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4069
|
+
if (!isCurrentOrder() || !order || order.order_id || !scopeKey || meta.venue_booking_parent_uid || orderProduct.booking_uid || meta.booking_uid || !/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?$/.test(purchaseDatetime) || !dayjs(purchaseDatetime).isValid() || !(order.products || []).some(function (line) {
|
|
4070
|
+
var _line$metadata, _line$metadata2;
|
|
4071
|
+
return ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata.venue_booking_role) === 'tickets' && ((_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.venue_booking_scope_key) === scopeKey;
|
|
4072
|
+
})) {
|
|
4073
|
+
throw _this10.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '门票订单或购买时间已变化,请重新确认附加商品');
|
|
4074
|
+
}
|
|
4053
4075
|
};
|
|
4054
4076
|
guard();
|
|
4077
|
+
// Retail extras are order-owned, with their own UID and no Holder/booking.
|
|
4055
4078
|
delete orderProduct.unique_identification_number;
|
|
4056
|
-
delete
|
|
4079
|
+
delete meta.unique_identification_number;
|
|
4080
|
+
delete meta.venue_booking_parent_uid;
|
|
4081
|
+
orderProduct.holder_config = {
|
|
4082
|
+
status: 'disable',
|
|
4083
|
+
required: 0
|
|
4084
|
+
};
|
|
4085
|
+
meta.holder_config = {
|
|
4086
|
+
status: 'disable',
|
|
4087
|
+
required: 0
|
|
4088
|
+
};
|
|
4057
4089
|
return _context38.abrupt("return", this.addProductToOrder(orderProduct, undefined, {
|
|
4058
4090
|
disableMerge: true,
|
|
4059
4091
|
availabilityCommitGuard: guard,
|
|
4060
4092
|
availabilityCommitTargetGuard: isCurrentOrder,
|
|
4061
4093
|
salesNotes: params.salesNotes
|
|
4062
4094
|
}));
|
|
4063
|
-
case
|
|
4095
|
+
case 31:
|
|
4096
|
+
if (!(((_metadata3 = orderProduct.metadata) === null || _metadata3 === void 0 ? void 0 : _metadata3.venue_booking_role) === 'party_extra')) {
|
|
4097
|
+
_context38.next = 47;
|
|
4098
|
+
break;
|
|
4099
|
+
}
|
|
4100
|
+
_order = this.getTempOrder();
|
|
4101
|
+
_meta = orderProduct.metadata;
|
|
4102
|
+
parentUid = String(_meta.venue_booking_parent_uid || '');
|
|
4103
|
+
_scopeKey = String(_meta.venue_booking_scope_key || ''); // The persisted legacy key holds this retail extra's venue-local purchase quote time.
|
|
4104
|
+
// Its parent UID owns the extra; the parent's appointment time does not price it.
|
|
4105
|
+
_purchaseDatetime = String(_meta.venue_booking_service_datetime || '');
|
|
4106
|
+
normalizedPurchaseDatetime = _purchaseDatetime.length === 16 ? "".concat(_purchaseDatetime, ":00") : _purchaseDatetime;
|
|
4107
|
+
_identity = [_order === null || _order === void 0 ? void 0 : _order.order_id, _order === null || _order === void 0 ? void 0 : _order.external_sale_number];
|
|
4108
|
+
_isCurrentOrder = function _isCurrentOrder() {
|
|
4109
|
+
return _this10.getTempOrder() === _order && (_order === null || _order === void 0 ? void 0 : _order.order_id) === _identity[0] && (_order === null || _order === void 0 ? void 0 : _order.external_sale_number) === _identity[1];
|
|
4110
|
+
};
|
|
4111
|
+
_guard = function _guard() {
|
|
4112
|
+
var _params$availabilityC2, _parent$metadata, _parent$metadata2;
|
|
4113
|
+
(_params$availabilityC2 = params.availabilityCommitGuard) === null || _params$availabilityC2 === void 0 || _params$availabilityC2.call(params);
|
|
4114
|
+
var parent = ((_order === null || _order === void 0 ? void 0 : _order.products) || []).find(function (line) {
|
|
4115
|
+
return getProductLineUid(line) === parentUid;
|
|
4116
|
+
});
|
|
4117
|
+
if (!_isCurrentOrder() || !_order || _order.order_id || !parentUid || !_scopeKey || (parent === null || parent === void 0 || (_parent$metadata = parent.metadata) === null || _parent$metadata === void 0 ? void 0 : _parent$metadata.venue_booking_role) !== 'party_main' || (parent === null || parent === void 0 || (_parent$metadata2 = parent.metadata) === null || _parent$metadata2 === void 0 ? void 0 : _parent$metadata2.venue_booking_scope_key) !== _scopeKey || !/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?$/.test(_purchaseDatetime) || !dayjs(_purchaseDatetime).isValid() || dayjs(_purchaseDatetime).format('YYYY-MM-DD HH:mm:ss') !== normalizedPurchaseDatetime) throw _this10.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'Party 主商品或附加商品报价上下文已变化,请重新确认附加商品');
|
|
4118
|
+
};
|
|
4119
|
+
_guard();
|
|
4120
|
+
delete orderProduct.unique_identification_number;
|
|
4121
|
+
delete orderProduct.metadata.unique_identification_number;
|
|
4122
|
+
orderProduct.holder_config = {
|
|
4123
|
+
status: 'disable',
|
|
4124
|
+
required: 0
|
|
4125
|
+
};
|
|
4126
|
+
orderProduct.metadata.holder_config = {
|
|
4127
|
+
status: 'disable',
|
|
4128
|
+
required: 0
|
|
4129
|
+
};
|
|
4130
|
+
return _context38.abrupt("return", this.addProductToOrder(orderProduct, undefined, {
|
|
4131
|
+
disableMerge: true,
|
|
4132
|
+
availabilityCommitGuard: _guard,
|
|
4133
|
+
availabilityCommitTargetGuard: _isCurrentOrder,
|
|
4134
|
+
salesNotes: params.salesNotes
|
|
4135
|
+
}));
|
|
4136
|
+
case 47:
|
|
4064
4137
|
return _context38.abrupt("return", this.addProductToOrder(orderProduct, undefined, _objectSpread(_objectSpread({}, params.availabilityCommitGuard ? {
|
|
4065
4138
|
availabilityCommitGuard: params.availabilityCommitGuard
|
|
4066
4139
|
} : {}), params.salesNotes ? {
|
|
4067
4140
|
salesNotes: params.salesNotes
|
|
4068
4141
|
} : {})));
|
|
4069
|
-
case
|
|
4142
|
+
case 48:
|
|
4070
4143
|
case "end":
|
|
4071
4144
|
return _context38.stop();
|
|
4072
4145
|
}
|
|
@@ -4393,7 +4466,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4393
4466
|
key: "fetchAvailabilityResourcesV2",
|
|
4394
4467
|
value: (function () {
|
|
4395
4468
|
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
4396
|
-
var response, data;
|
|
4469
|
+
var response, data, message;
|
|
4397
4470
|
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4398
4471
|
while (1) switch (_context40.prev = _context40.next) {
|
|
4399
4472
|
case 0:
|
|
@@ -4409,20 +4482,35 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4409
4482
|
case 2:
|
|
4410
4483
|
response = _context40.sent;
|
|
4411
4484
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
4485
|
+
if (!(params.strictResponse && (response === null || response === void 0 ? void 0 : response.status) === false)) {
|
|
4486
|
+
_context40.next = 7;
|
|
4487
|
+
break;
|
|
4488
|
+
}
|
|
4489
|
+
message = response === null || response === void 0 ? void 0 : response.message;
|
|
4490
|
+
throw Object.assign(new Error(typeof message === 'string' && message.trim() ? message : 'Unable to load booking resource details.'), {
|
|
4491
|
+
code: response === null || response === void 0 ? void 0 : response.code
|
|
4492
|
+
});
|
|
4493
|
+
case 7:
|
|
4412
4494
|
if (!Array.isArray(data)) {
|
|
4413
|
-
_context40.next =
|
|
4495
|
+
_context40.next = 9;
|
|
4414
4496
|
break;
|
|
4415
4497
|
}
|
|
4416
4498
|
return _context40.abrupt("return", data);
|
|
4417
|
-
case
|
|
4499
|
+
case 9:
|
|
4418
4500
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
|
|
4419
|
-
_context40.next =
|
|
4501
|
+
_context40.next = 11;
|
|
4420
4502
|
break;
|
|
4421
4503
|
}
|
|
4422
4504
|
return _context40.abrupt("return", data.list);
|
|
4423
|
-
case
|
|
4505
|
+
case 11:
|
|
4506
|
+
if (!params.strictResponse) {
|
|
4507
|
+
_context40.next = 13;
|
|
4508
|
+
break;
|
|
4509
|
+
}
|
|
4510
|
+
throw new Error('Booking resource details returned an invalid response.');
|
|
4511
|
+
case 13:
|
|
4424
4512
|
return _context40.abrupt("return", []);
|
|
4425
|
-
case
|
|
4513
|
+
case 14:
|
|
4426
4514
|
case "end":
|
|
4427
4515
|
return _context40.stop();
|
|
4428
4516
|
}
|
|
@@ -4432,21 +4520,104 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4432
4520
|
return _fetchAvailabilityResourcesV.apply(this, arguments);
|
|
4433
4521
|
}
|
|
4434
4522
|
return fetchAvailabilityResourcesV2;
|
|
4523
|
+
}() /** Fresh read-only metadata for confirmation forms/policies; does not create a projection or mutate BookingContext. */)
|
|
4524
|
+
}, {
|
|
4525
|
+
key: "queryBookingResourceDetails",
|
|
4526
|
+
value: (function () {
|
|
4527
|
+
var _queryBookingResourceDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
4528
|
+
var _this13 = this;
|
|
4529
|
+
var date, resourceIds, core, request, generation, scope, assertCurrent, resources, byId;
|
|
4530
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4531
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
4532
|
+
case 0:
|
|
4533
|
+
date = params === null || params === void 0 ? void 0 : params.date;
|
|
4534
|
+
_context41.prev = 1;
|
|
4535
|
+
if (!(typeof date !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(date))) {
|
|
4536
|
+
_context41.next = 4;
|
|
4537
|
+
break;
|
|
4538
|
+
}
|
|
4539
|
+
throw new Error('date');
|
|
4540
|
+
case 4:
|
|
4541
|
+
parseLocalDate(date);
|
|
4542
|
+
_context41.next = 10;
|
|
4543
|
+
break;
|
|
4544
|
+
case 7:
|
|
4545
|
+
_context41.prev = 7;
|
|
4546
|
+
_context41.t0 = _context41["catch"](1);
|
|
4547
|
+
throw this.createAvailabilityFacadeError('INVALID_DATE_RANGE', 'A valid booking date is required to load resource details.');
|
|
4548
|
+
case 10:
|
|
4549
|
+
if (!(!Array.isArray(params === null || params === void 0 ? void 0 : params.resourceIds) || !params.resourceIds.length || params.resourceIds.some(function (id) {
|
|
4550
|
+
return !['number', 'string'].includes(_typeof(id)) || !/^\d+$/.test(String(id)) || !Number.isSafeInteger(Number(id)) || Number(id) <= 0;
|
|
4551
|
+
}))) {
|
|
4552
|
+
_context41.next = 12;
|
|
4553
|
+
break;
|
|
4554
|
+
}
|
|
4555
|
+
throw this.createAvailabilityFacadeError('INVALID_TARGET_FILTER', 'Selected resource IDs are required to load resource details.');
|
|
4556
|
+
case 12:
|
|
4557
|
+
resourceIds = _toConsumableArray(new Set(params.resourceIds.map(function (id) {
|
|
4558
|
+
return String(Number(id));
|
|
4559
|
+
})));
|
|
4560
|
+
core = this.core;
|
|
4561
|
+
request = this.request;
|
|
4562
|
+
generation = this.runtimeInitializationGeneration;
|
|
4563
|
+
scope = this.getRuntimeOpenDataScope();
|
|
4564
|
+
assertCurrent = function assertCurrent() {
|
|
4565
|
+
if (_this13.runtimeOpenDataDestroyed || !request || core !== _this13.core || request !== _this13.request || generation !== _this13.runtimeInitializationGeneration || scope !== _this13.getRuntimeOpenDataScope()) {
|
|
4566
|
+
throw _this13.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'Booking settings changed. Please reload the resource details.');
|
|
4567
|
+
}
|
|
4568
|
+
};
|
|
4569
|
+
assertCurrent();
|
|
4570
|
+
_context41.next = 21;
|
|
4571
|
+
return this.fetchAvailabilityResourcesV2({
|
|
4572
|
+
dateRange: {
|
|
4573
|
+
startDate: date,
|
|
4574
|
+
endDate: date
|
|
4575
|
+
},
|
|
4576
|
+
resourceIds: resourceIds,
|
|
4577
|
+
strictResponse: true
|
|
4578
|
+
});
|
|
4579
|
+
case 21:
|
|
4580
|
+
resources = _context41.sent;
|
|
4581
|
+
assertCurrent();
|
|
4582
|
+
byId = new Map(resources.filter(isRecord).map(function (resource) {
|
|
4583
|
+
return [String(resource.id), resource];
|
|
4584
|
+
}));
|
|
4585
|
+
if (!resourceIds.some(function (id) {
|
|
4586
|
+
return !byId.has(id);
|
|
4587
|
+
})) {
|
|
4588
|
+
_context41.next = 26;
|
|
4589
|
+
break;
|
|
4590
|
+
}
|
|
4591
|
+
throw this.createAvailabilityFacadeError('INVALID_TARGET_FILTER', 'A selected booking resource is no longer available.');
|
|
4592
|
+
case 26:
|
|
4593
|
+
return _context41.abrupt("return", cloneDeep(resourceIds.map(function (id) {
|
|
4594
|
+
return byId.get(id);
|
|
4595
|
+
})));
|
|
4596
|
+
case 27:
|
|
4597
|
+
case "end":
|
|
4598
|
+
return _context41.stop();
|
|
4599
|
+
}
|
|
4600
|
+
}, _callee41, this, [[1, 7]]);
|
|
4601
|
+
}));
|
|
4602
|
+
function queryBookingResourceDetails(_x26) {
|
|
4603
|
+
return _queryBookingResourceDetails.apply(this, arguments);
|
|
4604
|
+
}
|
|
4605
|
+
return queryBookingResourceDetails;
|
|
4435
4606
|
}())
|
|
4436
4607
|
}, {
|
|
4437
4608
|
key: "fetchAndPublishAvailabilityResourcesV2",
|
|
4438
4609
|
value: function () {
|
|
4439
|
-
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4610
|
+
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
|
|
4440
4611
|
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
|
|
4441
|
-
return _regeneratorRuntime().wrap(function
|
|
4442
|
-
while (1) switch (
|
|
4612
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4613
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4443
4614
|
case 0:
|
|
4444
4615
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4445
4616
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4446
|
-
|
|
4617
|
+
_context42.next = 3;
|
|
4447
4618
|
break;
|
|
4448
4619
|
}
|
|
4449
|
-
return
|
|
4620
|
+
return _context42.abrupt("return", []);
|
|
4450
4621
|
case 3:
|
|
4451
4622
|
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
4452
4623
|
cacheParams = {
|
|
@@ -4456,7 +4627,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4456
4627
|
};
|
|
4457
4628
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
4458
4629
|
if (!cachedRawResources) {
|
|
4459
|
-
|
|
4630
|
+
_context42.next = 9;
|
|
4460
4631
|
break;
|
|
4461
4632
|
}
|
|
4462
4633
|
if (params.useCacheOnHit) {
|
|
@@ -4468,23 +4639,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4468
4639
|
console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
|
|
4469
4640
|
});
|
|
4470
4641
|
}
|
|
4471
|
-
return
|
|
4642
|
+
return _context42.abrupt("return", cachedRawResources);
|
|
4472
4643
|
case 9:
|
|
4473
|
-
|
|
4644
|
+
_context42.next = 11;
|
|
4474
4645
|
return this.refreshAvailabilityRemoteResourceQuery({
|
|
4475
4646
|
timezone: params.timezone,
|
|
4476
4647
|
dateRange: params.dateRange,
|
|
4477
4648
|
resourceIds: normalizedResourceIds
|
|
4478
4649
|
});
|
|
4479
4650
|
case 11:
|
|
4480
|
-
return
|
|
4651
|
+
return _context42.abrupt("return", _context42.sent);
|
|
4481
4652
|
case 12:
|
|
4482
4653
|
case "end":
|
|
4483
|
-
return
|
|
4654
|
+
return _context42.stop();
|
|
4484
4655
|
}
|
|
4485
|
-
},
|
|
4656
|
+
}, _callee42, this);
|
|
4486
4657
|
}));
|
|
4487
|
-
function fetchAndPublishAvailabilityResourcesV2(
|
|
4658
|
+
function fetchAndPublishAvailabilityResourcesV2(_x27) {
|
|
4488
4659
|
return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
|
|
4489
4660
|
}
|
|
4490
4661
|
return fetchAndPublishAvailabilityResourcesV2;
|
|
@@ -4492,17 +4663,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4492
4663
|
}, {
|
|
4493
4664
|
key: "refreshAvailabilityRemoteResourceQuery",
|
|
4494
4665
|
value: function () {
|
|
4495
|
-
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4666
|
+
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
4496
4667
|
var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
|
|
4497
|
-
return _regeneratorRuntime().wrap(function
|
|
4498
|
-
while (1) switch (
|
|
4668
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4669
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4499
4670
|
case 0:
|
|
4500
4671
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4501
4672
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4502
|
-
|
|
4673
|
+
_context43.next = 3;
|
|
4503
4674
|
break;
|
|
4504
4675
|
}
|
|
4505
|
-
return
|
|
4676
|
+
return _context43.abrupt("return", []);
|
|
4506
4677
|
case 3:
|
|
4507
4678
|
queryKey = this.buildAvailabilityRemoteResourceQueryKey({
|
|
4508
4679
|
timezone: params.timezone,
|
|
@@ -4512,13 +4683,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4512
4683
|
epoch = this.availabilityRemoteResourceEpoch;
|
|
4513
4684
|
existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4514
4685
|
if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
|
|
4515
|
-
|
|
4686
|
+
_context43.next = 10;
|
|
4516
4687
|
break;
|
|
4517
4688
|
}
|
|
4518
|
-
|
|
4689
|
+
_context43.next = 9;
|
|
4519
4690
|
return existing.promise;
|
|
4520
4691
|
case 9:
|
|
4521
|
-
return
|
|
4692
|
+
return _context43.abrupt("return", _context43.sent);
|
|
4522
4693
|
case 10:
|
|
4523
4694
|
this.availabilityRemoteResourceQuerySequence += 1;
|
|
4524
4695
|
writeVersion = this.availabilityRemoteResourceQuerySequence;
|
|
@@ -4530,11 +4701,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4530
4701
|
epoch: epoch,
|
|
4531
4702
|
promise: promise
|
|
4532
4703
|
});
|
|
4533
|
-
|
|
4534
|
-
|
|
4704
|
+
_context43.prev = 14;
|
|
4705
|
+
_context43.next = 17;
|
|
4535
4706
|
return promise;
|
|
4536
4707
|
case 17:
|
|
4537
|
-
rawResources =
|
|
4708
|
+
rawResources = _context43.sent;
|
|
4538
4709
|
if (epoch === this.availabilityRemoteResourceEpoch) {
|
|
4539
4710
|
this.availabilityRemoteOccupancyCache.publish({
|
|
4540
4711
|
scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
|
|
@@ -4545,21 +4716,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4545
4716
|
version: writeVersion
|
|
4546
4717
|
});
|
|
4547
4718
|
}
|
|
4548
|
-
return
|
|
4719
|
+
return _context43.abrupt("return", rawResources);
|
|
4549
4720
|
case 20:
|
|
4550
|
-
|
|
4721
|
+
_context43.prev = 20;
|
|
4551
4722
|
current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4552
4723
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4553
4724
|
this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
|
|
4554
4725
|
}
|
|
4555
|
-
return
|
|
4726
|
+
return _context43.finish(20);
|
|
4556
4727
|
case 24:
|
|
4557
4728
|
case "end":
|
|
4558
|
-
return
|
|
4729
|
+
return _context43.stop();
|
|
4559
4730
|
}
|
|
4560
|
-
},
|
|
4731
|
+
}, _callee43, this, [[14,, 20, 24]]);
|
|
4561
4732
|
}));
|
|
4562
|
-
function refreshAvailabilityRemoteResourceQuery(
|
|
4733
|
+
function refreshAvailabilityRemoteResourceQuery(_x28) {
|
|
4563
4734
|
return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
|
|
4564
4735
|
}
|
|
4565
4736
|
return refreshAvailabilityRemoteResourceQuery;
|
|
@@ -4567,26 +4738,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4567
4738
|
}, {
|
|
4568
4739
|
key: "loadAvailabilityResources",
|
|
4569
4740
|
value: function () {
|
|
4570
|
-
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4741
|
+
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
4571
4742
|
var resourceIds, cachedRawResources, remoteQuery, rawResources;
|
|
4572
|
-
return _regeneratorRuntime().wrap(function
|
|
4573
|
-
while (1) switch (
|
|
4743
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4744
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4574
4745
|
case 0:
|
|
4575
4746
|
resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
|
|
4576
4747
|
if (!(resourceIds.length === 0)) {
|
|
4577
|
-
|
|
4748
|
+
_context44.next = 3;
|
|
4578
4749
|
break;
|
|
4579
4750
|
}
|
|
4580
|
-
return
|
|
4751
|
+
return _context44.abrupt("return", {
|
|
4581
4752
|
resources: [],
|
|
4582
4753
|
resourceOccupancies: []
|
|
4583
4754
|
});
|
|
4584
4755
|
case 3:
|
|
4585
4756
|
if (!(Array.isArray(params.rawResources) && params.fetchPolicy !== 'refresh')) {
|
|
4586
|
-
|
|
4757
|
+
_context44.next = 5;
|
|
4587
4758
|
break;
|
|
4588
4759
|
}
|
|
4589
|
-
return
|
|
4760
|
+
return _context44.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4590
4761
|
rawResources: params.rawResources,
|
|
4591
4762
|
scheduleList: params.scheduleList,
|
|
4592
4763
|
dateRange: params.dateRange,
|
|
@@ -4594,7 +4765,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4594
4765
|
}));
|
|
4595
4766
|
case 5:
|
|
4596
4767
|
if (!(params.fetchPolicy === 'cache_only')) {
|
|
4597
|
-
|
|
4768
|
+
_context44.next = 10;
|
|
4598
4769
|
break;
|
|
4599
4770
|
}
|
|
4600
4771
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read({
|
|
@@ -4603,17 +4774,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4603
4774
|
dateRange: params.dateRange
|
|
4604
4775
|
});
|
|
4605
4776
|
if (!cachedRawResources) {
|
|
4606
|
-
|
|
4777
|
+
_context44.next = 9;
|
|
4607
4778
|
break;
|
|
4608
4779
|
}
|
|
4609
|
-
return
|
|
4780
|
+
return _context44.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4610
4781
|
rawResources: cachedRawResources,
|
|
4611
4782
|
scheduleList: params.scheduleList,
|
|
4612
4783
|
dateRange: params.dateRange,
|
|
4613
4784
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4614
4785
|
}));
|
|
4615
4786
|
case 9:
|
|
4616
|
-
return
|
|
4787
|
+
return _context44.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
|
|
4617
4788
|
resources: [],
|
|
4618
4789
|
resourceOccupancies: []
|
|
4619
4790
|
});
|
|
@@ -4624,25 +4795,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4624
4795
|
resourceIds: resourceIds
|
|
4625
4796
|
};
|
|
4626
4797
|
if (!(params.fetchPolicy === 'refresh')) {
|
|
4627
|
-
|
|
4798
|
+
_context44.next = 17;
|
|
4628
4799
|
break;
|
|
4629
4800
|
}
|
|
4630
|
-
|
|
4801
|
+
_context44.next = 14;
|
|
4631
4802
|
return this.refreshAvailabilityRemoteResourceQuery(remoteQuery);
|
|
4632
4803
|
case 14:
|
|
4633
|
-
|
|
4634
|
-
|
|
4804
|
+
_context44.t0 = _context44.sent;
|
|
4805
|
+
_context44.next = 20;
|
|
4635
4806
|
break;
|
|
4636
4807
|
case 17:
|
|
4637
|
-
|
|
4808
|
+
_context44.next = 19;
|
|
4638
4809
|
return this.fetchAndPublishAvailabilityResourcesV2(_objectSpread(_objectSpread({}, remoteQuery), {}, {
|
|
4639
4810
|
useCacheOnHit: true
|
|
4640
4811
|
}));
|
|
4641
4812
|
case 19:
|
|
4642
|
-
|
|
4813
|
+
_context44.t0 = _context44.sent;
|
|
4643
4814
|
case 20:
|
|
4644
|
-
rawResources =
|
|
4645
|
-
return
|
|
4815
|
+
rawResources = _context44.t0;
|
|
4816
|
+
return _context44.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4646
4817
|
rawResources: rawResources,
|
|
4647
4818
|
scheduleList: params.scheduleList,
|
|
4648
4819
|
dateRange: params.dateRange,
|
|
@@ -4650,11 +4821,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4650
4821
|
}));
|
|
4651
4822
|
case 22:
|
|
4652
4823
|
case "end":
|
|
4653
|
-
return
|
|
4824
|
+
return _context44.stop();
|
|
4654
4825
|
}
|
|
4655
|
-
},
|
|
4826
|
+
}, _callee44, this);
|
|
4656
4827
|
}));
|
|
4657
|
-
function loadAvailabilityResources(
|
|
4828
|
+
function loadAvailabilityResources(_x29) {
|
|
4658
4829
|
return _loadAvailabilityResources.apply(this, arguments);
|
|
4659
4830
|
}
|
|
4660
4831
|
return loadAvailabilityResources;
|
|
@@ -4727,7 +4898,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4727
4898
|
}, {
|
|
4728
4899
|
key: "collectCartResourceOccupancies",
|
|
4729
4900
|
value: function collectCartResourceOccupancies(tempOrder, exclusions) {
|
|
4730
|
-
var
|
|
4901
|
+
var _this14 = this;
|
|
4731
4902
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
4732
4903
|
return bookings.flatMap(function (booking) {
|
|
4733
4904
|
var _ref49, _booking$product_uid2, _booking$metadata2;
|
|
@@ -4744,7 +4915,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4744
4915
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4745
4916
|
startAt: startAt,
|
|
4746
4917
|
endAt: endAt,
|
|
4747
|
-
fixedOffsetMinutes:
|
|
4918
|
+
fixedOffsetMinutes: _this14.getAvailabilityRuntimeOffsetMinutes(),
|
|
4748
4919
|
rollOverEnd: false
|
|
4749
4920
|
});
|
|
4750
4921
|
if (!range) return [];
|
|
@@ -4762,7 +4933,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4762
4933
|
resource: resource
|
|
4763
4934
|
}
|
|
4764
4935
|
};
|
|
4765
|
-
return
|
|
4936
|
+
return _this14.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
|
|
4766
4937
|
});
|
|
4767
4938
|
});
|
|
4768
4939
|
}
|
|
@@ -4829,16 +5000,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4829
5000
|
}, {
|
|
4830
5001
|
key: "assertContextualQueryFreshness",
|
|
4831
5002
|
value: function assertContextualQueryFreshness(context, request) {
|
|
4832
|
-
var
|
|
5003
|
+
var _this15 = this;
|
|
4833
5004
|
if (request.target === 'time') {
|
|
4834
5005
|
request.candidates.forEach(function (candidate) {
|
|
4835
|
-
|
|
5006
|
+
_this15.assertAvailabilityCandidateFreshness(context, candidate);
|
|
4836
5007
|
});
|
|
4837
5008
|
return;
|
|
4838
5009
|
}
|
|
4839
5010
|
if (request.target === 'resource') {
|
|
4840
5011
|
request.selectedRanges.forEach(function (candidate) {
|
|
4841
|
-
|
|
5012
|
+
_this15.assertAvailabilityCandidateFreshness(context, candidate);
|
|
4842
5013
|
});
|
|
4843
5014
|
}
|
|
4844
5015
|
}
|
|
@@ -4885,8 +5056,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4885
5056
|
}, {
|
|
4886
5057
|
key: "buildAvailabilityProjectionSnapshot",
|
|
4887
5058
|
value: function () {
|
|
4888
|
-
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4889
|
-
var
|
|
5059
|
+
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
5060
|
+
var _this16 = this;
|
|
4890
5061
|
var options,
|
|
4891
5062
|
normalizedPrepareParams,
|
|
4892
5063
|
timezoneLabel,
|
|
@@ -4907,11 +5078,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4907
5078
|
durationCandidateAnchorAt,
|
|
4908
5079
|
orderRevision,
|
|
4909
5080
|
projection,
|
|
4910
|
-
|
|
4911
|
-
return _regeneratorRuntime().wrap(function
|
|
4912
|
-
while (1) switch (
|
|
5081
|
+
_args45 = arguments;
|
|
5082
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
5083
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4913
5084
|
case 0:
|
|
4914
|
-
options =
|
|
5085
|
+
options = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {};
|
|
4915
5086
|
normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
4916
5087
|
timezoneLabel = String(normalizedPrepareParams.timezone);
|
|
4917
5088
|
dateRange = normalizedPrepareParams.dateRange;
|
|
@@ -4925,15 +5096,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4925
5096
|
scheduleList: scheduleList,
|
|
4926
5097
|
businessHours: businessHours
|
|
4927
5098
|
});
|
|
4928
|
-
|
|
5099
|
+
_context45.next = 11;
|
|
4929
5100
|
return this.loadAvailabilityProducts({
|
|
4930
5101
|
prepare: normalizedPrepareParams,
|
|
4931
5102
|
dateRange: dateRange,
|
|
4932
5103
|
scheduleList: scheduleList
|
|
4933
5104
|
});
|
|
4934
5105
|
case 11:
|
|
4935
|
-
products =
|
|
4936
|
-
|
|
5106
|
+
products = _context45.sent;
|
|
5107
|
+
_context45.next = 14;
|
|
4937
5108
|
return this.loadAvailabilityResources({
|
|
4938
5109
|
timezone: timezoneLabel,
|
|
4939
5110
|
dateRange: dateRange,
|
|
@@ -4946,14 +5117,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4946
5117
|
fallbackResources: options.fallbackResources
|
|
4947
5118
|
});
|
|
4948
5119
|
case 14:
|
|
4949
|
-
loadedResources =
|
|
5120
|
+
loadedResources = _context45.sent;
|
|
4950
5121
|
tempOrder = this.getTempOrder();
|
|
4951
5122
|
exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
|
|
4952
5123
|
injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
|
|
4953
5124
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4954
5125
|
startAt: occupancy.startAt,
|
|
4955
5126
|
endAt: occupancy.endAt,
|
|
4956
|
-
fixedOffsetMinutes:
|
|
5127
|
+
fixedOffsetMinutes: _this16.getAvailabilityRuntimeOffsetMinutes(),
|
|
4957
5128
|
rollOverEnd: false
|
|
4958
5129
|
});
|
|
4959
5130
|
if (!range) return [];
|
|
@@ -4963,7 +5134,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4963
5134
|
})];
|
|
4964
5135
|
});
|
|
4965
5136
|
remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
|
|
4966
|
-
return !
|
|
5137
|
+
return !_this16.occupancyIsExcluded(occupancy, exclusions);
|
|
4967
5138
|
});
|
|
4968
5139
|
cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
|
|
4969
5140
|
preparedAt = this.getAvailabilityRuntimeDateTime();
|
|
@@ -4992,18 +5163,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4992
5163
|
prepareParams: normalizedPrepareParams,
|
|
4993
5164
|
durationCandidateAnchorAt: durationCandidateAnchorAt
|
|
4994
5165
|
});
|
|
4995
|
-
return
|
|
5166
|
+
return _context45.abrupt("return", {
|
|
4996
5167
|
projection: projection,
|
|
4997
5168
|
prepareParams: normalizedPrepareParams,
|
|
4998
5169
|
orderRevision: orderRevision
|
|
4999
5170
|
});
|
|
5000
5171
|
case 26:
|
|
5001
5172
|
case "end":
|
|
5002
|
-
return
|
|
5173
|
+
return _context45.stop();
|
|
5003
5174
|
}
|
|
5004
|
-
},
|
|
5175
|
+
}, _callee45, this);
|
|
5005
5176
|
}));
|
|
5006
|
-
function buildAvailabilityProjectionSnapshot(
|
|
5177
|
+
function buildAvailabilityProjectionSnapshot(_x30) {
|
|
5007
5178
|
return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
|
|
5008
5179
|
}
|
|
5009
5180
|
return buildAvailabilityProjectionSnapshot;
|
|
@@ -5011,10 +5182,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5011
5182
|
}, {
|
|
5012
5183
|
key: "getSharedPreparedAvailabilitySnapshot",
|
|
5013
5184
|
value: function () {
|
|
5014
|
-
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5185
|
+
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
5015
5186
|
var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
|
|
5016
|
-
return _regeneratorRuntime().wrap(function
|
|
5017
|
-
while (1) switch (
|
|
5187
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
5188
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
5018
5189
|
case 0:
|
|
5019
5190
|
lifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
5020
5191
|
normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
@@ -5033,15 +5204,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5033
5204
|
}
|
|
5034
5205
|
})) : this.buildAvailabilityPrepareKey(normalizedParams);
|
|
5035
5206
|
if (!hasRawInputs) {
|
|
5036
|
-
|
|
5207
|
+
_context46.next = 11;
|
|
5037
5208
|
break;
|
|
5038
5209
|
}
|
|
5039
|
-
|
|
5210
|
+
_context46.next = 7;
|
|
5040
5211
|
return this.buildAvailabilityProjectionSnapshot(normalizedParams);
|
|
5041
5212
|
case 7:
|
|
5042
|
-
snapshot =
|
|
5213
|
+
snapshot = _context46.sent;
|
|
5043
5214
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
5044
|
-
|
|
5215
|
+
_context46.next = 10;
|
|
5045
5216
|
break;
|
|
5046
5217
|
}
|
|
5047
5218
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -5050,7 +5221,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5050
5221
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
5051
5222
|
});
|
|
5052
5223
|
case 10:
|
|
5053
|
-
return
|
|
5224
|
+
return _context46.abrupt("return", {
|
|
5054
5225
|
prepareKey: prepareKey,
|
|
5055
5226
|
snapshot: snapshot
|
|
5056
5227
|
});
|
|
@@ -5064,13 +5235,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5064
5235
|
promise: promise
|
|
5065
5236
|
});
|
|
5066
5237
|
}
|
|
5067
|
-
|
|
5068
|
-
|
|
5238
|
+
_context46.prev = 14;
|
|
5239
|
+
_context46.next = 17;
|
|
5069
5240
|
return promise;
|
|
5070
5241
|
case 17:
|
|
5071
|
-
_snapshot =
|
|
5242
|
+
_snapshot = _context46.sent;
|
|
5072
5243
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
5073
|
-
|
|
5244
|
+
_context46.next = 20;
|
|
5074
5245
|
break;
|
|
5075
5246
|
}
|
|
5076
5247
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -5079,24 +5250,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5079
5250
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
5080
5251
|
});
|
|
5081
5252
|
case 20:
|
|
5082
|
-
return
|
|
5253
|
+
return _context46.abrupt("return", {
|
|
5083
5254
|
prepareKey: prepareKey,
|
|
5084
5255
|
snapshot: _snapshot
|
|
5085
5256
|
});
|
|
5086
5257
|
case 21:
|
|
5087
|
-
|
|
5258
|
+
_context46.prev = 21;
|
|
5088
5259
|
current = this.availabilityPrepareInFlight.get(prepareKey);
|
|
5089
5260
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
5090
5261
|
this.availabilityPrepareInFlight.delete(prepareKey);
|
|
5091
5262
|
}
|
|
5092
|
-
return
|
|
5263
|
+
return _context46.finish(21);
|
|
5093
5264
|
case 25:
|
|
5094
5265
|
case "end":
|
|
5095
|
-
return
|
|
5266
|
+
return _context46.stop();
|
|
5096
5267
|
}
|
|
5097
|
-
},
|
|
5268
|
+
}, _callee46, this, [[14,, 21, 25]]);
|
|
5098
5269
|
}));
|
|
5099
|
-
function getSharedPreparedAvailabilitySnapshot(
|
|
5270
|
+
function getSharedPreparedAvailabilitySnapshot(_x31) {
|
|
5100
5271
|
return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
|
|
5101
5272
|
}
|
|
5102
5273
|
return getSharedPreparedAvailabilitySnapshot;
|
|
@@ -5104,51 +5275,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5104
5275
|
}, {
|
|
5105
5276
|
key: "refreshAvailabilityContextProjection",
|
|
5106
5277
|
value: function () {
|
|
5107
|
-
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5108
|
-
var
|
|
5278
|
+
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
|
|
5279
|
+
var _this17 = this;
|
|
5109
5280
|
var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
|
|
5110
|
-
return _regeneratorRuntime().wrap(function
|
|
5111
|
-
while (1) switch (
|
|
5281
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5282
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
5112
5283
|
case 0:
|
|
5113
5284
|
existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
5114
5285
|
if (!existingInFlight) {
|
|
5115
|
-
|
|
5286
|
+
_context48.next = 5;
|
|
5116
5287
|
break;
|
|
5117
5288
|
}
|
|
5118
|
-
|
|
5289
|
+
_context48.next = 4;
|
|
5119
5290
|
return existingInFlight;
|
|
5120
5291
|
case 4:
|
|
5121
|
-
return
|
|
5292
|
+
return _context48.abrupt("return", _context48.sent);
|
|
5122
5293
|
case 5:
|
|
5123
5294
|
context = this.getAvailabilityContextEntry(params.contextId);
|
|
5124
5295
|
expectedVersion = context.activeVersion;
|
|
5125
5296
|
expectedRefreshNonce = context.refreshNonce;
|
|
5126
5297
|
expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
5127
|
-
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5298
|
+
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
|
|
5128
5299
|
var snapshot, currentContext, projectionEntry;
|
|
5129
|
-
return _regeneratorRuntime().wrap(function
|
|
5130
|
-
while (1) switch (
|
|
5300
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
5301
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
5131
5302
|
case 0:
|
|
5132
|
-
|
|
5133
|
-
return
|
|
5303
|
+
_context47.next = 2;
|
|
5304
|
+
return _this17.buildAvailabilityProjectionSnapshot(_this17.cloneAvailabilityPrepareParams(context.prepareParams), {
|
|
5134
5305
|
durationCandidateAnchorAt: context.durationCandidateAnchorAt
|
|
5135
5306
|
});
|
|
5136
5307
|
case 2:
|
|
5137
|
-
snapshot =
|
|
5138
|
-
currentContext =
|
|
5308
|
+
snapshot = _context47.sent;
|
|
5309
|
+
currentContext = _this17.availabilityContextRegistry.get(params.contextId);
|
|
5139
5310
|
if (currentContext) {
|
|
5140
|
-
|
|
5311
|
+
_context47.next = 6;
|
|
5141
5312
|
break;
|
|
5142
5313
|
}
|
|
5143
|
-
return
|
|
5314
|
+
return _context47.abrupt("return", null);
|
|
5144
5315
|
case 6:
|
|
5145
|
-
if (!(expectedLifecycleGeneration !==
|
|
5146
|
-
|
|
5316
|
+
if (!(expectedLifecycleGeneration !== _this17.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
|
|
5317
|
+
_context47.next = 8;
|
|
5147
5318
|
break;
|
|
5148
5319
|
}
|
|
5149
|
-
return
|
|
5320
|
+
return _context47.abrupt("return", null);
|
|
5150
5321
|
case 8:
|
|
5151
|
-
projectionEntry =
|
|
5322
|
+
projectionEntry = _this17.storeAvailabilityProjectionEntry({
|
|
5152
5323
|
contextId: currentContext.contextId,
|
|
5153
5324
|
prepareParams: snapshot.prepareParams,
|
|
5154
5325
|
prepareKey: currentContext.prepareKey,
|
|
@@ -5156,8 +5327,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5156
5327
|
orderRevision: snapshot.orderRevision,
|
|
5157
5328
|
incrementVersion: true
|
|
5158
5329
|
});
|
|
5159
|
-
|
|
5160
|
-
return
|
|
5330
|
+
_context47.next = 11;
|
|
5331
|
+
return _this17.emitAvailabilityDiagnostic({
|
|
5161
5332
|
action: 'refresh',
|
|
5162
5333
|
contextId: currentContext.contextId,
|
|
5163
5334
|
contextVersion: projectionEntry.contextVersion,
|
|
@@ -5168,33 +5339,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5168
5339
|
reason: params.reason
|
|
5169
5340
|
});
|
|
5170
5341
|
case 11:
|
|
5171
|
-
return
|
|
5342
|
+
return _context47.abrupt("return", projectionEntry);
|
|
5172
5343
|
case 12:
|
|
5173
5344
|
case "end":
|
|
5174
|
-
return
|
|
5345
|
+
return _context47.stop();
|
|
5175
5346
|
}
|
|
5176
|
-
},
|
|
5347
|
+
}, _callee47);
|
|
5177
5348
|
}))();
|
|
5178
5349
|
this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
|
|
5179
|
-
|
|
5180
|
-
|
|
5350
|
+
_context48.prev = 11;
|
|
5351
|
+
_context48.next = 14;
|
|
5181
5352
|
return refreshPromise;
|
|
5182
5353
|
case 14:
|
|
5183
|
-
return
|
|
5354
|
+
return _context48.abrupt("return", _context48.sent);
|
|
5184
5355
|
case 15:
|
|
5185
|
-
|
|
5356
|
+
_context48.prev = 15;
|
|
5186
5357
|
current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
5187
5358
|
if (current === refreshPromise) {
|
|
5188
5359
|
this.availabilityProjectionRefreshInFlight.delete(params.contextId);
|
|
5189
5360
|
}
|
|
5190
|
-
return
|
|
5361
|
+
return _context48.finish(15);
|
|
5191
5362
|
case 19:
|
|
5192
5363
|
case "end":
|
|
5193
|
-
return
|
|
5364
|
+
return _context48.stop();
|
|
5194
5365
|
}
|
|
5195
|
-
},
|
|
5366
|
+
}, _callee48, this, [[11,, 15, 19]]);
|
|
5196
5367
|
}));
|
|
5197
|
-
function refreshAvailabilityContextProjection(
|
|
5368
|
+
function refreshAvailabilityContextProjection(_x32) {
|
|
5198
5369
|
return _refreshAvailabilityContextProjection.apply(this, arguments);
|
|
5199
5370
|
}
|
|
5200
5371
|
return refreshAvailabilityContextProjection;
|
|
@@ -5202,53 +5373,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5202
5373
|
}, {
|
|
5203
5374
|
key: "ensureAvailabilityContextProjection",
|
|
5204
5375
|
value: function () {
|
|
5205
|
-
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5376
|
+
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(contextId, reason) {
|
|
5206
5377
|
var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
|
|
5207
|
-
return _regeneratorRuntime().wrap(function
|
|
5208
|
-
while (1) switch (
|
|
5378
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
5379
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
5209
5380
|
case 0:
|
|
5210
5381
|
retries = 0;
|
|
5211
5382
|
case 1:
|
|
5212
5383
|
if (!(retries < 3)) {
|
|
5213
|
-
|
|
5384
|
+
_context49.next = 19;
|
|
5214
5385
|
break;
|
|
5215
5386
|
}
|
|
5216
5387
|
context = this.getAvailabilityContextEntry(contextId);
|
|
5217
5388
|
currentOrderRevision = this.getCurrentOrderRevision();
|
|
5218
5389
|
projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
|
|
5219
5390
|
if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
|
|
5220
|
-
|
|
5391
|
+
_context49.next = 7;
|
|
5221
5392
|
break;
|
|
5222
5393
|
}
|
|
5223
|
-
return
|
|
5394
|
+
return _context49.abrupt("return", {
|
|
5224
5395
|
context: context,
|
|
5225
5396
|
projectionEntry: projectionEntry,
|
|
5226
5397
|
refreshed: false
|
|
5227
5398
|
});
|
|
5228
5399
|
case 7:
|
|
5229
|
-
|
|
5400
|
+
_context49.next = 9;
|
|
5230
5401
|
return this.refreshAvailabilityContextProjection({
|
|
5231
5402
|
contextId: contextId,
|
|
5232
5403
|
reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
|
|
5233
5404
|
previousOrderRevision: context.lastKnownOrderRevision
|
|
5234
5405
|
});
|
|
5235
5406
|
case 9:
|
|
5236
|
-
refreshedProjectionEntry =
|
|
5407
|
+
refreshedProjectionEntry = _context49.sent;
|
|
5237
5408
|
if (refreshedProjectionEntry) {
|
|
5238
|
-
|
|
5409
|
+
_context49.next = 13;
|
|
5239
5410
|
break;
|
|
5240
5411
|
}
|
|
5241
5412
|
retries += 1;
|
|
5242
|
-
return
|
|
5413
|
+
return _context49.abrupt("continue", 1);
|
|
5243
5414
|
case 13:
|
|
5244
5415
|
if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
5245
|
-
|
|
5416
|
+
_context49.next = 16;
|
|
5246
5417
|
break;
|
|
5247
5418
|
}
|
|
5248
5419
|
retries += 1;
|
|
5249
|
-
return
|
|
5420
|
+
return _context49.abrupt("continue", 1);
|
|
5250
5421
|
case 16:
|
|
5251
|
-
return
|
|
5422
|
+
return _context49.abrupt("return", {
|
|
5252
5423
|
context: this.getAvailabilityContextEntry(contextId),
|
|
5253
5424
|
projectionEntry: refreshedProjectionEntry,
|
|
5254
5425
|
refreshed: true
|
|
@@ -5260,11 +5431,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5260
5431
|
});
|
|
5261
5432
|
case 20:
|
|
5262
5433
|
case "end":
|
|
5263
|
-
return
|
|
5434
|
+
return _context49.stop();
|
|
5264
5435
|
}
|
|
5265
|
-
},
|
|
5436
|
+
}, _callee49, this);
|
|
5266
5437
|
}));
|
|
5267
|
-
function ensureAvailabilityContextProjection(
|
|
5438
|
+
function ensureAvailabilityContextProjection(_x33, _x34) {
|
|
5268
5439
|
return _ensureAvailabilityContextProjection.apply(this, arguments);
|
|
5269
5440
|
}
|
|
5270
5441
|
return ensureAvailabilityContextProjection;
|
|
@@ -5272,18 +5443,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5272
5443
|
}, {
|
|
5273
5444
|
key: "tryAcquireAvailabilityCommitLock",
|
|
5274
5445
|
value: function () {
|
|
5275
|
-
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5446
|
+
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(contextId) {
|
|
5276
5447
|
var _currentContext$activ;
|
|
5277
5448
|
var _waitingContext$activ, waitingContext, currentContext;
|
|
5278
|
-
return _regeneratorRuntime().wrap(function
|
|
5279
|
-
while (1) switch (
|
|
5449
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
5450
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
5280
5451
|
case 0:
|
|
5281
5452
|
if (!this.availabilityCommitLocks.has(contextId)) {
|
|
5282
|
-
|
|
5453
|
+
_context50.next = 5;
|
|
5283
5454
|
break;
|
|
5284
5455
|
}
|
|
5285
5456
|
waitingContext = this.availabilityContextRegistry.get(contextId);
|
|
5286
|
-
|
|
5457
|
+
_context50.next = 4;
|
|
5287
5458
|
return this.emitAvailabilityDiagnostic({
|
|
5288
5459
|
action: 'commit_lock_wait',
|
|
5289
5460
|
contextId: contextId,
|
|
@@ -5300,7 +5471,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5300
5471
|
case 5:
|
|
5301
5472
|
this.availabilityCommitLocks.add(contextId);
|
|
5302
5473
|
currentContext = this.availabilityContextRegistry.get(contextId);
|
|
5303
|
-
|
|
5474
|
+
_context50.next = 9;
|
|
5304
5475
|
return this.emitAvailabilityDiagnostic({
|
|
5305
5476
|
action: 'commit_lock_acquired',
|
|
5306
5477
|
contextId: contextId,
|
|
@@ -5312,11 +5483,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5312
5483
|
});
|
|
5313
5484
|
case 9:
|
|
5314
5485
|
case "end":
|
|
5315
|
-
return
|
|
5486
|
+
return _context50.stop();
|
|
5316
5487
|
}
|
|
5317
|
-
},
|
|
5488
|
+
}, _callee50, this);
|
|
5318
5489
|
}));
|
|
5319
|
-
function tryAcquireAvailabilityCommitLock(
|
|
5490
|
+
function tryAcquireAvailabilityCommitLock(_x35) {
|
|
5320
5491
|
return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
|
|
5321
5492
|
}
|
|
5322
5493
|
return tryAcquireAvailabilityCommitLock;
|
|
@@ -5324,15 +5495,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5324
5495
|
}, {
|
|
5325
5496
|
key: "releaseAvailabilityCommitLock",
|
|
5326
5497
|
value: function () {
|
|
5327
|
-
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5498
|
+
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(contextId) {
|
|
5328
5499
|
var _releasedContext$acti;
|
|
5329
5500
|
var releasedContext;
|
|
5330
|
-
return _regeneratorRuntime().wrap(function
|
|
5331
|
-
while (1) switch (
|
|
5501
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
5502
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
5332
5503
|
case 0:
|
|
5333
5504
|
this.availabilityCommitLocks.delete(contextId);
|
|
5334
5505
|
releasedContext = this.availabilityContextRegistry.get(contextId);
|
|
5335
|
-
|
|
5506
|
+
_context51.next = 4;
|
|
5336
5507
|
return this.emitAvailabilityDiagnostic({
|
|
5337
5508
|
action: 'commit_lock_released',
|
|
5338
5509
|
contextId: contextId,
|
|
@@ -5344,11 +5515,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5344
5515
|
});
|
|
5345
5516
|
case 4:
|
|
5346
5517
|
case "end":
|
|
5347
|
-
return
|
|
5518
|
+
return _context51.stop();
|
|
5348
5519
|
}
|
|
5349
|
-
},
|
|
5520
|
+
}, _callee51, this);
|
|
5350
5521
|
}));
|
|
5351
|
-
function releaseAvailabilityCommitLock(
|
|
5522
|
+
function releaseAvailabilityCommitLock(_x36) {
|
|
5352
5523
|
return _releaseAvailabilityCommitLock.apply(this, arguments);
|
|
5353
5524
|
}
|
|
5354
5525
|
return releaseAvailabilityCommitLock;
|
|
@@ -5356,20 +5527,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5356
5527
|
}, {
|
|
5357
5528
|
key: "prepareAvailabilityProjection",
|
|
5358
5529
|
value: (function () {
|
|
5359
|
-
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5530
|
+
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
|
|
5360
5531
|
var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
|
|
5361
|
-
return _regeneratorRuntime().wrap(function
|
|
5362
|
-
while (1) switch (
|
|
5532
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
5533
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
5363
5534
|
case 0:
|
|
5364
5535
|
this.assertAvailabilityPrepareParams(params);
|
|
5365
|
-
|
|
5536
|
+
_context52.next = 3;
|
|
5366
5537
|
return this.resolveAvailabilityPrepareDefaults(params);
|
|
5367
5538
|
case 3:
|
|
5368
|
-
paramsWithDefaults =
|
|
5369
|
-
|
|
5539
|
+
paramsWithDefaults = _context52.sent;
|
|
5540
|
+
_context52.next = 6;
|
|
5370
5541
|
return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
|
|
5371
5542
|
case 6:
|
|
5372
|
-
_yield$this$getShared =
|
|
5543
|
+
_yield$this$getShared = _context52.sent;
|
|
5373
5544
|
prepareKey = _yield$this$getShared.prepareKey;
|
|
5374
5545
|
snapshot = _yield$this$getShared.snapshot;
|
|
5375
5546
|
contextId = this.createAvailabilityContextId();
|
|
@@ -5390,7 +5561,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5390
5561
|
refreshed: false,
|
|
5391
5562
|
reason: 'prepare'
|
|
5392
5563
|
};
|
|
5393
|
-
|
|
5564
|
+
_context52.next = 16;
|
|
5394
5565
|
return this.emitAvailabilityDiagnostic({
|
|
5395
5566
|
action: 'prepare',
|
|
5396
5567
|
contextId: contextId,
|
|
@@ -5401,17 +5572,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5401
5572
|
reason: 'prepare'
|
|
5402
5573
|
});
|
|
5403
5574
|
case 16:
|
|
5404
|
-
|
|
5575
|
+
_context52.next = 18;
|
|
5405
5576
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
|
|
5406
5577
|
case 18:
|
|
5407
|
-
return
|
|
5578
|
+
return _context52.abrupt("return", handle);
|
|
5408
5579
|
case 19:
|
|
5409
5580
|
case "end":
|
|
5410
|
-
return
|
|
5581
|
+
return _context52.stop();
|
|
5411
5582
|
}
|
|
5412
|
-
},
|
|
5583
|
+
}, _callee52, this);
|
|
5413
5584
|
}));
|
|
5414
|
-
function prepareAvailabilityProjection(
|
|
5585
|
+
function prepareAvailabilityProjection(_x37) {
|
|
5415
5586
|
return _prepareAvailabilityProjection.apply(this, arguments);
|
|
5416
5587
|
}
|
|
5417
5588
|
return prepareAvailabilityProjection;
|
|
@@ -5419,10 +5590,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5419
5590
|
}, {
|
|
5420
5591
|
key: "getProductTimeRanges",
|
|
5421
5592
|
value: (function () {
|
|
5422
|
-
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5593
|
+
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(contextId) {
|
|
5423
5594
|
var _this$otherParams$pla,
|
|
5424
5595
|
_this$otherParams36,
|
|
5425
|
-
|
|
5596
|
+
_this18 = this;
|
|
5426
5597
|
var request,
|
|
5427
5598
|
_yield$this$ensureAva,
|
|
5428
5599
|
context,
|
|
@@ -5431,15 +5602,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5431
5602
|
strictAvailability,
|
|
5432
5603
|
isPosAvailabilityRequest,
|
|
5433
5604
|
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
5434
|
-
|
|
5435
|
-
return _regeneratorRuntime().wrap(function
|
|
5436
|
-
while (1) switch (
|
|
5605
|
+
_args53 = arguments;
|
|
5606
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5607
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
5437
5608
|
case 0:
|
|
5438
|
-
request =
|
|
5439
|
-
|
|
5609
|
+
request = _args53.length > 1 && _args53[1] !== undefined ? _args53[1] : {};
|
|
5610
|
+
_context53.next = 3;
|
|
5440
5611
|
return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
|
|
5441
5612
|
case 3:
|
|
5442
|
-
_yield$this$ensureAva =
|
|
5613
|
+
_yield$this$ensureAva = _context53.sent;
|
|
5443
5614
|
context = _yield$this$ensureAva.context;
|
|
5444
5615
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
5445
5616
|
contextVersion = context.activeVersion;
|
|
@@ -5448,7 +5619,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5448
5619
|
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && !strictAvailability && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
5449
5620
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
5450
5621
|
});
|
|
5451
|
-
return
|
|
5622
|
+
return _context53.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
|
|
5452
5623
|
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
5453
5624
|
} : {}), strictAvailability ? {
|
|
5454
5625
|
allowOutsideOperatingHoursForRequestedStartTimes: false
|
|
@@ -5460,17 +5631,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5460
5631
|
}).map(function (group) {
|
|
5461
5632
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
5462
5633
|
ranges: group.ranges.map(function (candidate) {
|
|
5463
|
-
return
|
|
5634
|
+
return _this18.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
|
|
5464
5635
|
})
|
|
5465
5636
|
});
|
|
5466
5637
|
}));
|
|
5467
5638
|
case 11:
|
|
5468
5639
|
case "end":
|
|
5469
|
-
return
|
|
5640
|
+
return _context53.stop();
|
|
5470
5641
|
}
|
|
5471
|
-
},
|
|
5642
|
+
}, _callee53, this);
|
|
5472
5643
|
}));
|
|
5473
|
-
function getProductTimeRanges(
|
|
5644
|
+
function getProductTimeRanges(_x38) {
|
|
5474
5645
|
return _getProductTimeRanges.apply(this, arguments);
|
|
5475
5646
|
}
|
|
5476
5647
|
return getProductTimeRanges;
|
|
@@ -5478,16 +5649,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5478
5649
|
}, {
|
|
5479
5650
|
key: "queryBookingAvailability",
|
|
5480
5651
|
value: (function () {
|
|
5481
|
-
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5652
|
+
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(contextId, request) {
|
|
5482
5653
|
var _this$otherParams$pla2, _this$otherParams37;
|
|
5483
5654
|
var _yield$this$ensureAva2, context, projectionEntry, refreshed, strictAvailability, isPosAvailabilityRequest, result, contextVersion, contextualResult;
|
|
5484
|
-
return _regeneratorRuntime().wrap(function
|
|
5485
|
-
while (1) switch (
|
|
5655
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5656
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
5486
5657
|
case 0:
|
|
5487
|
-
|
|
5658
|
+
_context54.next = 2;
|
|
5488
5659
|
return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
|
|
5489
5660
|
case 2:
|
|
5490
|
-
_yield$this$ensureAva2 =
|
|
5661
|
+
_yield$this$ensureAva2 = _context54.sent;
|
|
5491
5662
|
context = _yield$this$ensureAva2.context;
|
|
5492
5663
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
5493
5664
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
@@ -5524,18 +5695,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5524
5695
|
});
|
|
5525
5696
|
})
|
|
5526
5697
|
}) : result;
|
|
5527
|
-
return
|
|
5698
|
+
return _context54.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
|
|
5528
5699
|
contextId: context.contextId,
|
|
5529
5700
|
contextVersion: contextVersion,
|
|
5530
5701
|
refreshed: refreshed
|
|
5531
5702
|
}));
|
|
5532
5703
|
case 13:
|
|
5533
5704
|
case "end":
|
|
5534
|
-
return
|
|
5705
|
+
return _context54.stop();
|
|
5535
5706
|
}
|
|
5536
|
-
},
|
|
5707
|
+
}, _callee54, this);
|
|
5537
5708
|
}));
|
|
5538
|
-
function queryBookingAvailability(
|
|
5709
|
+
function queryBookingAvailability(_x39, _x40) {
|
|
5539
5710
|
return _queryBookingAvailability.apply(this, arguments);
|
|
5540
5711
|
}
|
|
5541
5712
|
return queryBookingAvailability;
|
|
@@ -5619,19 +5790,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5619
5790
|
}, {
|
|
5620
5791
|
key: "commitAvailabilitySelection",
|
|
5621
5792
|
value: (function () {
|
|
5622
|
-
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5793
|
+
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(contextId, params) {
|
|
5623
5794
|
var _this$availabilityCon,
|
|
5624
|
-
_params$
|
|
5795
|
+
_params$availabilityC3,
|
|
5625
5796
|
_this$store$order11,
|
|
5626
5797
|
_this$store$order11$e,
|
|
5627
|
-
|
|
5798
|
+
_this19 = this;
|
|
5628
5799
|
var normalizedContextId, isEditingSelection, isPartyReplacement, strictAvailability, hasCommitGuard, guardedOrder, getGuardedCommitIdentity, guardedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref54, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla3, _this$otherParams38, _params$orderProduct$3, _params$orderProduct6, _existingBooking$hold, _existingBooking$meta, _ref55, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$meta3, _existingBooking$hold2, _transformed$metadata, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, relatedRetailProducts, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref56, _transformed$product_4, update, _this$getTempOrder5, _this$getTempOrder6, _params$salesNotes, _params$salesNotes2, _ref57, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
|
|
5629
|
-
return _regeneratorRuntime().wrap(function
|
|
5630
|
-
while (1) switch (
|
|
5800
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5801
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
5631
5802
|
case 0:
|
|
5632
5803
|
normalizedContextId = String(contextId || '').trim();
|
|
5633
5804
|
if (normalizedContextId) {
|
|
5634
|
-
|
|
5805
|
+
_context55.next = 3;
|
|
5635
5806
|
break;
|
|
5636
5807
|
}
|
|
5637
5808
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
|
|
@@ -5641,39 +5812,39 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5641
5812
|
isEditingSelection = params.mode === 'edit' || params.mode === 'replace';
|
|
5642
5813
|
isPartyReplacement = params.mode === 'replace' || params.relatedRetailProducts !== undefined;
|
|
5643
5814
|
if (!(isPartyReplacement && (!isEditingSelection || !Array.isArray(params.relatedRetailProducts)))) {
|
|
5644
|
-
|
|
5815
|
+
_context55.next = 7;
|
|
5645
5816
|
break;
|
|
5646
5817
|
}
|
|
5647
5818
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'Party replacement requires edit/replace mode and the confirmed complete extras array');
|
|
5648
5819
|
case 7:
|
|
5649
5820
|
strictAvailability = ((_this$availabilityCon = this.availabilityContextRegistry.get(normalizedContextId)) === null || _this$availabilityCon === void 0 ? void 0 : _this$availabilityCon.prepareParams.strictAvailability) === true;
|
|
5650
5821
|
hasCommitGuard = strictAvailability || isPartyReplacement || Boolean(params.availabilityCommitGuard);
|
|
5651
|
-
(_params$
|
|
5822
|
+
(_params$availabilityC3 = params.availabilityCommitGuard) === null || _params$availabilityC3 === void 0 || _params$availabilityC3.call(params);
|
|
5652
5823
|
// Stabilize the locally generated sale identity before taking the guard snapshot.
|
|
5653
5824
|
if (hasCommitGuard) (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$e = _this$store$order11.ensureTempOrder) === null || _this$store$order11$e === void 0 || _this$store$order11$e.call(_this$store$order11);
|
|
5654
5825
|
guardedOrder = hasCommitGuard ? this.getTempOrder() : null;
|
|
5655
5826
|
getGuardedCommitIdentity = function getGuardedCommitIdentity() {
|
|
5656
|
-
var
|
|
5827
|
+
var _this19$otherParams$s, _this19$otherParams, _this19$otherParams2, _this19$core, _this19$getTempOrder, _this19$getTempOrder2;
|
|
5657
5828
|
return JSON.stringify(stableValue({
|
|
5658
|
-
scope:
|
|
5659
|
-
shopId: (
|
|
5660
|
-
contextShopId: (
|
|
5661
|
-
orderId: (
|
|
5662
|
-
externalSaleNumber: (
|
|
5829
|
+
scope: _this19.getAvailabilityScopeDescriptor(),
|
|
5830
|
+
shopId: (_this19$otherParams$s = (_this19$otherParams = _this19.otherParams) === null || _this19$otherParams === void 0 ? void 0 : _this19$otherParams.shop_id) !== null && _this19$otherParams$s !== void 0 ? _this19$otherParams$s : (_this19$otherParams2 = _this19.otherParams) === null || _this19$otherParams2 === void 0 ? void 0 : _this19$otherParams2.shopId,
|
|
5831
|
+
contextShopId: (_this19$core = _this19.core) === null || _this19$core === void 0 || (_this19$core = _this19$core.context) === null || _this19$core === void 0 ? void 0 : _this19$core.shop_id,
|
|
5832
|
+
orderId: (_this19$getTempOrder = _this19.getTempOrder()) === null || _this19$getTempOrder === void 0 ? void 0 : _this19$getTempOrder.order_id,
|
|
5833
|
+
externalSaleNumber: (_this19$getTempOrder2 = _this19.getTempOrder()) === null || _this19$getTempOrder2 === void 0 ? void 0 : _this19$getTempOrder2.external_sale_number
|
|
5663
5834
|
}));
|
|
5664
5835
|
};
|
|
5665
5836
|
guardedCommitIdentity = hasCommitGuard ? getGuardedCommitIdentity() : '';
|
|
5666
5837
|
availabilityCommitTargetGuard = function availabilityCommitTargetGuard() {
|
|
5667
|
-
return
|
|
5838
|
+
return _this19.getTempOrder() === guardedOrder && getGuardedCommitIdentity() === guardedCommitIdentity;
|
|
5668
5839
|
};
|
|
5669
5840
|
guardedCommitPublished = false;
|
|
5670
|
-
|
|
5841
|
+
_context55.next = 18;
|
|
5671
5842
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
5672
5843
|
case 18:
|
|
5673
|
-
|
|
5844
|
+
_context55.prev = 18;
|
|
5674
5845
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
5675
5846
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
5676
|
-
|
|
5847
|
+
_context55.next = 22;
|
|
5677
5848
|
break;
|
|
5678
5849
|
}
|
|
5679
5850
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
@@ -5681,7 +5852,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5681
5852
|
});
|
|
5682
5853
|
case 22:
|
|
5683
5854
|
if (!(isEditingSelection && bookingCount !== 1)) {
|
|
5684
|
-
|
|
5855
|
+
_context55.next = 24;
|
|
5685
5856
|
break;
|
|
5686
5857
|
}
|
|
5687
5858
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
@@ -5690,7 +5861,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5690
5861
|
case 24:
|
|
5691
5862
|
orderProductQuantity = (_ref54 = (_params$orderProduct$ = (_params$orderProduct = params.orderProduct) === null || _params$orderProduct === void 0 ? void 0 : _params$orderProduct.num) !== null && _params$orderProduct$ !== void 0 ? _params$orderProduct$ : (_params$orderProduct2 = params.orderProduct) === null || _params$orderProduct2 === void 0 ? void 0 : _params$orderProduct2.quantity) !== null && _ref54 !== void 0 ? _ref54 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
|
|
5692
5863
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
5693
|
-
|
|
5864
|
+
_context55.next = 27;
|
|
5694
5865
|
break;
|
|
5695
5866
|
}
|
|
5696
5867
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
@@ -5700,22 +5871,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5700
5871
|
case 27:
|
|
5701
5872
|
partySize = Number(params.partySize);
|
|
5702
5873
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
5703
|
-
|
|
5874
|
+
_context55.next = 30;
|
|
5704
5875
|
break;
|
|
5705
5876
|
}
|
|
5706
5877
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
5707
5878
|
partySize: params.partySize
|
|
5708
5879
|
});
|
|
5709
5880
|
case 30:
|
|
5710
|
-
|
|
5881
|
+
_context55.next = 32;
|
|
5711
5882
|
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
5712
5883
|
case 32:
|
|
5713
|
-
_yield$this$ensureAva3 =
|
|
5884
|
+
_yield$this$ensureAva3 = _context55.sent;
|
|
5714
5885
|
context = _yield$this$ensureAva3.context;
|
|
5715
5886
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
5716
5887
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
5717
5888
|
if (!refreshed) {
|
|
5718
|
-
|
|
5889
|
+
_context55.next = 38;
|
|
5719
5890
|
break;
|
|
5720
5891
|
}
|
|
5721
5892
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5726,11 +5897,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5726
5897
|
case 38:
|
|
5727
5898
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
5728
5899
|
if (!isEditingSelection) {
|
|
5729
|
-
|
|
5900
|
+
_context55.next = 44;
|
|
5730
5901
|
break;
|
|
5731
5902
|
}
|
|
5732
5903
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
5733
|
-
|
|
5904
|
+
_context55.next = 42;
|
|
5734
5905
|
break;
|
|
5735
5906
|
}
|
|
5736
5907
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -5739,11 +5910,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5739
5910
|
editingProductLineUids: boundEditingUids
|
|
5740
5911
|
});
|
|
5741
5912
|
case 42:
|
|
5742
|
-
|
|
5913
|
+
_context55.next = 46;
|
|
5743
5914
|
break;
|
|
5744
5915
|
case 44:
|
|
5745
5916
|
if (!(boundEditingUids.length > 0)) {
|
|
5746
|
-
|
|
5917
|
+
_context55.next = 46;
|
|
5747
5918
|
break;
|
|
5748
5919
|
}
|
|
5749
5920
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
@@ -5752,7 +5923,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5752
5923
|
});
|
|
5753
5924
|
case 46:
|
|
5754
5925
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
5755
|
-
|
|
5926
|
+
_context55.next = 48;
|
|
5756
5927
|
break;
|
|
5757
5928
|
}
|
|
5758
5929
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5762,7 +5933,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5762
5933
|
});
|
|
5763
5934
|
case 48:
|
|
5764
5935
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
5765
|
-
|
|
5936
|
+
_context55.next = 50;
|
|
5766
5937
|
break;
|
|
5767
5938
|
}
|
|
5768
5939
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -5773,7 +5944,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5773
5944
|
});
|
|
5774
5945
|
case 50:
|
|
5775
5946
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
5776
|
-
|
|
5947
|
+
_context55.next = 52;
|
|
5777
5948
|
break;
|
|
5778
5949
|
}
|
|
5779
5950
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -5785,7 +5956,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5785
5956
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
5786
5957
|
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;
|
|
5787
5958
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
5788
|
-
|
|
5959
|
+
_context55.next = 56;
|
|
5789
5960
|
break;
|
|
5790
5961
|
}
|
|
5791
5962
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
@@ -5794,14 +5965,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5794
5965
|
});
|
|
5795
5966
|
case 56:
|
|
5796
5967
|
if (!(isEditingSelection && !params.productLineUid)) {
|
|
5797
|
-
|
|
5968
|
+
_context55.next = 58;
|
|
5798
5969
|
break;
|
|
5799
5970
|
}
|
|
5800
5971
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
5801
5972
|
case 58:
|
|
5802
5973
|
editingLine = isEditingSelection ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
5803
5974
|
if (!(isEditingSelection && !editingLine)) {
|
|
5804
|
-
|
|
5975
|
+
_context55.next = 61;
|
|
5805
5976
|
break;
|
|
5806
5977
|
}
|
|
5807
5978
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
@@ -5809,7 +5980,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5809
5980
|
});
|
|
5810
5981
|
case 61:
|
|
5811
5982
|
if (!(editingLine && params.mode !== 'replace' && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
5812
|
-
|
|
5983
|
+
_context55.next = 63;
|
|
5813
5984
|
break;
|
|
5814
5985
|
}
|
|
5815
5986
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -5819,7 +5990,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5819
5990
|
});
|
|
5820
5991
|
case 63:
|
|
5821
5992
|
if (Array.isArray(params.requirementSelections)) {
|
|
5822
|
-
|
|
5993
|
+
_context55.next = 65;
|
|
5823
5994
|
break;
|
|
5824
5995
|
}
|
|
5825
5996
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
@@ -5836,7 +6007,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5836
6007
|
};
|
|
5837
6008
|
prepareParams = baseProjection.meta.prepareParams;
|
|
5838
6009
|
if (prepareParams) {
|
|
5839
|
-
|
|
6010
|
+
_context55.next = 70;
|
|
5840
6011
|
break;
|
|
5841
6012
|
}
|
|
5842
6013
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
@@ -5848,7 +6019,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5848
6019
|
})),
|
|
5849
6020
|
includesInjectedRawOccupancies: true
|
|
5850
6021
|
};
|
|
5851
|
-
|
|
6022
|
+
_context55.next = 73;
|
|
5852
6023
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
5853
6024
|
editingProductLineUids: isEditingSelection && params.productLineUid ? [params.productLineUid] : []
|
|
5854
6025
|
}), {
|
|
@@ -5857,13 +6028,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5857
6028
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
5858
6029
|
});
|
|
5859
6030
|
case 73:
|
|
5860
|
-
commitSnapshot =
|
|
6031
|
+
commitSnapshot = _context55.sent;
|
|
5861
6032
|
refreshedProjection = commitSnapshot.projection;
|
|
5862
6033
|
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 : ''))) {
|
|
5863
|
-
|
|
6034
|
+
_context55.next = 80;
|
|
5864
6035
|
break;
|
|
5865
6036
|
}
|
|
5866
|
-
|
|
6037
|
+
_context55.next = 78;
|
|
5867
6038
|
return this.refreshAvailabilityContextProjection({
|
|
5868
6039
|
contextId: normalizedContextId,
|
|
5869
6040
|
reason: 'commit_order_revision_changed',
|
|
@@ -5910,7 +6081,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5910
6081
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
5911
6082
|
});
|
|
5912
6083
|
if (refreshedCandidateBase) {
|
|
5913
|
-
|
|
6084
|
+
_context55.next = 88;
|
|
5914
6085
|
break;
|
|
5915
6086
|
}
|
|
5916
6087
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -5923,7 +6094,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5923
6094
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
5924
6095
|
});
|
|
5925
6096
|
if (product) {
|
|
5926
|
-
|
|
6097
|
+
_context55.next = 91;
|
|
5927
6098
|
break;
|
|
5928
6099
|
}
|
|
5929
6100
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
@@ -5960,7 +6131,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5960
6131
|
});
|
|
5961
6132
|
}
|
|
5962
6133
|
if (validation.ok) {
|
|
5963
|
-
|
|
6134
|
+
_context55.next = 96;
|
|
5964
6135
|
break;
|
|
5965
6136
|
}
|
|
5966
6137
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -5983,7 +6154,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5983
6154
|
incrementVersion: true
|
|
5984
6155
|
});
|
|
5985
6156
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
5986
|
-
|
|
6157
|
+
_context55.next = 100;
|
|
5987
6158
|
return this.emitAvailabilityDiagnostic({
|
|
5988
6159
|
action: 'refresh',
|
|
5989
6160
|
contextId: normalizedContextId,
|
|
@@ -6005,11 +6176,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6005
6176
|
refreshedCandidate = this.decorateAvailabilityCandidate(normalizedContextId, revalidatedContext.activeVersion, refreshedCandidateBase); // Order may await line/runtime setup. Its guarded transaction invokes this
|
|
6006
6177
|
// again immediately before publishing, while the live cart is unchanged.
|
|
6007
6178
|
availabilityCommitGuard = hasCommitGuard ? function () {
|
|
6008
|
-
var _params$
|
|
6009
|
-
(_params$
|
|
6010
|
-
|
|
6179
|
+
var _params$availabilityC4;
|
|
6180
|
+
(_params$availabilityC4 = params.availabilityCommitGuard) === null || _params$availabilityC4 === void 0 || _params$availabilityC4.call(params);
|
|
6181
|
+
_this19.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
6011
6182
|
if (!availabilityCommitTargetGuard()) {
|
|
6012
|
-
throw
|
|
6183
|
+
throw _this19.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '预约加购期间订单或业务已变化');
|
|
6013
6184
|
}
|
|
6014
6185
|
if (!strictAvailability) return;
|
|
6015
6186
|
var currentValidation = validateAvailabilitySelection(refreshedProjection, {
|
|
@@ -6027,7 +6198,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6027
6198
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
6028
6199
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
6029
6200
|
if (!(isEditingSelection && !existingBookingUid)) {
|
|
6030
|
-
|
|
6201
|
+
_context55.next = 107;
|
|
6031
6202
|
break;
|
|
6032
6203
|
}
|
|
6033
6204
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
@@ -6054,7 +6225,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6054
6225
|
quantity: bookingCount
|
|
6055
6226
|
}), 'unified_booking_sales', product);
|
|
6056
6227
|
if (transformed) {
|
|
6057
|
-
|
|
6228
|
+
_context55.next = 113;
|
|
6058
6229
|
break;
|
|
6059
6230
|
}
|
|
6060
6231
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
@@ -6075,12 +6246,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6075
6246
|
productLineUids = [];
|
|
6076
6247
|
bookingUids = [];
|
|
6077
6248
|
if (!(isPartyReplacement && editingLine && params.productLineUid)) {
|
|
6078
|
-
|
|
6249
|
+
_context55.next = 130;
|
|
6079
6250
|
break;
|
|
6080
6251
|
}
|
|
6081
6252
|
relatedRetailProducts = params.relatedRetailProducts.map(function (source) {
|
|
6082
|
-
var
|
|
6253
|
+
var _line$metadata3;
|
|
6254
|
+
var line = _this19.buildUnifiedOrderProduct(source, 'unified_booking_sales_retail');
|
|
6083
6255
|
if (!line) throw new AvailabilityError('INVALID_TARGET_FILTER', '无法生成附加商品订单行');
|
|
6256
|
+
if (((_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.venue_booking_role) === 'party_extra') {
|
|
6257
|
+
line.holder_config = {
|
|
6258
|
+
status: 'disable',
|
|
6259
|
+
required: 0
|
|
6260
|
+
};
|
|
6261
|
+
line.metadata.holder_config = {
|
|
6262
|
+
status: 'disable',
|
|
6263
|
+
required: 0
|
|
6264
|
+
};
|
|
6265
|
+
}
|
|
6084
6266
|
// This is the only replacement-specific UID restore. Order checks ownership/collisions.
|
|
6085
6267
|
var sourceUid = getProductLineUid(source);
|
|
6086
6268
|
if (sourceUid) {
|
|
@@ -6090,7 +6272,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6090
6272
|
}
|
|
6091
6273
|
return line;
|
|
6092
6274
|
});
|
|
6093
|
-
|
|
6275
|
+
_context55.next = 123;
|
|
6094
6276
|
return this.store.order.replaceBookingProductWithRelatedRetail({
|
|
6095
6277
|
productLineUid: params.productLineUid,
|
|
6096
6278
|
product: transformed,
|
|
@@ -6105,11 +6287,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6105
6287
|
bookingUid = existingBookingUid;
|
|
6106
6288
|
productLineUids = [productLineUid];
|
|
6107
6289
|
bookingUids = [bookingUid];
|
|
6108
|
-
|
|
6290
|
+
_context55.next = 164;
|
|
6109
6291
|
break;
|
|
6110
6292
|
case 130:
|
|
6111
6293
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
6112
|
-
|
|
6294
|
+
_context55.next = 150;
|
|
6113
6295
|
break;
|
|
6114
6296
|
}
|
|
6115
6297
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -6131,27 +6313,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6131
6313
|
allow_booking_discount_reapply: params.allowBookingDiscountReapply
|
|
6132
6314
|
} : {});
|
|
6133
6315
|
if (!availabilityCommitGuard) {
|
|
6134
|
-
|
|
6316
|
+
_context55.next = 142;
|
|
6135
6317
|
break;
|
|
6136
6318
|
}
|
|
6137
|
-
|
|
6319
|
+
_context55.next = 139;
|
|
6138
6320
|
return this.updateOrderProducts([update], {
|
|
6139
6321
|
beforeApply: availabilityCommitGuard,
|
|
6140
6322
|
isCurrentOrder: availabilityCommitTargetGuard
|
|
6141
6323
|
});
|
|
6142
6324
|
case 139:
|
|
6143
6325
|
guardedCommitPublished = true;
|
|
6144
|
-
|
|
6326
|
+
_context55.next = 144;
|
|
6145
6327
|
break;
|
|
6146
6328
|
case 142:
|
|
6147
|
-
|
|
6329
|
+
_context55.next = 144;
|
|
6148
6330
|
return this.updateOrderProduct(update);
|
|
6149
6331
|
case 144:
|
|
6150
6332
|
productLineUid = params.productLineUid;
|
|
6151
6333
|
bookingUid = existingBookingUid;
|
|
6152
6334
|
productLineUids = [productLineUid];
|
|
6153
6335
|
bookingUids = [bookingUid];
|
|
6154
|
-
|
|
6336
|
+
_context55.next = 164;
|
|
6155
6337
|
break;
|
|
6156
6338
|
case 150:
|
|
6157
6339
|
beforeProductLineUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || []).map(function (line) {
|
|
@@ -6161,7 +6343,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6161
6343
|
return getBookingUid(item);
|
|
6162
6344
|
}).filter(Boolean));
|
|
6163
6345
|
availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
|
|
6164
|
-
|
|
6346
|
+
_context55.next = 155;
|
|
6165
6347
|
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 ? {
|
|
6166
6348
|
salesNotes: params.salesNotes
|
|
6167
6349
|
} : {}), availabilityCommitGuard ? {
|
|
@@ -6169,11 +6351,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6169
6351
|
availabilityCommitTargetGuard: availabilityCommitTargetGuard
|
|
6170
6352
|
} : {}) : undefined);
|
|
6171
6353
|
case 155:
|
|
6172
|
-
products =
|
|
6354
|
+
products = _context55.sent;
|
|
6173
6355
|
guardedCommitPublished = hasCommitGuard;
|
|
6174
6356
|
addedLines = products.filter(function (line) {
|
|
6175
|
-
var _line$product_id, _line$
|
|
6176
|
-
return sameAvailabilityId((_line$product_id = line.product_id) !== null && _line$product_id !== void 0 ? _line$product_id : line.id, refreshedCandidate.productId) && ((_line$
|
|
6357
|
+
var _line$product_id, _line$metadata4;
|
|
6358
|
+
return sameAvailabilityId((_line$product_id = line.product_id) !== null && _line$product_id !== void 0 ? _line$product_id : line.id, refreshedCandidate.productId) && ((_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.availability_candidate_key) === refreshedCandidate.key && !beforeProductLineUids.has(getProductLineUid(line));
|
|
6177
6359
|
});
|
|
6178
6360
|
productLineUids = addedLines.map(function (line) {
|
|
6179
6361
|
return getProductLineUid(line);
|
|
@@ -6187,8 +6369,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6187
6369
|
}).filter(Boolean);
|
|
6188
6370
|
if (bookingUids.length === 0) {
|
|
6189
6371
|
bookingUids = addedLines.map(function (line) {
|
|
6190
|
-
var _ref58, _line$booking_uid, _line$
|
|
6191
|
-
return String((_ref58 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$
|
|
6372
|
+
var _ref58, _line$booking_uid, _line$metadata5;
|
|
6373
|
+
return String((_ref58 = (_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 && _ref58 !== void 0 ? _ref58 : '');
|
|
6192
6374
|
}).filter(Boolean);
|
|
6193
6375
|
}
|
|
6194
6376
|
productLineUid = productLineUids[productLineUids.length - 1] || '';
|
|
@@ -6209,60 +6391,60 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6209
6391
|
bookingUids: bookingUids
|
|
6210
6392
|
};
|
|
6211
6393
|
if (!targetStillCurrent) {
|
|
6212
|
-
|
|
6394
|
+
_context55.next = 182;
|
|
6213
6395
|
break;
|
|
6214
6396
|
}
|
|
6215
6397
|
// A notification failure after publication must not invite a duplicate add.
|
|
6216
6398
|
emit = function emit() {
|
|
6217
|
-
return
|
|
6399
|
+
return _this19.core.effects.emit("".concat(_this19.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
6218
6400
|
};
|
|
6219
6401
|
if (!guardedCommitPublished) {
|
|
6220
|
-
|
|
6402
|
+
_context55.next = 180;
|
|
6221
6403
|
break;
|
|
6222
6404
|
}
|
|
6223
|
-
|
|
6224
|
-
|
|
6405
|
+
_context55.prev = 171;
|
|
6406
|
+
_context55.next = 174;
|
|
6225
6407
|
return emit();
|
|
6226
6408
|
case 174:
|
|
6227
|
-
|
|
6409
|
+
_context55.next = 178;
|
|
6228
6410
|
break;
|
|
6229
6411
|
case 176:
|
|
6230
|
-
|
|
6231
|
-
|
|
6412
|
+
_context55.prev = 176;
|
|
6413
|
+
_context55.t0 = _context55["catch"](171);
|
|
6232
6414
|
case 178:
|
|
6233
|
-
|
|
6415
|
+
_context55.next = 182;
|
|
6234
6416
|
break;
|
|
6235
6417
|
case 180:
|
|
6236
|
-
|
|
6418
|
+
_context55.next = 182;
|
|
6237
6419
|
return emit();
|
|
6238
6420
|
case 182:
|
|
6239
|
-
return
|
|
6421
|
+
return _context55.abrupt("return", result);
|
|
6240
6422
|
case 183:
|
|
6241
|
-
|
|
6423
|
+
_context55.prev = 183;
|
|
6242
6424
|
release = this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
6243
6425
|
if (!guardedCommitPublished) {
|
|
6244
|
-
|
|
6426
|
+
_context55.next = 190;
|
|
6245
6427
|
break;
|
|
6246
6428
|
}
|
|
6247
|
-
|
|
6429
|
+
_context55.next = 188;
|
|
6248
6430
|
return release.catch(function () {
|
|
6249
6431
|
return undefined;
|
|
6250
6432
|
});
|
|
6251
6433
|
case 188:
|
|
6252
|
-
|
|
6434
|
+
_context55.next = 192;
|
|
6253
6435
|
break;
|
|
6254
6436
|
case 190:
|
|
6255
|
-
|
|
6437
|
+
_context55.next = 192;
|
|
6256
6438
|
return release;
|
|
6257
6439
|
case 192:
|
|
6258
|
-
return
|
|
6440
|
+
return _context55.finish(183);
|
|
6259
6441
|
case 193:
|
|
6260
6442
|
case "end":
|
|
6261
|
-
return
|
|
6443
|
+
return _context55.stop();
|
|
6262
6444
|
}
|
|
6263
|
-
},
|
|
6445
|
+
}, _callee55, this, [[18,, 183, 193], [171, 176]]);
|
|
6264
6446
|
}));
|
|
6265
|
-
function commitAvailabilitySelection(
|
|
6447
|
+
function commitAvailabilitySelection(_x41, _x42) {
|
|
6266
6448
|
return _commitAvailabilitySelection.apply(this, arguments);
|
|
6267
6449
|
}
|
|
6268
6450
|
return commitAvailabilitySelection;
|