@pisell/pisellos 2.3.129 → 2.3.131
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/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/modules/BusinessAvailability/index.d.ts +30 -0
- package/dist/modules/BusinessAvailability/index.js +204 -0
- package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
- package/dist/modules/FulfillmentTiming/index.js +407 -0
- package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
- package/dist/modules/FulfillmentTiming/types.js +1 -0
- package/dist/modules/OpenData/types.d.ts +8 -0
- package/dist/modules/Order/index.d.ts +11 -2
- package/dist/modules/Order/index.js +370 -253
- package/dist/modules/Order/pickupTiming.d.ts +46 -0
- package/dist/modules/Order/pickupTiming.js +53 -0
- package/dist/modules/Order/types.d.ts +13 -1
- package/dist/modules/Order/utils.js +16 -6
- package/dist/modules/Payment/index.js +9 -10
- package/dist/modules/Schedule/index.d.ts +8 -0
- package/dist/modules/Schedule/index.js +141 -39
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/request.d.ts +7 -0
- package/dist/server/utils/small-ticket.d.ts +1 -85
- package/dist/server/utils/small-ticket.js +2 -2542
- package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/dist/shared/payment/loadPaymentMethods.js +66 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts +22 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.js +142 -0
- package/dist/shared/receipt/small-ticket.d.ts +85 -0
- package/dist/shared/receipt/small-ticket.js +2576 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
- package/dist/solution/BaseSales/index.d.ts +28 -15
- package/dist/solution/BaseSales/index.js +1346 -1101
- package/dist/solution/BaseSales/pickupTiming.d.ts +43 -0
- package/dist/solution/BaseSales/pickupTiming.js +589 -0
- package/dist/solution/BaseSales/types.d.ts +11 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.js +41 -13
- package/dist/solution/BookingTicket/utils/cartView.js +3 -1
- package/dist/solution/OrderInvoicePreview/index.d.ts +56 -0
- package/dist/solution/OrderInvoicePreview/index.js +269 -0
- package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/businessAvailability.js +292 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +24 -4
- package/dist/solution/UnifiedBookingSales/index.js +953 -709
- package/dist/solution/UnifiedBookingSales/types.d.ts +2 -0
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +21 -1
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/BusinessAvailability/index.d.ts +30 -0
- package/lib/modules/BusinessAvailability/index.js +146 -0
- package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
- package/lib/modules/FulfillmentTiming/index.js +359 -0
- package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
- package/lib/modules/FulfillmentTiming/types.js +5 -0
- package/lib/modules/OpenData/types.d.ts +8 -0
- package/lib/modules/Order/index.d.ts +11 -2
- package/lib/modules/Order/index.js +101 -14
- package/lib/modules/Order/pickupTiming.d.ts +46 -0
- package/lib/modules/Order/pickupTiming.js +61 -0
- package/lib/modules/Order/types.d.ts +13 -1
- package/lib/modules/Order/utils.js +12 -4
- package/lib/modules/Payment/index.js +3 -4
- package/lib/modules/Schedule/index.d.ts +8 -0
- package/lib/modules/Schedule/index.js +68 -12
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +11 -0
- package/lib/plugins/request.d.ts +7 -0
- package/lib/server/utils/small-ticket.d.ts +1 -85
- package/lib/server/utils/small-ticket.js +9 -2305
- package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/lib/shared/payment/loadPaymentMethods.js +40 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.d.ts +22 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.js +86 -0
- package/lib/shared/receipt/small-ticket.d.ts +85 -0
- package/lib/shared/receipt/small-ticket.js +2342 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
- package/lib/solution/BaseSales/index.d.ts +28 -15
- package/lib/solution/BaseSales/index.js +161 -25
- package/lib/solution/BaseSales/pickupTiming.d.ts +43 -0
- package/lib/solution/BaseSales/pickupTiming.js +269 -0
- package/lib/solution/BaseSales/types.d.ts +11 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.js +37 -4
- package/lib/solution/BookingTicket/utils/cartView.js +3 -1
- package/lib/solution/OrderInvoicePreview/index.d.ts +56 -0
- package/lib/solution/OrderInvoicePreview/index.js +192 -0
- package/lib/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/businessAvailability.js +138 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +24 -4
- package/lib/solution/UnifiedBookingSales/index.js +184 -46
- package/lib/solution/UnifiedBookingSales/types.d.ts +2 -0
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +11 -0
- package/package.json +1 -1
|
@@ -42,6 +42,7 @@ import { getScheduleStartEndTimePoints } from "../../modules/Schedule/getDateIsI
|
|
|
42
42
|
import { AvailabilityError, createAvailabilityProjection, getProductTimeRanges as getProjectionProductTimeRanges, queryAvailabilityProjection, validateAvailabilitySelection } from "../../modules/ResourcePlanner";
|
|
43
43
|
import { UnifiedBookingSalesHooks } from "./types";
|
|
44
44
|
import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
|
|
45
|
+
import { BusinessAvailabilityController } from "./businessAvailability";
|
|
45
46
|
import { BookingTicket } from "../BookingTicket";
|
|
46
47
|
import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
|
|
47
48
|
import { isCustomerUserPlatform, normalizeRuntimePlatform } from "../../utils/platform";
|
|
@@ -49,7 +50,6 @@ import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
|
49
50
|
export * from "./types";
|
|
50
51
|
export { AvailabilityError } from "../../modules/ResourcePlanner";
|
|
51
52
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability'];
|
|
52
|
-
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
53
53
|
function normalizePositiveInteger(value) {
|
|
54
54
|
var normalized = Number(value);
|
|
55
55
|
if (!Number.isInteger(normalized) || normalized <= 0) return undefined;
|
|
@@ -1314,6 +1314,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1314
1314
|
_defineProperty(_assertThisInitialized(_this), "defaultName", 'unifiedBookingSales');
|
|
1315
1315
|
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
|
|
1316
1316
|
_defineProperty(_assertThisInitialized(_this), "store", {});
|
|
1317
|
+
_defineProperty(_assertThisInitialized(_this), "pickupTimingEnabled", true);
|
|
1318
|
+
_defineProperty(_assertThisInitialized(_this), "businessAvailabilityController", void 0);
|
|
1319
|
+
_defineProperty(_assertThisInitialized(_this), "runtimeOpenDataScope", null);
|
|
1320
|
+
_defineProperty(_assertThisInitialized(_this), "runtimeOpenDataSnapshot", null);
|
|
1321
|
+
_defineProperty(_assertThisInitialized(_this), "runtimeOpenDataModule", null);
|
|
1322
|
+
_defineProperty(_assertThisInitialized(_this), "runtimeOpenDataCore", void 0);
|
|
1323
|
+
_defineProperty(_assertThisInitialized(_this), "runtimeOpenDataGeneration", 0);
|
|
1324
|
+
_defineProperty(_assertThisInitialized(_this), "runtimeOpenDataDestroyed", false);
|
|
1317
1325
|
_defineProperty(_assertThisInitialized(_this), "unifiedProductCatalog", []);
|
|
1318
1326
|
_defineProperty(_assertThisInitialized(_this), "availabilityRuntimeOffsetMinutes", null);
|
|
1319
1327
|
_defineProperty(_assertThisInitialized(_this), "availabilityScheduleCatalog", null);
|
|
@@ -1338,30 +1346,31 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1338
1346
|
key: "initialize",
|
|
1339
1347
|
value: function () {
|
|
1340
1348
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core) {
|
|
1341
|
-
var _ref23, _this$otherParams$bus, _this$otherParams, _this$otherParams2, _this$otherParams$cha, _this$otherParams3, _this$otherParams4;
|
|
1342
1349
|
var options,
|
|
1343
|
-
|
|
1344
|
-
openDataChannel,
|
|
1350
|
+
openDataGeneration,
|
|
1345
1351
|
_args = arguments;
|
|
1346
1352
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1347
1353
|
while (1) switch (_context.prev = _context.next) {
|
|
1348
1354
|
case 0:
|
|
1349
1355
|
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
1356
|
+
this.resetRuntimeOpenData();
|
|
1357
|
+
this.runtimeOpenDataDestroyed = false;
|
|
1358
|
+
openDataGeneration = this.runtimeOpenDataGeneration;
|
|
1350
1359
|
this.availabilityScheduleCatalog = null;
|
|
1351
|
-
this.openDataTarget = null;
|
|
1352
1360
|
this.availabilityRuntimeOffsetMinutes = captureRuntimeOffsetMinutes();
|
|
1353
1361
|
this.clearAvailabilityRemoteResourceState();
|
|
1354
1362
|
this.resetAllergyItemRuleState();
|
|
1355
|
-
_context.next =
|
|
1363
|
+
_context.next = 10;
|
|
1356
1364
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "initialize", this).call(this, core, options);
|
|
1357
|
-
case
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
this.openDataTarget = "".concat(openDataBusinessCode, "+").concat(openDataChannel);
|
|
1365
|
+
case 10:
|
|
1366
|
+
if (!(this.runtimeOpenDataDestroyed || openDataGeneration !== this.runtimeOpenDataGeneration)) {
|
|
1367
|
+
_context.next = 12;
|
|
1368
|
+
break;
|
|
1362
1369
|
}
|
|
1363
|
-
|
|
1370
|
+
throw new Error('Store settings changed. Please try again.');
|
|
1364
1371
|
case 12:
|
|
1372
|
+
this.captureAvailabilityScheduleCatalog();
|
|
1373
|
+
case 13:
|
|
1365
1374
|
case "end":
|
|
1366
1375
|
return _context.stop();
|
|
1367
1376
|
}
|
|
@@ -1375,10 +1384,86 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1375
1384
|
}, {
|
|
1376
1385
|
key: "getSubmitOrderSalesChannel",
|
|
1377
1386
|
value: function getSubmitOrderSalesChannel() {
|
|
1378
|
-
var _this$otherParams$
|
|
1379
|
-
var channel = String((_this$otherParams$
|
|
1387
|
+
var _this$otherParams$cha, _this$otherParams;
|
|
1388
|
+
var channel = String((_this$otherParams$cha = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
|
|
1380
1389
|
return channel || _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "getSubmitOrderSalesChannel", this).call(this);
|
|
1381
1390
|
}
|
|
1391
|
+
|
|
1392
|
+
/** Only the explicit Kiosk Sales consumer entry enables this policy; POS stays unchanged. */
|
|
1393
|
+
}, {
|
|
1394
|
+
key: "isBusinessAvailabilityEnabled",
|
|
1395
|
+
value: function isBusinessAvailabilityEnabled() {
|
|
1396
|
+
var _this$otherParams2, _this$otherParams3;
|
|
1397
|
+
return ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.enableBusinessAvailability) === true && ['pc', 'h5', 'kiosk'].includes(normalizeRuntimePlatform((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.platform));
|
|
1398
|
+
}
|
|
1399
|
+
}, {
|
|
1400
|
+
key: "getBusinessAvailabilityScope",
|
|
1401
|
+
value: function getBusinessAvailabilityScope() {
|
|
1402
|
+
return "".concat(this.getRuntimeOpenDataScope(), ":").concat(this.runtimeOpenDataGeneration);
|
|
1403
|
+
}
|
|
1404
|
+
}, {
|
|
1405
|
+
key: "getBusinessAvailabilityController",
|
|
1406
|
+
value: function getBusinessAvailabilityController() {
|
|
1407
|
+
var _this2 = this;
|
|
1408
|
+
if (!this.businessAvailabilityController) {
|
|
1409
|
+
this.businessAvailabilityController = new BusinessAvailabilityController({
|
|
1410
|
+
loadOpenData: function loadOpenData() {
|
|
1411
|
+
return _this2.loadOpenDataConfig();
|
|
1412
|
+
},
|
|
1413
|
+
getSchedule: function getSchedule() {
|
|
1414
|
+
return _this2.store.schedule;
|
|
1415
|
+
},
|
|
1416
|
+
getTimezone: function getTimezone() {
|
|
1417
|
+
var _this2$otherParams;
|
|
1418
|
+
return String(((_this2$otherParams = _this2.otherParams) === null || _this2$otherParams === void 0 ? void 0 : _this2$otherParams.businessTimezone) || _this2.getPickupTimingContextData('timezone') || '');
|
|
1419
|
+
},
|
|
1420
|
+
getScope: function getScope() {
|
|
1421
|
+
return _this2.getBusinessAvailabilityScope();
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
return this.businessAvailabilityController;
|
|
1426
|
+
}
|
|
1427
|
+
}, {
|
|
1428
|
+
key: "getBusinessAvailability",
|
|
1429
|
+
value: function getBusinessAvailability() {
|
|
1430
|
+
return this.getBusinessAvailabilityController().getAvailability();
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
/** Internal final-write assertion; does not fetch OpenData or Schedule. */
|
|
1434
|
+
}, {
|
|
1435
|
+
key: "assertBusinessAvailability",
|
|
1436
|
+
value: function assertBusinessAvailability() {
|
|
1437
|
+
if (this.isBusinessAvailabilityEnabled()) this.getBusinessAvailabilityController().assertAvailable();
|
|
1438
|
+
}
|
|
1439
|
+
}, {
|
|
1440
|
+
key: "getSubModuleHooks",
|
|
1441
|
+
value: function getSubModuleHooks(moduleName) {
|
|
1442
|
+
var _this3 = this;
|
|
1443
|
+
var hooks = _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "getSubModuleHooks", this).call(this, moduleName);
|
|
1444
|
+
if (moduleName !== 'order' || !this.isBusinessAvailabilityEnabled()) return hooks;
|
|
1445
|
+
var lastScope;
|
|
1446
|
+
var lastExistingScope;
|
|
1447
|
+
var scopeToken = {};
|
|
1448
|
+
return _objectSpread(_objectSpread({}, hooks), {}, {
|
|
1449
|
+
getCartIntentScope: function getCartIntentScope() {
|
|
1450
|
+
var _hooks$getCartIntentS;
|
|
1451
|
+
var scope = _this3.getBusinessAvailabilityScope();
|
|
1452
|
+
var existingScope = hooks === null || hooks === void 0 || (_hooks$getCartIntentS = hooks.getCartIntentScope) === null || _hooks$getCartIntentS === void 0 ? void 0 : _hooks$getCartIntentS.call(hooks);
|
|
1453
|
+
if (scope !== lastScope || !Object.is(existingScope, lastExistingScope)) {
|
|
1454
|
+
lastScope = scope;
|
|
1455
|
+
lastExistingScope = existingScope;
|
|
1456
|
+
scopeToken = {};
|
|
1457
|
+
}
|
|
1458
|
+
return scopeToken;
|
|
1459
|
+
},
|
|
1460
|
+
beforeCartIntentCommit: function beforeCartIntentCommit(context) {
|
|
1461
|
+
var _hooks$beforeCartInte;
|
|
1462
|
+
_this3.assertBusinessAvailability();
|
|
1463
|
+
hooks === null || hooks === void 0 || (_hooks$beforeCartInte = hooks.beforeCartIntentCommit) === null || _hooks$beforeCartInte === void 0 || _hooks$beforeCartInte.call(hooks, context);
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1382
1467
|
}, {
|
|
1383
1468
|
key: "createAvailabilityFacadeError",
|
|
1384
1469
|
value: function createAvailabilityFacadeError(code, message, details) {
|
|
@@ -1387,11 +1472,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1387
1472
|
}, {
|
|
1388
1473
|
key: "getAvailabilityScopeDescriptor",
|
|
1389
1474
|
value: function getAvailabilityScopeDescriptor() {
|
|
1390
|
-
var
|
|
1475
|
+
var _ref23, _otherParams$business, _otherParams$channel, _otherParams$platform, _otherParams$business2;
|
|
1391
1476
|
var otherParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.otherParams || {};
|
|
1392
1477
|
return {
|
|
1393
1478
|
cacheId: this.cacheId || '',
|
|
1394
|
-
businessCode: String((
|
|
1479
|
+
businessCode: String((_ref23 = (_otherParams$business = otherParams.businessCode) !== null && _otherParams$business !== void 0 ? _otherParams$business : otherParams.business_code) !== null && _ref23 !== void 0 ? _ref23 : ''),
|
|
1395
1480
|
channel: String((_otherParams$channel = otherParams.channel) !== null && _otherParams$channel !== void 0 ? _otherParams$channel : ''),
|
|
1396
1481
|
platform: String((_otherParams$platform = otherParams.platform) !== null && _otherParams$platform !== void 0 ? _otherParams$platform : ''),
|
|
1397
1482
|
businessTimezone: String((_otherParams$business2 = otherParams.businessTimezone) !== null && _otherParams$business2 !== void 0 ? _otherParams$business2 : '')
|
|
@@ -1405,15 +1490,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1405
1490
|
values.forEach(function (value) {
|
|
1406
1491
|
uniqueMap.set(String(value), value);
|
|
1407
1492
|
});
|
|
1408
|
-
return Array.from(uniqueMap.entries()).sort(function (
|
|
1493
|
+
return Array.from(uniqueMap.entries()).sort(function (_ref24, _ref25) {
|
|
1494
|
+
var _ref26 = _slicedToArray(_ref24, 1),
|
|
1495
|
+
left = _ref26[0];
|
|
1409
1496
|
var _ref27 = _slicedToArray(_ref25, 1),
|
|
1410
|
-
|
|
1411
|
-
var _ref28 = _slicedToArray(_ref26, 1),
|
|
1412
|
-
right = _ref28[0];
|
|
1497
|
+
right = _ref27[0];
|
|
1413
1498
|
return left.localeCompare(right);
|
|
1414
|
-
}).map(function (
|
|
1415
|
-
var
|
|
1416
|
-
value =
|
|
1499
|
+
}).map(function (_ref28) {
|
|
1500
|
+
var _ref29 = _slicedToArray(_ref28, 2),
|
|
1501
|
+
value = _ref29[1];
|
|
1417
1502
|
return value;
|
|
1418
1503
|
});
|
|
1419
1504
|
}
|
|
@@ -1428,9 +1513,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1428
1513
|
}, {
|
|
1429
1514
|
key: "normalizeAvailabilityPrepareDescriptor",
|
|
1430
1515
|
value: function normalizeAvailabilityPrepareDescriptor(params) {
|
|
1431
|
-
var _this$
|
|
1516
|
+
var _this$otherParams4;
|
|
1432
1517
|
this.assertAvailabilityPrepareParams(params);
|
|
1433
|
-
var timezone = String(params.timezone || ((_this$
|
|
1518
|
+
var timezone = String(params.timezone || ((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.businessTimezone) || Intl.DateTimeFormat().resolvedOptions().timeZone || 'Asia/Shanghai');
|
|
1434
1519
|
assertValidAvailabilityTimezone(timezone);
|
|
1435
1520
|
var dateRange = this.normalizeAvailabilityDateRange(params, timezone);
|
|
1436
1521
|
var slotStepMinutes = params.slotStepMinutes || DEFAULT_AVAILABILITY_SLOT_STEP_MINUTES;
|
|
@@ -1460,7 +1545,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1460
1545
|
key: "resolveAvailabilityPrepareDefaults",
|
|
1461
1546
|
value: function () {
|
|
1462
1547
|
var _resolveAvailabilityPrepareDefaults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
1463
|
-
var
|
|
1548
|
+
var _ref30, _this$otherParams$bus, _this$otherParams5, _this$otherParams6, _this$otherParams$cha2, _this$otherParams7, _this$otherParams8, _openData, _openData2, _openData3;
|
|
1464
1549
|
var needsOperatingHours, needsTimeSlice, businessCode, channel, currentTarget, openData, operatingScheduleIds, configuredTimeSlice;
|
|
1465
1550
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1466
1551
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -1478,10 +1563,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1478
1563
|
}
|
|
1479
1564
|
}));
|
|
1480
1565
|
case 4:
|
|
1481
|
-
businessCode = String((
|
|
1482
|
-
channel = String((_this$otherParams$
|
|
1566
|
+
businessCode = String((_ref30 = (_this$otherParams$bus = (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.business_code) !== null && _ref30 !== void 0 ? _ref30 : '').trim();
|
|
1567
|
+
channel = String((_this$otherParams$cha2 = (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.channel) !== null && _this$otherParams$cha2 !== void 0 ? _this$otherParams$cha2 : '').trim();
|
|
1483
1568
|
currentTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : null;
|
|
1484
|
-
openData = !currentTarget || this.openDataTarget === currentTarget ? (_this$
|
|
1569
|
+
openData = (!currentTarget || this.openDataTarget === currentTarget) && (this.runtimeOpenDataScope === null || this.runtimeOpenDataScope === this.getRuntimeOpenDataScope()) ? (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.openData : null;
|
|
1485
1570
|
if (!(!openData && this.store.openData)) {
|
|
1486
1571
|
_context2.next = 20;
|
|
1487
1572
|
break;
|
|
@@ -1571,45 +1656,50 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1571
1656
|
key: "setOtherParams",
|
|
1572
1657
|
value: function () {
|
|
1573
1658
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
1574
|
-
var _this$
|
|
1575
|
-
var
|
|
1576
|
-
|
|
1659
|
+
var _this$otherParams9, _this$otherParams11;
|
|
1660
|
+
var _ref31,
|
|
1661
|
+
_ref31$cover,
|
|
1577
1662
|
cover,
|
|
1578
1663
|
previousScope,
|
|
1579
1664
|
previousItemRuleConfig,
|
|
1580
1665
|
explicitlySetsOpenData,
|
|
1666
|
+
nextParams,
|
|
1581
1667
|
nextScope,
|
|
1582
|
-
_this$
|
|
1668
|
+
_this$otherParams10,
|
|
1583
1669
|
shouldResetAvailabilityState,
|
|
1584
1670
|
_args3 = arguments;
|
|
1585
1671
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1586
1672
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1587
1673
|
case 0:
|
|
1588
|
-
|
|
1674
|
+
_ref31 = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {}, _ref31$cover = _ref31.cover, cover = _ref31$cover === void 0 ? false : _ref31$cover;
|
|
1589
1675
|
previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1590
|
-
previousItemRuleConfig = (_this$
|
|
1676
|
+
previousItemRuleConfig = (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.itemRule;
|
|
1591
1677
|
explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
1592
|
-
|
|
1678
|
+
nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
1679
|
+
if (explicitlySetsOpenData || this.getRuntimeOpenDataScope() !== this.getRuntimeOpenDataScope(nextParams)) {
|
|
1680
|
+
this.clearOpenDataCache();
|
|
1681
|
+
}
|
|
1682
|
+
_context3.next = 8;
|
|
1593
1683
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
1594
1684
|
cover: cover
|
|
1595
1685
|
});
|
|
1596
|
-
case
|
|
1686
|
+
case 8:
|
|
1597
1687
|
nextScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1598
1688
|
if (explicitlySetsOpenData) {
|
|
1599
|
-
this.openDataTarget = (_this$
|
|
1689
|
+
this.openDataTarget = (_this$otherParams10 = this.otherParams) !== null && _this$otherParams10 !== void 0 && _this$otherParams10.openData && nextScope.businessCode && nextScope.channel ? "".concat(nextScope.businessCode, "+").concat(nextScope.channel) : null;
|
|
1600
1690
|
}
|
|
1601
1691
|
shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone;
|
|
1602
1692
|
if (!shouldResetAvailabilityState) {
|
|
1603
|
-
_context3.next =
|
|
1693
|
+
_context3.next = 14;
|
|
1604
1694
|
break;
|
|
1605
1695
|
}
|
|
1606
|
-
_context3.next =
|
|
1696
|
+
_context3.next = 14;
|
|
1607
1697
|
return this.resetAvailabilityProjectionState('set_other_params_reset');
|
|
1608
|
-
case
|
|
1609
|
-
if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$
|
|
1698
|
+
case 14:
|
|
1699
|
+
if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.itemRule)) {
|
|
1610
1700
|
this.resetAllergyItemRuleState();
|
|
1611
1701
|
}
|
|
1612
|
-
case
|
|
1702
|
+
case 15:
|
|
1613
1703
|
case "end":
|
|
1614
1704
|
return _context3.stop();
|
|
1615
1705
|
}
|
|
@@ -1627,15 +1717,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1627
1717
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1628
1718
|
while (1) switch (_context4.prev = _context4.next) {
|
|
1629
1719
|
case 0:
|
|
1720
|
+
this.runtimeOpenDataDestroyed = true;
|
|
1721
|
+
this.clearOpenDataCache();
|
|
1630
1722
|
this.availabilityScheduleCatalog = null;
|
|
1631
1723
|
this.availabilityRuntimeOffsetMinutes = null;
|
|
1632
|
-
_context4.next =
|
|
1724
|
+
_context4.next = 6;
|
|
1633
1725
|
return this.resetAvailabilityProjectionState('destroy');
|
|
1634
|
-
case
|
|
1726
|
+
case 6:
|
|
1635
1727
|
this.resetAllergyItemRuleState();
|
|
1636
|
-
_context4.next =
|
|
1728
|
+
_context4.next = 9;
|
|
1637
1729
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "destroy", this).call(this);
|
|
1638
|
-
case
|
|
1730
|
+
case 9:
|
|
1639
1731
|
case "end":
|
|
1640
1732
|
return _context4.stop();
|
|
1641
1733
|
}
|
|
@@ -1790,7 +1882,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1790
1882
|
}, {
|
|
1791
1883
|
key: "invalidateAvailabilityContextsAfterCommit",
|
|
1792
1884
|
value: function invalidateAvailabilityContextsAfterCommit() {
|
|
1793
|
-
var
|
|
1885
|
+
var _this4 = this;
|
|
1794
1886
|
this.availabilityLifecycleGeneration += 1;
|
|
1795
1887
|
var nextOrderRevision = this.getCurrentOrderRevision();
|
|
1796
1888
|
this.availabilityProjectionPool.clear();
|
|
@@ -1801,7 +1893,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1801
1893
|
context.activeProjectionKey = null;
|
|
1802
1894
|
context.lastKnownOrderRevision = nextOrderRevision;
|
|
1803
1895
|
context.refreshNonce += 1;
|
|
1804
|
-
context.lifecycleGeneration =
|
|
1896
|
+
context.lifecycleGeneration = _this4.availabilityLifecycleGeneration;
|
|
1805
1897
|
});
|
|
1806
1898
|
}
|
|
1807
1899
|
}, {
|
|
@@ -1840,8 +1932,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1840
1932
|
}, {
|
|
1841
1933
|
key: "isSessionStoragePersistEnabled",
|
|
1842
1934
|
value: function isSessionStoragePersistEnabled() {
|
|
1843
|
-
var _this$
|
|
1844
|
-
return Boolean(this.cacheId && ((_this$
|
|
1935
|
+
var _this$otherParams12;
|
|
1936
|
+
return Boolean(this.cacheId && ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.enableSessionStoragePersist) === true);
|
|
1845
1937
|
}
|
|
1846
1938
|
}, {
|
|
1847
1939
|
key: "shouldUseSessionStorageForSubModule",
|
|
@@ -1910,10 +2002,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1910
2002
|
}, {
|
|
1911
2003
|
key: "shouldUseCheckoutSyncTask",
|
|
1912
2004
|
value: function shouldUseCheckoutSyncTask() {
|
|
1913
|
-
var _this$
|
|
1914
|
-
var configured = (_this$
|
|
2005
|
+
var _this$otherParams13, _this$otherParams14;
|
|
2006
|
+
var configured = (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.checkoutSyncTaskEnabled;
|
|
1915
2007
|
if (configured === true) return true;
|
|
1916
|
-
var platform = normalizeRuntimePlatform((_this$
|
|
2008
|
+
var platform = normalizeRuntimePlatform((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform);
|
|
1917
2009
|
return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
|
|
1918
2010
|
}
|
|
1919
2011
|
|
|
@@ -2068,8 +2160,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2068
2160
|
}, {
|
|
2069
2161
|
key: "isAuthenticatedCustomerUserPlatform",
|
|
2070
2162
|
value: function isAuthenticatedCustomerUserPlatform() {
|
|
2071
|
-
var _this$
|
|
2072
|
-
return isCustomerUserPlatform((_this$
|
|
2163
|
+
var _this$otherParams15;
|
|
2164
|
+
return isCustomerUserPlatform((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.platform);
|
|
2073
2165
|
}
|
|
2074
2166
|
}, {
|
|
2075
2167
|
key: "resolveDiscountOrderIdentity",
|
|
@@ -2158,99 +2250,230 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2158
2250
|
}
|
|
2159
2251
|
return refreshLegacySessionCustomerDiscounts;
|
|
2160
2252
|
}()
|
|
2161
|
-
/**
|
|
2162
|
-
* Loads OpenData without borrowing BookingTicket. Cache ownership is tied to the exact
|
|
2163
|
-
* business/channel target so a reused solution instance cannot leak another entry's menus.
|
|
2164
|
-
*/
|
|
2165
2253
|
}, {
|
|
2166
|
-
key: "
|
|
2167
|
-
value:
|
|
2168
|
-
var
|
|
2169
|
-
|
|
2254
|
+
key: "getRuntimeOpenDataScope",
|
|
2255
|
+
value: function getRuntimeOpenDataScope() {
|
|
2256
|
+
var _ref32, _otherParams$business3;
|
|
2257
|
+
var otherParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.otherParams;
|
|
2258
|
+
return JSON.stringify({
|
|
2259
|
+
shop: this.getPickupTimingContextData('shop_id'),
|
|
2260
|
+
appShop: this.appPlugin ? this.getAppData('shop_id') : undefined,
|
|
2261
|
+
tenant: this.appPlugin ? this.getAppData('tenant_id') : undefined,
|
|
2262
|
+
businessCode: String((_ref32 = (_otherParams$business3 = otherParams === null || otherParams === void 0 ? void 0 : otherParams.businessCode) !== null && _otherParams$business3 !== void 0 ? _otherParams$business3 : otherParams === null || otherParams === void 0 ? void 0 : otherParams.business_code) !== null && _ref32 !== void 0 ? _ref32 : '').trim(),
|
|
2263
|
+
channel: String((otherParams === null || otherParams === void 0 ? void 0 : otherParams.channel) || _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "getSubmitOrderSalesChannel", this).call(this)).trim(),
|
|
2264
|
+
platform: normalizeRuntimePlatform(otherParams === null || otherParams === void 0 ? void 0 : otherParams.platform),
|
|
2265
|
+
timezone: this.getPickupTimingContextData('timezone'),
|
|
2266
|
+
businessTimezone: otherParams === null || otherParams === void 0 ? void 0 : otherParams.businessTimezone,
|
|
2267
|
+
cacheId: otherParams === this.otherParams ? this.cacheId : otherParams === null || otherParams === void 0 ? void 0 : otherParams.cacheId
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
}, {
|
|
2271
|
+
key: "resetRuntimeOpenData",
|
|
2272
|
+
value: function resetRuntimeOpenData() {
|
|
2273
|
+
var _this$businessAvailab, _this$store$openData, _this$store$openData$;
|
|
2274
|
+
(_this$businessAvailab = this.businessAvailabilityController) === null || _this$businessAvailab === void 0 || _this$businessAvailab.invalidate();
|
|
2275
|
+
this.runtimeOpenDataGeneration += 1;
|
|
2276
|
+
this.runtimeOpenDataScope = null;
|
|
2277
|
+
this.runtimeOpenDataSnapshot = null;
|
|
2278
|
+
this.runtimeOpenDataModule = null;
|
|
2279
|
+
this.runtimeOpenDataCore = undefined;
|
|
2280
|
+
this.openDataTarget = null;
|
|
2281
|
+
this.loadOpenDataInFlight = null;
|
|
2282
|
+
this.loadOpenDataInFlightTarget = null;
|
|
2283
|
+
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), {}, {
|
|
2284
|
+
openData: null
|
|
2285
|
+
});
|
|
2286
|
+
(_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 || (_this$store$openData$ = _this$store$openData.clearCache) === null || _this$store$openData$ === void 0 || _this$store$openData$.call(_this$store$openData);
|
|
2287
|
+
}
|
|
2288
|
+
}, {
|
|
2289
|
+
key: "prepareInvoiceTemplateAtSolutionReady",
|
|
2290
|
+
value: function () {
|
|
2291
|
+
var _prepareInvoiceTemplateAtSolutionReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(injectedOpenData) {
|
|
2292
|
+
var businessCode;
|
|
2170
2293
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
2171
2294
|
while (1) switch (_context11.prev = _context11.next) {
|
|
2172
2295
|
case 0:
|
|
2173
|
-
|
|
2174
|
-
|
|
2296
|
+
businessCode = this.getBookingTicketBusinessCode();
|
|
2297
|
+
if (!(!businessCode || !this.store.openData)) {
|
|
2298
|
+
_context11.next = 3;
|
|
2299
|
+
break;
|
|
2300
|
+
}
|
|
2301
|
+
return _context11.abrupt("return");
|
|
2302
|
+
case 3:
|
|
2303
|
+
if (injectedOpenData) {
|
|
2304
|
+
this.otherParams.openData = injectedOpenData;
|
|
2305
|
+
this.openDataTarget = "".concat(businessCode, "+").concat(this.getSubmitOrderSalesChannel());
|
|
2306
|
+
}
|
|
2307
|
+
_context11.prev = 4;
|
|
2308
|
+
_context11.next = 7;
|
|
2309
|
+
return this.loadOpenDataConfig();
|
|
2310
|
+
case 7:
|
|
2311
|
+
_context11.next = 12;
|
|
2312
|
+
break;
|
|
2313
|
+
case 9:
|
|
2314
|
+
_context11.prev = 9;
|
|
2315
|
+
_context11.t0 = _context11["catch"](4);
|
|
2316
|
+
console.warn('[UnifiedBookingSales] Invoice 模板预加载失败,使用默认配置', _context11.t0);
|
|
2317
|
+
case 12:
|
|
2318
|
+
case "end":
|
|
2319
|
+
return _context11.stop();
|
|
2320
|
+
}
|
|
2321
|
+
}, _callee11, this, [[4, 9]]);
|
|
2322
|
+
}));
|
|
2323
|
+
function prepareInvoiceTemplateAtSolutionReady(_x7) {
|
|
2324
|
+
return _prepareInvoiceTemplateAtSolutionReady.apply(this, arguments);
|
|
2325
|
+
}
|
|
2326
|
+
return prepareInvoiceTemplateAtSolutionReady;
|
|
2327
|
+
}()
|
|
2328
|
+
}, {
|
|
2329
|
+
key: "loadOpenDataConfig",
|
|
2330
|
+
value: function () {
|
|
2331
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
2332
|
+
var businessCode;
|
|
2333
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
2334
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
2335
|
+
case 0:
|
|
2336
|
+
businessCode = this.getBookingTicketBusinessCode();
|
|
2337
|
+
if (businessCode) {
|
|
2338
|
+
_context12.next = 3;
|
|
2339
|
+
break;
|
|
2340
|
+
}
|
|
2341
|
+
return _context12.abrupt("return", null);
|
|
2342
|
+
case 3:
|
|
2343
|
+
return _context12.abrupt("return", this.loadOpenData({
|
|
2344
|
+
businessCode: businessCode,
|
|
2345
|
+
channel: this.getSubmitOrderSalesChannel()
|
|
2346
|
+
}));
|
|
2347
|
+
case 4:
|
|
2348
|
+
case "end":
|
|
2349
|
+
return _context12.stop();
|
|
2350
|
+
}
|
|
2351
|
+
}, _callee12, this);
|
|
2352
|
+
}));
|
|
2353
|
+
function loadOpenDataConfig() {
|
|
2354
|
+
return _loadOpenDataConfig.apply(this, arguments);
|
|
2355
|
+
}
|
|
2356
|
+
return loadOpenDataConfig;
|
|
2357
|
+
}() /** A successful configuration belongs to this business runtime until an explicit refresh. */
|
|
2358
|
+
}, {
|
|
2359
|
+
key: "loadOpenData",
|
|
2360
|
+
value: (function () {
|
|
2361
|
+
var _loadOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
|
|
2362
|
+
var _this5 = this;
|
|
2363
|
+
var module, businessCode, channel, target, scope, injectedOpenData, generation, core, request;
|
|
2364
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
2365
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
2366
|
+
case 0:
|
|
2367
|
+
module = this.store.openData;
|
|
2368
|
+
if (module) {
|
|
2369
|
+
_context14.next = 3;
|
|
2175
2370
|
break;
|
|
2176
2371
|
}
|
|
2177
2372
|
throw new Error('[UnifiedBookingSales] openData 模块未初始化');
|
|
2178
|
-
case
|
|
2373
|
+
case 3:
|
|
2374
|
+
if (!this.runtimeOpenDataDestroyed) {
|
|
2375
|
+
_context14.next = 5;
|
|
2376
|
+
break;
|
|
2377
|
+
}
|
|
2378
|
+
throw new Error('Store settings changed. Please try again.');
|
|
2379
|
+
case 5:
|
|
2179
2380
|
businessCode = String(params.businessCode || '').trim();
|
|
2180
2381
|
channel = String(params.channel || '').trim();
|
|
2181
2382
|
if (!(!businessCode || !channel)) {
|
|
2182
|
-
|
|
2383
|
+
_context14.next = 9;
|
|
2183
2384
|
break;
|
|
2184
2385
|
}
|
|
2185
2386
|
throw new Error('[UnifiedBookingSales] OpenData 需要 businessCode 与 channel');
|
|
2186
|
-
case
|
|
2387
|
+
case 9:
|
|
2187
2388
|
target = "".concat(businessCode, "+").concat(channel);
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2389
|
+
this.otherParams.businessCode = businessCode;
|
|
2390
|
+
this.otherParams.channel = channel;
|
|
2391
|
+
scope = this.getRuntimeOpenDataScope();
|
|
2392
|
+
if (params.force) {
|
|
2393
|
+
this.clearOpenDataCache();
|
|
2193
2394
|
}
|
|
2194
|
-
if (
|
|
2195
|
-
|
|
2196
|
-
|
|
2395
|
+
if (this.runtimeOpenDataScope !== scope || this.runtimeOpenDataModule !== module || this.runtimeOpenDataCore !== this.core) {
|
|
2396
|
+
// Only the first, explicitly injected target may seed a new runtime snapshot.
|
|
2397
|
+
injectedOpenData = this.runtimeOpenDataScope === null && (!this.openDataTarget || this.openDataTarget === target) && isRecord(this.otherParams.openData) ? this.otherParams.openData : null;
|
|
2398
|
+
if (this.runtimeOpenDataScope !== null) {
|
|
2399
|
+
// The caller's Pickup Timing scope already changes with this runtime scope.
|
|
2400
|
+
this.resetRuntimeOpenData();
|
|
2401
|
+
}
|
|
2402
|
+
this.runtimeOpenDataScope = scope;
|
|
2403
|
+
this.runtimeOpenDataModule = module;
|
|
2404
|
+
this.runtimeOpenDataCore = this.core;
|
|
2405
|
+
this.runtimeOpenDataSnapshot = injectedOpenData;
|
|
2197
2406
|
}
|
|
2198
|
-
_context11.next = 13;
|
|
2199
|
-
return this.store.openData.ensureInvoiceTemplateSettings(target);
|
|
2200
|
-
case 13:
|
|
2201
|
-
return _context11.abrupt("return", cachedData);
|
|
2202
|
-
case 14:
|
|
2203
2407
|
if (!this.loadOpenDataInFlight) {
|
|
2204
|
-
|
|
2205
|
-
break;
|
|
2206
|
-
}
|
|
2207
|
-
if (!(this.loadOpenDataInFlightTarget === target)) {
|
|
2208
|
-
_context11.next = 19;
|
|
2408
|
+
_context14.next = 17;
|
|
2209
2409
|
break;
|
|
2210
2410
|
}
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2411
|
+
return _context14.abrupt("return", this.loadOpenDataInFlight);
|
|
2412
|
+
case 17:
|
|
2413
|
+
generation = this.runtimeOpenDataGeneration;
|
|
2414
|
+
core = this.core;
|
|
2415
|
+
request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
2416
|
+
var openData, _module$ensureInvoice;
|
|
2417
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
2418
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
2419
|
+
case 0:
|
|
2420
|
+
openData = _this5.runtimeOpenDataSnapshot;
|
|
2421
|
+
if (!openData) {
|
|
2422
|
+
_context13.next = 6;
|
|
2423
|
+
break;
|
|
2424
|
+
}
|
|
2425
|
+
_context13.next = 4;
|
|
2426
|
+
return (_module$ensureInvoice = module.ensureInvoiceTemplateSettings) === null || _module$ensureInvoice === void 0 ? void 0 : _module$ensureInvoice.call(module, target, openData);
|
|
2427
|
+
case 4:
|
|
2428
|
+
_context13.next = 9;
|
|
2429
|
+
break;
|
|
2430
|
+
case 6:
|
|
2431
|
+
_context13.next = 8;
|
|
2432
|
+
return module.fetchOpenData({
|
|
2433
|
+
scope: 'board',
|
|
2434
|
+
target: target,
|
|
2435
|
+
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2436
|
+
});
|
|
2437
|
+
case 8:
|
|
2438
|
+
openData = _context13.sent;
|
|
2439
|
+
case 9:
|
|
2440
|
+
if (!(_this5.runtimeOpenDataDestroyed || generation !== _this5.runtimeOpenDataGeneration || scope !== _this5.getRuntimeOpenDataScope() || module !== _this5.store.openData || core !== _this5.core)) {
|
|
2441
|
+
_context13.next = 11;
|
|
2442
|
+
break;
|
|
2443
|
+
}
|
|
2444
|
+
throw new Error('Store settings changed. Please try again.');
|
|
2445
|
+
case 11:
|
|
2446
|
+
_this5.runtimeOpenDataSnapshot = openData;
|
|
2447
|
+
_this5.openDataTarget = target;
|
|
2448
|
+
_this5.otherParams.openData = openData;
|
|
2449
|
+
return _context13.abrupt("return", openData);
|
|
2450
|
+
case 15:
|
|
2451
|
+
case "end":
|
|
2452
|
+
return _context13.stop();
|
|
2453
|
+
}
|
|
2454
|
+
}, _callee13);
|
|
2455
|
+
}))();
|
|
2221
2456
|
this.loadOpenDataInFlightTarget = target;
|
|
2222
|
-
request = this.store.openData.fetchOpenData({
|
|
2223
|
-
scope: 'board',
|
|
2224
|
-
target: target,
|
|
2225
|
-
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2226
|
-
});
|
|
2227
2457
|
this.loadOpenDataInFlight = request;
|
|
2228
|
-
|
|
2229
|
-
|
|
2458
|
+
_context14.prev = 22;
|
|
2459
|
+
_context14.next = 25;
|
|
2230
2460
|
return request;
|
|
2231
|
-
case
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
this.otherParams.openData = openData;
|
|
2236
|
-
this.otherParams.businessCode = businessCode;
|
|
2237
|
-
this.otherParams.channel = channel;
|
|
2238
|
-
}
|
|
2239
|
-
return _context11.abrupt("return", openData);
|
|
2240
|
-
case 31:
|
|
2241
|
-
_context11.prev = 31;
|
|
2461
|
+
case 25:
|
|
2462
|
+
return _context14.abrupt("return", _context14.sent);
|
|
2463
|
+
case 26:
|
|
2464
|
+
_context14.prev = 26;
|
|
2242
2465
|
if (this.loadOpenDataInFlight === request) {
|
|
2243
2466
|
this.loadOpenDataInFlight = null;
|
|
2244
2467
|
this.loadOpenDataInFlightTarget = null;
|
|
2245
2468
|
}
|
|
2246
|
-
return
|
|
2247
|
-
case
|
|
2469
|
+
return _context14.finish(26);
|
|
2470
|
+
case 29:
|
|
2248
2471
|
case "end":
|
|
2249
|
-
return
|
|
2472
|
+
return _context14.stop();
|
|
2250
2473
|
}
|
|
2251
|
-
},
|
|
2474
|
+
}, _callee14, this, [[22,, 26, 29]]);
|
|
2252
2475
|
}));
|
|
2253
|
-
function loadOpenData(
|
|
2476
|
+
function loadOpenData(_x8) {
|
|
2254
2477
|
return _loadOpenData.apply(this, arguments);
|
|
2255
2478
|
}
|
|
2256
2479
|
return loadOpenData;
|
|
@@ -2258,35 +2481,58 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2258
2481
|
}, {
|
|
2259
2482
|
key: "getOpenData",
|
|
2260
2483
|
value: function () {
|
|
2261
|
-
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
2265
|
-
while (1) switch (_context12.prev = _context12.next) {
|
|
2484
|
+
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
2485
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
2486
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
2266
2487
|
case 0:
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
if (!(!businessCode || !channel)) {
|
|
2270
|
-
_context12.next = 4;
|
|
2271
|
-
break;
|
|
2272
|
-
}
|
|
2273
|
-
return _context12.abrupt("return", null);
|
|
2274
|
-
case 4:
|
|
2275
|
-
return _context12.abrupt("return", this.loadOpenData({
|
|
2276
|
-
businessCode: businessCode,
|
|
2277
|
-
channel: channel
|
|
2278
|
-
}));
|
|
2279
|
-
case 5:
|
|
2488
|
+
return _context15.abrupt("return", this.loadOpenDataConfig());
|
|
2489
|
+
case 1:
|
|
2280
2490
|
case "end":
|
|
2281
|
-
return
|
|
2491
|
+
return _context15.stop();
|
|
2282
2492
|
}
|
|
2283
|
-
},
|
|
2493
|
+
}, _callee15, this);
|
|
2284
2494
|
}));
|
|
2285
2495
|
function getOpenData() {
|
|
2286
2496
|
return _getOpenData.apply(this, arguments);
|
|
2287
2497
|
}
|
|
2288
2498
|
return getOpenData;
|
|
2289
2499
|
}()
|
|
2500
|
+
}, {
|
|
2501
|
+
key: "loadPickupTimingOpenData",
|
|
2502
|
+
value: function () {
|
|
2503
|
+
var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_force) {
|
|
2504
|
+
var _ref34, _this$otherParams$bus2, _this$otherParams16, _this$otherParams17;
|
|
2505
|
+
var scope, businessCode, config;
|
|
2506
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
2507
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
2508
|
+
case 0:
|
|
2509
|
+
scope = this.getPickupTimingScope();
|
|
2510
|
+
businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.business_code) !== null && _ref34 !== void 0 ? _ref34 : '').trim();
|
|
2511
|
+
_context16.next = 4;
|
|
2512
|
+
return this.loadOpenData({
|
|
2513
|
+
businessCode: businessCode,
|
|
2514
|
+
channel: this.getSubmitOrderSalesChannel()
|
|
2515
|
+
});
|
|
2516
|
+
case 4:
|
|
2517
|
+
config = _context16.sent;
|
|
2518
|
+
if (!(scope !== this.getPickupTimingScope())) {
|
|
2519
|
+
_context16.next = 7;
|
|
2520
|
+
break;
|
|
2521
|
+
}
|
|
2522
|
+
throw new Error('Store settings changed. Please try again.');
|
|
2523
|
+
case 7:
|
|
2524
|
+
return _context16.abrupt("return", config);
|
|
2525
|
+
case 8:
|
|
2526
|
+
case "end":
|
|
2527
|
+
return _context16.stop();
|
|
2528
|
+
}
|
|
2529
|
+
}, _callee16, this);
|
|
2530
|
+
}));
|
|
2531
|
+
function loadPickupTimingOpenData(_x9) {
|
|
2532
|
+
return _loadPickupTimingOpenData.apply(this, arguments);
|
|
2533
|
+
}
|
|
2534
|
+
return loadPickupTimingOpenData;
|
|
2535
|
+
}()
|
|
2290
2536
|
}, {
|
|
2291
2537
|
key: "resetAllergyItemRuleState",
|
|
2292
2538
|
value: function resetAllergyItemRuleState() {
|
|
@@ -2297,19 +2543,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2297
2543
|
}, {
|
|
2298
2544
|
key: "fetchAllergyItemRuleConfigs",
|
|
2299
2545
|
value: function () {
|
|
2300
|
-
var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2546
|
+
var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(strategyModelIds) {
|
|
2301
2547
|
var _response$data, response, list;
|
|
2302
|
-
return _regeneratorRuntime().wrap(function
|
|
2303
|
-
while (1) switch (
|
|
2548
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
2549
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
2304
2550
|
case 0:
|
|
2305
2551
|
if (strategyModelIds.length) {
|
|
2306
|
-
|
|
2552
|
+
_context17.next = 2;
|
|
2307
2553
|
break;
|
|
2308
2554
|
}
|
|
2309
|
-
return
|
|
2555
|
+
return _context17.abrupt("return", []);
|
|
2310
2556
|
case 2:
|
|
2311
|
-
|
|
2312
|
-
|
|
2557
|
+
_context17.prev = 2;
|
|
2558
|
+
_context17.next = 5;
|
|
2313
2559
|
return this.request.get('/promotion', {
|
|
2314
2560
|
skip: 1,
|
|
2315
2561
|
num: 99,
|
|
@@ -2317,28 +2563,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2317
2563
|
ids: strategyModelIds
|
|
2318
2564
|
});
|
|
2319
2565
|
case 5:
|
|
2320
|
-
response =
|
|
2566
|
+
response = _context17.sent;
|
|
2321
2567
|
if (!((response === null || response === void 0 ? void 0 : response.code) !== 200 || !Array.isArray(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list))) {
|
|
2322
|
-
|
|
2568
|
+
_context17.next = 8;
|
|
2323
2569
|
break;
|
|
2324
2570
|
}
|
|
2325
2571
|
throw new Error('[UnifiedBookingSales] 商品过敏策略加载失败');
|
|
2326
2572
|
case 8:
|
|
2327
2573
|
list = response.data.list;
|
|
2328
|
-
return
|
|
2574
|
+
return _context17.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
|
|
2329
2575
|
return item === null || item === void 0 ? void 0 : item.metadata;
|
|
2330
2576
|
})));
|
|
2331
2577
|
case 12:
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
throw
|
|
2578
|
+
_context17.prev = 12;
|
|
2579
|
+
_context17.t0 = _context17["catch"](2);
|
|
2580
|
+
throw _context17.t0;
|
|
2335
2581
|
case 15:
|
|
2336
2582
|
case "end":
|
|
2337
|
-
return
|
|
2583
|
+
return _context17.stop();
|
|
2338
2584
|
}
|
|
2339
|
-
},
|
|
2585
|
+
}, _callee17, this, [[2, 12]]);
|
|
2340
2586
|
}));
|
|
2341
|
-
function fetchAllergyItemRuleConfigs(
|
|
2587
|
+
function fetchAllergyItemRuleConfigs(_x10) {
|
|
2342
2588
|
return _fetchAllergyItemRuleConfigs.apply(this, arguments);
|
|
2343
2589
|
}
|
|
2344
2590
|
return fetchAllergyItemRuleConfigs;
|
|
@@ -2346,70 +2592,70 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2346
2592
|
}, {
|
|
2347
2593
|
key: "ensureAllergyItemRuleConfigsLoaded",
|
|
2348
2594
|
value: function () {
|
|
2349
|
-
var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2350
|
-
var
|
|
2351
|
-
return _regeneratorRuntime().wrap(function
|
|
2352
|
-
while (1) switch (
|
|
2595
|
+
var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
2596
|
+
var _this6 = this;
|
|
2597
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
2598
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2353
2599
|
case 0:
|
|
2354
2600
|
if (!(this.allergyItemRuleConfigs.length > 0)) {
|
|
2355
|
-
|
|
2601
|
+
_context19.next = 2;
|
|
2356
2602
|
break;
|
|
2357
2603
|
}
|
|
2358
|
-
return
|
|
2604
|
+
return _context19.abrupt("return", this.allergyItemRuleConfigs);
|
|
2359
2605
|
case 2:
|
|
2360
2606
|
if (!this.allergyItemRuleConfigsPromise) {
|
|
2361
|
-
|
|
2607
|
+
_context19.next = 4;
|
|
2362
2608
|
break;
|
|
2363
2609
|
}
|
|
2364
|
-
return
|
|
2610
|
+
return _context19.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
2365
2611
|
case 4:
|
|
2366
|
-
this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2367
|
-
var
|
|
2612
|
+
this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
2613
|
+
var _this6$otherParams;
|
|
2368
2614
|
var staticConfigs, openData, enabled, strategyModelIds, loaded;
|
|
2369
|
-
return _regeneratorRuntime().wrap(function
|
|
2370
|
-
while (1) switch (
|
|
2615
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
2616
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2371
2617
|
case 0:
|
|
2372
|
-
staticConfigs = normalizeItemRuleStrategyConfigs((
|
|
2618
|
+
staticConfigs = normalizeItemRuleStrategyConfigs((_this6$otherParams = _this6.otherParams) === null || _this6$otherParams === void 0 || (_this6$otherParams = _this6$otherParams.itemRule) === null || _this6$otherParams === void 0 ? void 0 : _this6$otherParams.strategyConfigs);
|
|
2373
2619
|
if (!(staticConfigs.length > 0)) {
|
|
2374
|
-
|
|
2620
|
+
_context18.next = 5;
|
|
2375
2621
|
break;
|
|
2376
2622
|
}
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
return
|
|
2623
|
+
_this6.allergyItemRuleConfigs = staticConfigs;
|
|
2624
|
+
_this6.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2625
|
+
return _context18.abrupt("return", staticConfigs);
|
|
2380
2626
|
case 5:
|
|
2381
|
-
|
|
2382
|
-
return
|
|
2627
|
+
_context18.next = 7;
|
|
2628
|
+
return _this6.getOpenData();
|
|
2383
2629
|
case 7:
|
|
2384
|
-
openData =
|
|
2630
|
+
openData = _context18.sent;
|
|
2385
2631
|
enabled = toConfiguredBoolean(openData === null || openData === void 0 ? void 0 : openData['sale.enable_item_rules']);
|
|
2386
2632
|
strategyModelIds = normalizePositiveIntegerList(openData === null || openData === void 0 ? void 0 : openData['sale.enabled_item_rules']);
|
|
2387
2633
|
if (!(!enabled || !strategyModelIds.length)) {
|
|
2388
|
-
|
|
2634
|
+
_context18.next = 13;
|
|
2389
2635
|
break;
|
|
2390
2636
|
}
|
|
2391
|
-
|
|
2392
|
-
return
|
|
2637
|
+
_this6.allergyItemRuleEvaluator.setStrategyConfigs([]);
|
|
2638
|
+
return _context18.abrupt("return", []);
|
|
2393
2639
|
case 13:
|
|
2394
|
-
|
|
2395
|
-
return
|
|
2640
|
+
_context18.next = 15;
|
|
2641
|
+
return _this6.fetchAllergyItemRuleConfigs(strategyModelIds);
|
|
2396
2642
|
case 15:
|
|
2397
|
-
loaded =
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
return
|
|
2643
|
+
loaded = _context18.sent;
|
|
2644
|
+
_this6.allergyItemRuleConfigs = loaded;
|
|
2645
|
+
_this6.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
|
|
2646
|
+
return _context18.abrupt("return", loaded);
|
|
2401
2647
|
case 19:
|
|
2402
2648
|
case "end":
|
|
2403
|
-
return
|
|
2649
|
+
return _context18.stop();
|
|
2404
2650
|
}
|
|
2405
|
-
},
|
|
2651
|
+
}, _callee18);
|
|
2406
2652
|
}))();
|
|
2407
|
-
return
|
|
2653
|
+
return _context19.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
2408
2654
|
case 6:
|
|
2409
2655
|
case "end":
|
|
2410
|
-
return
|
|
2656
|
+
return _context19.stop();
|
|
2411
2657
|
}
|
|
2412
|
-
},
|
|
2658
|
+
}, _callee19, this);
|
|
2413
2659
|
}));
|
|
2414
2660
|
function ensureAllergyItemRuleConfigsLoaded() {
|
|
2415
2661
|
return _ensureAllergyItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -2423,51 +2669,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2423
2669
|
}, {
|
|
2424
2670
|
key: "resolveProductAllergyRequirement",
|
|
2425
2671
|
value: (function () {
|
|
2426
|
-
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2427
|
-
var _this$
|
|
2672
|
+
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
2673
|
+
var _this$otherParams18, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref37, _runtimeConfig$servic, _this$otherParams19, _ref38, _ref39, _params$channel, _this$otherParams20, _this$otherParams21, _runtimeConfig$submis;
|
|
2428
2674
|
var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
|
|
2429
|
-
return _regeneratorRuntime().wrap(function
|
|
2430
|
-
while (1) switch (
|
|
2675
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2676
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2431
2677
|
case 0:
|
|
2432
2678
|
productId = normalizePositiveInteger(params.productId);
|
|
2433
2679
|
if (productId) {
|
|
2434
|
-
|
|
2680
|
+
_context20.next = 3;
|
|
2435
2681
|
break;
|
|
2436
2682
|
}
|
|
2437
|
-
return
|
|
2683
|
+
return _context20.abrupt("return", null);
|
|
2438
2684
|
case 3:
|
|
2439
|
-
|
|
2685
|
+
_context20.next = 5;
|
|
2440
2686
|
return this.ensureAllergyItemRuleConfigsLoaded();
|
|
2441
2687
|
case 5:
|
|
2442
|
-
strategyConfigs =
|
|
2688
|
+
strategyConfigs = _context20.sent;
|
|
2443
2689
|
if (strategyConfigs.length) {
|
|
2444
|
-
|
|
2690
|
+
_context20.next = 8;
|
|
2445
2691
|
break;
|
|
2446
2692
|
}
|
|
2447
|
-
return
|
|
2693
|
+
return _context20.abrupt("return", null);
|
|
2448
2694
|
case 8:
|
|
2449
2695
|
productVariantId = normalizePositiveInteger(params.productVariantId);
|
|
2450
|
-
runtimeConfig = ((_this$
|
|
2696
|
+
runtimeConfig = ((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.itemRule) || {};
|
|
2451
2697
|
runtimePax = runtimeConfig.pax || {};
|
|
2452
2698
|
cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
|
|
2453
|
-
var _item$product_id, _item$product_variant,
|
|
2699
|
+
var _item$product_id, _item$product_variant, _ref36, _item$num;
|
|
2454
2700
|
return {
|
|
2455
2701
|
product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id),
|
|
2456
2702
|
product_variant_id: Number((_item$product_variant = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0) || undefined,
|
|
2457
|
-
quantity: Number((
|
|
2703
|
+
quantity: Number((_ref36 = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref36 !== void 0 ? _ref36 : 0)
|
|
2458
2704
|
};
|
|
2459
2705
|
}).filter(function (item) {
|
|
2460
2706
|
return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
|
|
2461
2707
|
});
|
|
2462
|
-
return
|
|
2708
|
+
return _context20.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
|
|
2463
2709
|
pax: {
|
|
2464
2710
|
total: Number((_runtimePax$total = runtimePax.total) !== null && _runtimePax$total !== void 0 ? _runtimePax$total : 0) || 0,
|
|
2465
2711
|
adult: Number((_runtimePax$adult = runtimePax.adult) !== null && _runtimePax$adult !== void 0 ? _runtimePax$adult : 0) || 0,
|
|
2466
2712
|
child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
|
|
2467
2713
|
},
|
|
2468
2714
|
cartItems: cartItems,
|
|
2469
|
-
serviceType: String((
|
|
2470
|
-
channel: String((
|
|
2715
|
+
serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.serviceType) !== null && _ref37 !== void 0 ? _ref37 : ''),
|
|
2716
|
+
channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.channel) !== null && _ref39 !== void 0 ? _ref39 : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.platform) !== null && _ref38 !== void 0 ? _ref38 : ''),
|
|
2471
2717
|
currentProduct: _objectSpread({
|
|
2472
2718
|
product_id: productId
|
|
2473
2719
|
}, productVariantId ? {
|
|
@@ -2479,11 +2725,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2479
2725
|
}));
|
|
2480
2726
|
case 13:
|
|
2481
2727
|
case "end":
|
|
2482
|
-
return
|
|
2728
|
+
return _context20.stop();
|
|
2483
2729
|
}
|
|
2484
|
-
},
|
|
2730
|
+
}, _callee20, this);
|
|
2485
2731
|
}));
|
|
2486
|
-
function resolveProductAllergyRequirement(
|
|
2732
|
+
function resolveProductAllergyRequirement(_x11) {
|
|
2487
2733
|
return _resolveProductAllergyRequirement.apply(this, arguments);
|
|
2488
2734
|
}
|
|
2489
2735
|
return resolveProductAllergyRequirement;
|
|
@@ -2491,35 +2737,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2491
2737
|
}, {
|
|
2492
2738
|
key: "clearOpenDataCache",
|
|
2493
2739
|
value: function clearOpenDataCache() {
|
|
2494
|
-
this.
|
|
2495
|
-
this.
|
|
2496
|
-
this.loadOpenDataInFlightTarget = null;
|
|
2497
|
-
_get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "clearOpenDataCache", this).call(this);
|
|
2740
|
+
this.resetRuntimeOpenData();
|
|
2741
|
+
this.resetPickupTimingCache();
|
|
2498
2742
|
}
|
|
2499
2743
|
}, {
|
|
2500
2744
|
key: "getInvoiceLayoutConfig",
|
|
2501
2745
|
value: function () {
|
|
2502
|
-
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2746
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
2503
2747
|
var openData;
|
|
2504
|
-
return _regeneratorRuntime().wrap(function
|
|
2505
|
-
while (1) switch (
|
|
2748
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2749
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2506
2750
|
case 0:
|
|
2507
|
-
|
|
2751
|
+
_context21.next = 2;
|
|
2508
2752
|
return this.getOpenData();
|
|
2509
2753
|
case 2:
|
|
2510
|
-
openData =
|
|
2754
|
+
openData = _context21.sent;
|
|
2511
2755
|
if (!(!openData || !this.store.openData)) {
|
|
2512
|
-
|
|
2756
|
+
_context21.next = 5;
|
|
2513
2757
|
break;
|
|
2514
2758
|
}
|
|
2515
|
-
return
|
|
2759
|
+
return _context21.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
2516
2760
|
case 5:
|
|
2517
|
-
return
|
|
2761
|
+
return _context21.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
2518
2762
|
case 6:
|
|
2519
2763
|
case "end":
|
|
2520
|
-
return
|
|
2764
|
+
return _context21.stop();
|
|
2521
2765
|
}
|
|
2522
|
-
},
|
|
2766
|
+
}, _callee21, this);
|
|
2523
2767
|
}));
|
|
2524
2768
|
function getInvoiceLayoutConfig() {
|
|
2525
2769
|
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
@@ -2529,27 +2773,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2529
2773
|
}, {
|
|
2530
2774
|
key: "getInvoiceTemplateSettings",
|
|
2531
2775
|
value: function () {
|
|
2532
|
-
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2776
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
2533
2777
|
var openData;
|
|
2534
|
-
return _regeneratorRuntime().wrap(function
|
|
2535
|
-
while (1) switch (
|
|
2778
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2779
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2536
2780
|
case 0:
|
|
2537
|
-
|
|
2781
|
+
_context22.next = 2;
|
|
2538
2782
|
return this.getOpenData();
|
|
2539
2783
|
case 2:
|
|
2540
|
-
openData =
|
|
2784
|
+
openData = _context22.sent;
|
|
2541
2785
|
if (!(!openData || !this.store.openData)) {
|
|
2542
|
-
|
|
2786
|
+
_context22.next = 5;
|
|
2543
2787
|
break;
|
|
2544
2788
|
}
|
|
2545
|
-
return
|
|
2789
|
+
return _context22.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
2546
2790
|
case 5:
|
|
2547
|
-
return
|
|
2791
|
+
return _context22.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
2548
2792
|
case 6:
|
|
2549
2793
|
case "end":
|
|
2550
|
-
return
|
|
2794
|
+
return _context22.stop();
|
|
2551
2795
|
}
|
|
2552
|
-
},
|
|
2796
|
+
}, _callee22, this);
|
|
2553
2797
|
}));
|
|
2554
2798
|
function getInvoiceTemplateSettings() {
|
|
2555
2799
|
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
@@ -2559,11 +2803,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2559
2803
|
}, {
|
|
2560
2804
|
key: "isInvoiceOpenDataCacheCurrent",
|
|
2561
2805
|
value: function isInvoiceOpenDataCacheCurrent() {
|
|
2562
|
-
var _this$
|
|
2563
|
-
var businessCode = String(((_this$
|
|
2564
|
-
var channel = String(((_this$
|
|
2806
|
+
var _this$otherParams22, _this$otherParams23;
|
|
2807
|
+
var businessCode = String(((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.businessCode) || '').trim();
|
|
2808
|
+
var channel = String(((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.channel) || '').trim();
|
|
2565
2809
|
if (!businessCode || !channel) return false;
|
|
2566
|
-
return this.openDataTarget === "".concat(businessCode, "+").concat(channel);
|
|
2810
|
+
return this.openDataTarget === "".concat(businessCode, "+").concat(channel) && this.runtimeOpenDataScope === this.getRuntimeOpenDataScope();
|
|
2567
2811
|
}
|
|
2568
2812
|
|
|
2569
2813
|
/**
|
|
@@ -2572,14 +2816,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2572
2816
|
}, {
|
|
2573
2817
|
key: "getProtocol",
|
|
2574
2818
|
value: (function () {
|
|
2575
|
-
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2819
|
+
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(policyId) {
|
|
2576
2820
|
var normalizedPolicyId, policyUrl;
|
|
2577
|
-
return _regeneratorRuntime().wrap(function
|
|
2578
|
-
while (1) switch (
|
|
2821
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2822
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2579
2823
|
case 0:
|
|
2580
2824
|
normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
|
|
2581
2825
|
if (normalizedPolicyId) {
|
|
2582
|
-
|
|
2826
|
+
_context23.next = 3;
|
|
2583
2827
|
break;
|
|
2584
2828
|
}
|
|
2585
2829
|
throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
|
|
@@ -2588,14 +2832,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2588
2832
|
if (this.otherParams.platform === 'kiosk' || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
|
|
2589
2833
|
policyUrl = 'policy';
|
|
2590
2834
|
}
|
|
2591
|
-
return
|
|
2835
|
+
return _context23.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
|
|
2592
2836
|
case 6:
|
|
2593
2837
|
case "end":
|
|
2594
|
-
return
|
|
2838
|
+
return _context23.stop();
|
|
2595
2839
|
}
|
|
2596
|
-
},
|
|
2840
|
+
}, _callee23, this);
|
|
2597
2841
|
}));
|
|
2598
|
-
function getProtocol(
|
|
2842
|
+
function getProtocol(_x12) {
|
|
2599
2843
|
return _getProtocol.apply(this, arguments);
|
|
2600
2844
|
}
|
|
2601
2845
|
return getProtocol;
|
|
@@ -2608,27 +2852,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2608
2852
|
}, {
|
|
2609
2853
|
key: "loadProducts",
|
|
2610
2854
|
value: (function () {
|
|
2611
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2855
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2612
2856
|
var params,
|
|
2613
2857
|
options,
|
|
2614
2858
|
schedule_date,
|
|
2615
2859
|
schedule_datetime,
|
|
2616
2860
|
result,
|
|
2617
|
-
|
|
2618
|
-
return _regeneratorRuntime().wrap(function
|
|
2619
|
-
while (1) switch (
|
|
2861
|
+
_args24 = arguments;
|
|
2862
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2863
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2620
2864
|
case 0:
|
|
2621
|
-
params =
|
|
2622
|
-
options =
|
|
2865
|
+
params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
|
|
2866
|
+
options = _args24.length > 1 ? _args24[1] : undefined;
|
|
2623
2867
|
if (this.store.products) {
|
|
2624
|
-
|
|
2868
|
+
_context24.next = 4;
|
|
2625
2869
|
break;
|
|
2626
2870
|
}
|
|
2627
2871
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
2628
2872
|
case 4:
|
|
2629
2873
|
schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
2630
2874
|
schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
2631
|
-
|
|
2875
|
+
_context24.next = 8;
|
|
2632
2876
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
2633
2877
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
2634
2878
|
with_schedule: 1
|
|
@@ -2638,17 +2882,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2638
2882
|
cacheId: this.cacheId
|
|
2639
2883
|
}), options);
|
|
2640
2884
|
case 8:
|
|
2641
|
-
result =
|
|
2885
|
+
result = _context24.sent;
|
|
2642
2886
|
this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
2643
|
-
|
|
2887
|
+
_context24.next = 12;
|
|
2644
2888
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
|
|
2645
2889
|
case 12:
|
|
2646
|
-
return
|
|
2890
|
+
return _context24.abrupt("return", result);
|
|
2647
2891
|
case 13:
|
|
2648
2892
|
case "end":
|
|
2649
|
-
return
|
|
2893
|
+
return _context24.stop();
|
|
2650
2894
|
}
|
|
2651
|
-
},
|
|
2895
|
+
}, _callee24, this);
|
|
2652
2896
|
}));
|
|
2653
2897
|
function loadProducts() {
|
|
2654
2898
|
return _loadProducts.apply(this, arguments);
|
|
@@ -2658,25 +2902,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2658
2902
|
}, {
|
|
2659
2903
|
key: "queryProducts",
|
|
2660
2904
|
value: function () {
|
|
2661
|
-
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2905
|
+
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
2662
2906
|
var params,
|
|
2663
|
-
|
|
2664
|
-
return _regeneratorRuntime().wrap(function
|
|
2665
|
-
while (1) switch (
|
|
2907
|
+
_args25 = arguments;
|
|
2908
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2909
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2666
2910
|
case 0:
|
|
2667
|
-
params =
|
|
2911
|
+
params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
|
|
2668
2912
|
if (this.store.products) {
|
|
2669
|
-
|
|
2913
|
+
_context25.next = 3;
|
|
2670
2914
|
break;
|
|
2671
2915
|
}
|
|
2672
2916
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
2673
2917
|
case 3:
|
|
2674
|
-
return
|
|
2918
|
+
return _context25.abrupt("return", this.store.products.queryProducts(params));
|
|
2675
2919
|
case 4:
|
|
2676
2920
|
case "end":
|
|
2677
|
-
return
|
|
2921
|
+
return _context25.stop();
|
|
2678
2922
|
}
|
|
2679
|
-
},
|
|
2923
|
+
}, _callee25, this);
|
|
2680
2924
|
}));
|
|
2681
2925
|
function queryProducts() {
|
|
2682
2926
|
return _queryProducts.apply(this, arguments);
|
|
@@ -2686,24 +2930,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2686
2930
|
}, {
|
|
2687
2931
|
key: "loadScheduleAvailableDate",
|
|
2688
2932
|
value: (function () {
|
|
2689
|
-
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2690
|
-
return _regeneratorRuntime().wrap(function
|
|
2691
|
-
while (1) switch (
|
|
2933
|
+
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2934
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2935
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2692
2936
|
case 0:
|
|
2693
2937
|
if (this.store.schedule) {
|
|
2694
|
-
|
|
2938
|
+
_context26.next = 2;
|
|
2695
2939
|
break;
|
|
2696
2940
|
}
|
|
2697
2941
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
2698
2942
|
case 2:
|
|
2699
|
-
return
|
|
2943
|
+
return _context26.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
|
|
2700
2944
|
case 3:
|
|
2701
2945
|
case "end":
|
|
2702
|
-
return
|
|
2946
|
+
return _context26.stop();
|
|
2703
2947
|
}
|
|
2704
|
-
},
|
|
2948
|
+
}, _callee26, this);
|
|
2705
2949
|
}));
|
|
2706
|
-
function loadScheduleAvailableDate(
|
|
2950
|
+
function loadScheduleAvailableDate(_x13) {
|
|
2707
2951
|
return _loadScheduleAvailableDate.apply(this, arguments);
|
|
2708
2952
|
}
|
|
2709
2953
|
return loadScheduleAvailableDate;
|
|
@@ -2717,15 +2961,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2717
2961
|
}, {
|
|
2718
2962
|
key: "loadProductsByScheduleDate",
|
|
2719
2963
|
value: (function () {
|
|
2720
|
-
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2964
|
+
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2721
2965
|
var _this$store$schedule$, _this$store$schedule, _this$store$schedule$2, _this$store$schedule2, _this$store$schedule$3, _this$store$schedule3, _this$store$schedule$4, _this$store$schedule4;
|
|
2722
2966
|
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
|
|
2723
|
-
return _regeneratorRuntime().wrap(function
|
|
2724
|
-
while (1) switch (
|
|
2967
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2968
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2725
2969
|
case 0:
|
|
2726
2970
|
date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
|
|
2727
2971
|
if (this.store.schedule) {
|
|
2728
|
-
|
|
2972
|
+
_context27.next = 3;
|
|
2729
2973
|
break;
|
|
2730
2974
|
}
|
|
2731
2975
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
@@ -2736,10 +2980,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2736
2980
|
});
|
|
2737
2981
|
hasOtherProducts = (((_this$store$schedule$2 = (_this$store$schedule2 = this.store.schedule).getOtherProductsIds) === null || _this$store$schedule$2 === void 0 ? void 0 : _this$store$schedule$2.call(_this$store$schedule2)) || []).length > 0;
|
|
2738
2982
|
if (!(!hasCachedDate && !hasOtherProducts)) {
|
|
2739
|
-
|
|
2983
|
+
_context27.next = 9;
|
|
2740
2984
|
break;
|
|
2741
2985
|
}
|
|
2742
|
-
|
|
2986
|
+
_context27.next = 9;
|
|
2743
2987
|
return this.loadScheduleAvailableDate({
|
|
2744
2988
|
startDate: date,
|
|
2745
2989
|
endDate: date,
|
|
@@ -2759,45 +3003,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2759
3003
|
return !productIdFilter || productIdFilter.has(String(id));
|
|
2760
3004
|
});
|
|
2761
3005
|
if (availableProductIds.length) {
|
|
2762
|
-
|
|
3006
|
+
_context27.next = 17;
|
|
2763
3007
|
break;
|
|
2764
3008
|
}
|
|
2765
3009
|
this.unifiedProductCatalog = [];
|
|
2766
|
-
|
|
3010
|
+
_context27.next = 16;
|
|
2767
3011
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
|
|
2768
3012
|
case 16:
|
|
2769
|
-
return
|
|
3013
|
+
return _context27.abrupt("return", []);
|
|
2770
3014
|
case 17:
|
|
2771
|
-
|
|
3015
|
+
_context27.next = 19;
|
|
2772
3016
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
2773
3017
|
product_ids: availableProductIds,
|
|
2774
3018
|
schedule_date: date
|
|
2775
3019
|
}));
|
|
2776
3020
|
case 19:
|
|
2777
|
-
products =
|
|
3021
|
+
products = _context27.sent;
|
|
2778
3022
|
if (!(products.length || availableProductIds.length <= 1)) {
|
|
2779
|
-
|
|
3023
|
+
_context27.next = 22;
|
|
2780
3024
|
break;
|
|
2781
3025
|
}
|
|
2782
|
-
return
|
|
3026
|
+
return _context27.abrupt("return", products);
|
|
2783
3027
|
case 22:
|
|
2784
3028
|
fallbackProducts = [];
|
|
2785
3029
|
_iterator = _createForOfIteratorHelper(availableProductIds);
|
|
2786
|
-
|
|
3030
|
+
_context27.prev = 24;
|
|
2787
3031
|
_iterator.s();
|
|
2788
3032
|
case 26:
|
|
2789
3033
|
if ((_step = _iterator.n()).done) {
|
|
2790
|
-
|
|
3034
|
+
_context27.next = 34;
|
|
2791
3035
|
break;
|
|
2792
3036
|
}
|
|
2793
3037
|
productId = _step.value;
|
|
2794
|
-
|
|
3038
|
+
_context27.next = 30;
|
|
2795
3039
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
2796
3040
|
product_ids: [productId],
|
|
2797
3041
|
schedule_date: date
|
|
2798
3042
|
}));
|
|
2799
3043
|
case 30:
|
|
2800
|
-
result =
|
|
3044
|
+
result = _context27.sent;
|
|
2801
3045
|
result.forEach(function (product) {
|
|
2802
3046
|
var _id;
|
|
2803
3047
|
var id = (_id = product === null || product === void 0 ? void 0 : product.id) !== null && _id !== void 0 ? _id : product === null || product === void 0 ? void 0 : product.product_id;
|
|
@@ -2809,32 +3053,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2809
3053
|
}
|
|
2810
3054
|
});
|
|
2811
3055
|
case 32:
|
|
2812
|
-
|
|
3056
|
+
_context27.next = 26;
|
|
2813
3057
|
break;
|
|
2814
3058
|
case 34:
|
|
2815
|
-
|
|
3059
|
+
_context27.next = 39;
|
|
2816
3060
|
break;
|
|
2817
3061
|
case 36:
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
_iterator.e(
|
|
3062
|
+
_context27.prev = 36;
|
|
3063
|
+
_context27.t0 = _context27["catch"](24);
|
|
3064
|
+
_iterator.e(_context27.t0);
|
|
2821
3065
|
case 39:
|
|
2822
|
-
|
|
3066
|
+
_context27.prev = 39;
|
|
2823
3067
|
_iterator.f();
|
|
2824
|
-
return
|
|
3068
|
+
return _context27.finish(39);
|
|
2825
3069
|
case 42:
|
|
2826
3070
|
this.unifiedProductCatalog = [].concat(fallbackProducts);
|
|
2827
|
-
|
|
3071
|
+
_context27.next = 45;
|
|
2828
3072
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
|
|
2829
3073
|
case 45:
|
|
2830
|
-
return
|
|
3074
|
+
return _context27.abrupt("return", fallbackProducts);
|
|
2831
3075
|
case 46:
|
|
2832
3076
|
case "end":
|
|
2833
|
-
return
|
|
3077
|
+
return _context27.stop();
|
|
2834
3078
|
}
|
|
2835
|
-
},
|
|
3079
|
+
}, _callee27, this, [[24, 36, 39, 42]]);
|
|
2836
3080
|
}));
|
|
2837
|
-
function loadProductsByScheduleDate(
|
|
3081
|
+
function loadProductsByScheduleDate(_x14) {
|
|
2838
3082
|
return _loadProductsByScheduleDate.apply(this, arguments);
|
|
2839
3083
|
}
|
|
2840
3084
|
return loadProductsByScheduleDate;
|
|
@@ -2887,7 +3131,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2887
3131
|
}, {
|
|
2888
3132
|
key: "applyPlannerDiscounts",
|
|
2889
3133
|
value: (function () {
|
|
2890
|
-
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3134
|
+
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
2891
3135
|
var _params$customerId;
|
|
2892
3136
|
var params,
|
|
2893
3137
|
tempOrder,
|
|
@@ -2904,24 +3148,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2904
3148
|
discount,
|
|
2905
3149
|
discountId,
|
|
2906
3150
|
nextTempOrder,
|
|
2907
|
-
|
|
2908
|
-
return _regeneratorRuntime().wrap(function
|
|
2909
|
-
while (1) switch (
|
|
3151
|
+
_args28 = arguments;
|
|
3152
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3153
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2910
3154
|
case 0:
|
|
2911
|
-
params =
|
|
3155
|
+
params = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {};
|
|
2912
3156
|
tempOrder = this.getTempOrder();
|
|
2913
3157
|
requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
2914
3158
|
parsedCustomerId = Number(requestedCustomerId);
|
|
2915
3159
|
customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
|
|
2916
|
-
|
|
3160
|
+
_context28.next = 7;
|
|
2917
3161
|
return this.getSummary();
|
|
2918
3162
|
case 7:
|
|
2919
|
-
summaryBefore =
|
|
3163
|
+
summaryBefore = _context28.sent;
|
|
2920
3164
|
if (customerId) {
|
|
2921
|
-
|
|
3165
|
+
_context28.next = 10;
|
|
2922
3166
|
break;
|
|
2923
3167
|
}
|
|
2924
|
-
return
|
|
3168
|
+
return _context28.abrupt("return", buildPlannerDiscountResult({
|
|
2925
3169
|
customerId: null,
|
|
2926
3170
|
discountList: this.getDiscountList(),
|
|
2927
3171
|
products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
|
|
@@ -2930,7 +3174,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2930
3174
|
status: 'no_customer'
|
|
2931
3175
|
}));
|
|
2932
3176
|
case 10:
|
|
2933
|
-
|
|
3177
|
+
_context28.next = 12;
|
|
2934
3178
|
return this.loadDiscountConfig({
|
|
2935
3179
|
customerId: customerId,
|
|
2936
3180
|
action: 'create'
|
|
@@ -2942,7 +3186,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2942
3186
|
return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
|
|
2943
3187
|
});
|
|
2944
3188
|
if (!preferredDiscount) {
|
|
2945
|
-
|
|
3189
|
+
_context28.next = 40;
|
|
2946
3190
|
break;
|
|
2947
3191
|
}
|
|
2948
3192
|
// A requested card is an explicit UI choice, not a best-effort preference. Clear prior
|
|
@@ -2954,98 +3198,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2954
3198
|
return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
|
|
2955
3199
|
});
|
|
2956
3200
|
_iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
|
|
2957
|
-
|
|
3201
|
+
_context28.prev = 18;
|
|
2958
3202
|
_iterator2.s();
|
|
2959
3203
|
case 20:
|
|
2960
3204
|
if ((_step2 = _iterator2.n()).done) {
|
|
2961
|
-
|
|
3205
|
+
_context28.next = 28;
|
|
2962
3206
|
break;
|
|
2963
3207
|
}
|
|
2964
3208
|
discount = _step2.value;
|
|
2965
3209
|
discountId = Number(resolvePlannerDiscountId(discount));
|
|
2966
3210
|
if (!Number.isFinite(discountId)) {
|
|
2967
|
-
|
|
3211
|
+
_context28.next = 26;
|
|
2968
3212
|
break;
|
|
2969
3213
|
}
|
|
2970
|
-
|
|
3214
|
+
_context28.next = 26;
|
|
2971
3215
|
return this.setDiscountSelected({
|
|
2972
3216
|
discountId: discountId,
|
|
2973
3217
|
isSelected: false
|
|
2974
3218
|
});
|
|
2975
3219
|
case 26:
|
|
2976
|
-
|
|
3220
|
+
_context28.next = 20;
|
|
2977
3221
|
break;
|
|
2978
3222
|
case 28:
|
|
2979
|
-
|
|
3223
|
+
_context28.next = 33;
|
|
2980
3224
|
break;
|
|
2981
3225
|
case 30:
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
_iterator2.e(
|
|
3226
|
+
_context28.prev = 30;
|
|
3227
|
+
_context28.t0 = _context28["catch"](18);
|
|
3228
|
+
_iterator2.e(_context28.t0);
|
|
2985
3229
|
case 33:
|
|
2986
|
-
|
|
3230
|
+
_context28.prev = 33;
|
|
2987
3231
|
_iterator2.f();
|
|
2988
|
-
return
|
|
3232
|
+
return _context28.finish(33);
|
|
2989
3233
|
case 36:
|
|
2990
|
-
|
|
3234
|
+
_context28.next = 38;
|
|
2991
3235
|
return this.setDiscountSelected({
|
|
2992
3236
|
discountId: Number(preferredId),
|
|
2993
3237
|
isSelected: true
|
|
2994
3238
|
});
|
|
2995
3239
|
case 38:
|
|
2996
|
-
|
|
3240
|
+
_context28.next = 49;
|
|
2997
3241
|
break;
|
|
2998
3242
|
case 40:
|
|
2999
3243
|
if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
|
|
3000
|
-
|
|
3244
|
+
_context28.next = 46;
|
|
3001
3245
|
break;
|
|
3002
3246
|
}
|
|
3003
3247
|
if (!(params.applyBestDiscount !== false)) {
|
|
3004
|
-
|
|
3248
|
+
_context28.next = 44;
|
|
3005
3249
|
break;
|
|
3006
3250
|
}
|
|
3007
|
-
|
|
3251
|
+
_context28.next = 44;
|
|
3008
3252
|
return this.bestDiscount();
|
|
3009
3253
|
case 44:
|
|
3010
|
-
|
|
3254
|
+
_context28.next = 49;
|
|
3011
3255
|
break;
|
|
3012
3256
|
case 46:
|
|
3013
3257
|
if (!(params.applyBestDiscount !== false)) {
|
|
3014
|
-
|
|
3258
|
+
_context28.next = 49;
|
|
3015
3259
|
break;
|
|
3016
3260
|
}
|
|
3017
|
-
|
|
3261
|
+
_context28.next = 49;
|
|
3018
3262
|
return this.bestDiscount();
|
|
3019
3263
|
case 49:
|
|
3020
3264
|
nextTempOrder = this.getTempOrder();
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3265
|
+
_context28.t1 = buildPlannerDiscountResult;
|
|
3266
|
+
_context28.t2 = customerId;
|
|
3267
|
+
_context28.t3 = this.getDiscountList();
|
|
3268
|
+
_context28.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
|
|
3269
|
+
_context28.t5 = summaryBefore;
|
|
3270
|
+
_context28.next = 57;
|
|
3027
3271
|
return this.getSummary();
|
|
3028
3272
|
case 57:
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
customerId:
|
|
3035
|
-
discountList:
|
|
3036
|
-
products:
|
|
3037
|
-
summaryBefore:
|
|
3038
|
-
summaryAfter:
|
|
3039
|
-
status:
|
|
3040
|
-
preferredDiscountId:
|
|
3041
|
-
preferredDiscountFound:
|
|
3273
|
+
_context28.t6 = _context28.sent;
|
|
3274
|
+
_context28.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
|
|
3275
|
+
_context28.t8 = preferredDiscountId;
|
|
3276
|
+
_context28.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
|
|
3277
|
+
_context28.t10 = {
|
|
3278
|
+
customerId: _context28.t2,
|
|
3279
|
+
discountList: _context28.t3,
|
|
3280
|
+
products: _context28.t4,
|
|
3281
|
+
summaryBefore: _context28.t5,
|
|
3282
|
+
summaryAfter: _context28.t6,
|
|
3283
|
+
status: _context28.t7,
|
|
3284
|
+
preferredDiscountId: _context28.t8,
|
|
3285
|
+
preferredDiscountFound: _context28.t9
|
|
3042
3286
|
};
|
|
3043
|
-
return
|
|
3287
|
+
return _context28.abrupt("return", (0, _context28.t1)(_context28.t10));
|
|
3044
3288
|
case 63:
|
|
3045
3289
|
case "end":
|
|
3046
|
-
return
|
|
3290
|
+
return _context28.stop();
|
|
3047
3291
|
}
|
|
3048
|
-
},
|
|
3292
|
+
}, _callee28, this, [[18, 30, 33, 36]]);
|
|
3049
3293
|
}));
|
|
3050
3294
|
function applyPlannerDiscounts() {
|
|
3051
3295
|
return _applyPlannerDiscounts.apply(this, arguments);
|
|
@@ -3055,16 +3299,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3055
3299
|
}, {
|
|
3056
3300
|
key: "buildUnifiedOrderProduct",
|
|
3057
3301
|
value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
|
|
3058
|
-
var
|
|
3302
|
+
var _ref40, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref41, _sourceProduct$produc, _ref42, _ref43, _sourceProduct$quanti, _sourceProduct$price, _ref44, _ref45, _sourceProduct$sellin;
|
|
3059
3303
|
var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
|
|
3060
|
-
var quotationShelfId = (
|
|
3304
|
+
var quotationShelfId = (_ref40 = (_sourceProduct$_exten = (_sourceProduct$_exten2 = sourceProduct._extend) === null || _sourceProduct$_exten2 === void 0 ? void 0 : _sourceProduct$_exten2.quotation_shelf_id) !== null && _sourceProduct$_exten !== void 0 ? _sourceProduct$_exten : sourceProduct.quotation_shelf_id) !== null && _ref40 !== void 0 ? _ref40 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
|
|
3061
3305
|
var orderProduct = this.transformBaseProductToOrderProduct({
|
|
3062
3306
|
payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
|
|
3063
3307
|
id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
|
|
3064
|
-
product_id: (
|
|
3065
|
-
quantity: (
|
|
3308
|
+
product_id: (_ref41 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref41 !== void 0 ? _ref41 : product === null || product === void 0 ? void 0 : product.id,
|
|
3309
|
+
quantity: (_ref42 = (_ref43 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref43 !== void 0 ? _ref43 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref42 !== void 0 ? _ref42 : 1,
|
|
3066
3310
|
price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
|
|
3067
|
-
selling_price: (
|
|
3311
|
+
selling_price: (_ref44 = (_ref45 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref45 !== void 0 ? _ref45 : normalizedProductRaw.selling_price) !== null && _ref44 !== void 0 ? _ref44 : normalizedProductRaw.price,
|
|
3068
3312
|
metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
|
|
3069
3313
|
}),
|
|
3070
3314
|
sourceProduct: sourceProduct
|
|
@@ -3083,29 +3327,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3083
3327
|
}, {
|
|
3084
3328
|
key: "removeExistingStagedLines",
|
|
3085
3329
|
value: (function () {
|
|
3086
|
-
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3330
|
+
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(ownershipKey) {
|
|
3087
3331
|
var _this$getTempOrder;
|
|
3088
3332
|
var existingLines;
|
|
3089
|
-
return _regeneratorRuntime().wrap(function
|
|
3090
|
-
while (1) switch (
|
|
3333
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3334
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3091
3335
|
case 0:
|
|
3092
3336
|
existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
|
|
3093
3337
|
var _product$metadata4;
|
|
3094
3338
|
return (product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4[ownershipKey]) === true;
|
|
3095
3339
|
});
|
|
3096
3340
|
if (!(existingLines.length > 0)) {
|
|
3097
|
-
|
|
3341
|
+
_context29.next = 4;
|
|
3098
3342
|
break;
|
|
3099
3343
|
}
|
|
3100
|
-
|
|
3344
|
+
_context29.next = 4;
|
|
3101
3345
|
return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
|
|
3102
3346
|
case 4:
|
|
3103
3347
|
case "end":
|
|
3104
|
-
return
|
|
3348
|
+
return _context29.stop();
|
|
3105
3349
|
}
|
|
3106
|
-
},
|
|
3350
|
+
}, _callee29, this);
|
|
3107
3351
|
}));
|
|
3108
|
-
function removeExistingStagedLines(
|
|
3352
|
+
function removeExistingStagedLines(_x15) {
|
|
3109
3353
|
return _removeExistingStagedLines.apply(this, arguments);
|
|
3110
3354
|
}
|
|
3111
3355
|
return removeExistingStagedLines;
|
|
@@ -3113,25 +3357,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3113
3357
|
}, {
|
|
3114
3358
|
key: "stageProducts",
|
|
3115
3359
|
value: function () {
|
|
3116
|
-
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3360
|
+
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params, ownershipKey) {
|
|
3117
3361
|
var _params$rawProducts;
|
|
3118
3362
|
var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
|
|
3119
|
-
return _regeneratorRuntime().wrap(function
|
|
3120
|
-
while (1) switch (
|
|
3363
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3364
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3121
3365
|
case 0:
|
|
3122
3366
|
productIds = params.productIds || [];
|
|
3123
3367
|
if (productIds.length) {
|
|
3124
|
-
|
|
3368
|
+
_context30.next = 3;
|
|
3125
3369
|
break;
|
|
3126
3370
|
}
|
|
3127
|
-
return
|
|
3371
|
+
return _context30.abrupt("return", this.getTempOrder());
|
|
3128
3372
|
case 3:
|
|
3129
3373
|
if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
|
|
3130
|
-
|
|
3374
|
+
_context30.next = 7;
|
|
3131
3375
|
break;
|
|
3132
3376
|
}
|
|
3133
3377
|
this.unifiedProductCatalog = params.rawProducts;
|
|
3134
|
-
|
|
3378
|
+
_context30.next = 12;
|
|
3135
3379
|
break;
|
|
3136
3380
|
case 7:
|
|
3137
3381
|
existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
|
|
@@ -3142,15 +3386,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3142
3386
|
return !existingIds.has(String(id));
|
|
3143
3387
|
});
|
|
3144
3388
|
if (!(missingIds.length || params.productLoadParams)) {
|
|
3145
|
-
|
|
3389
|
+
_context30.next = 12;
|
|
3146
3390
|
break;
|
|
3147
3391
|
}
|
|
3148
|
-
|
|
3392
|
+
_context30.next = 12;
|
|
3149
3393
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
3150
3394
|
product_ids: productIds.map(Number).filter(Number.isFinite)
|
|
3151
3395
|
}));
|
|
3152
3396
|
case 12:
|
|
3153
|
-
|
|
3397
|
+
_context30.next = 14;
|
|
3154
3398
|
return this.removeExistingStagedLines(ownershipKey);
|
|
3155
3399
|
case 14:
|
|
3156
3400
|
productIdSet = new Set(productIds.map(function (id) {
|
|
@@ -3163,30 +3407,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3163
3407
|
_i = 0, _arr = selectedProducts;
|
|
3164
3408
|
case 17:
|
|
3165
3409
|
if (!(_i < _arr.length)) {
|
|
3166
|
-
|
|
3410
|
+
_context30.next = 26;
|
|
3167
3411
|
break;
|
|
3168
3412
|
}
|
|
3169
3413
|
sourceProduct = _arr[_i];
|
|
3170
3414
|
productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
|
|
3171
3415
|
if (!productInput) {
|
|
3172
|
-
|
|
3416
|
+
_context30.next = 23;
|
|
3173
3417
|
break;
|
|
3174
3418
|
}
|
|
3175
|
-
|
|
3419
|
+
_context30.next = 23;
|
|
3176
3420
|
return this.addProductToOrder(productInput);
|
|
3177
3421
|
case 23:
|
|
3178
3422
|
_i++;
|
|
3179
|
-
|
|
3423
|
+
_context30.next = 17;
|
|
3180
3424
|
break;
|
|
3181
3425
|
case 26:
|
|
3182
|
-
return
|
|
3426
|
+
return _context30.abrupt("return", this.getTempOrder());
|
|
3183
3427
|
case 27:
|
|
3184
3428
|
case "end":
|
|
3185
|
-
return
|
|
3429
|
+
return _context30.stop();
|
|
3186
3430
|
}
|
|
3187
|
-
},
|
|
3431
|
+
}, _callee30, this);
|
|
3188
3432
|
}));
|
|
3189
|
-
function stageProducts(
|
|
3433
|
+
function stageProducts(_x16, _x17) {
|
|
3190
3434
|
return _stageProducts.apply(this, arguments);
|
|
3191
3435
|
}
|
|
3192
3436
|
return stageProducts;
|
|
@@ -3198,18 +3442,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3198
3442
|
}, {
|
|
3199
3443
|
key: "stageRetailProducts",
|
|
3200
3444
|
value: (function () {
|
|
3201
|
-
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3202
|
-
return _regeneratorRuntime().wrap(function
|
|
3203
|
-
while (1) switch (
|
|
3445
|
+
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3446
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3447
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3204
3448
|
case 0:
|
|
3205
|
-
return
|
|
3449
|
+
return _context31.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
|
|
3206
3450
|
case 1:
|
|
3207
3451
|
case "end":
|
|
3208
|
-
return
|
|
3452
|
+
return _context31.stop();
|
|
3209
3453
|
}
|
|
3210
|
-
},
|
|
3454
|
+
}, _callee31, this);
|
|
3211
3455
|
}));
|
|
3212
|
-
function stageRetailProducts(
|
|
3456
|
+
function stageRetailProducts(_x18) {
|
|
3213
3457
|
return _stageRetailProducts.apply(this, arguments);
|
|
3214
3458
|
}
|
|
3215
3459
|
return stageRetailProducts;
|
|
@@ -3223,20 +3467,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3223
3467
|
}, {
|
|
3224
3468
|
key: "addRetailProduct",
|
|
3225
3469
|
value: (function () {
|
|
3226
|
-
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3227
|
-
var _params$quantity,
|
|
3470
|
+
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3471
|
+
var _params$quantity, _ref46, _params$productId, _params$product, _params$product2;
|
|
3228
3472
|
var quantity, productId, sourceProduct, products, orderProduct;
|
|
3229
|
-
return _regeneratorRuntime().wrap(function
|
|
3230
|
-
while (1) switch (
|
|
3473
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3474
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3231
3475
|
case 0:
|
|
3232
3476
|
quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
|
|
3233
3477
|
if (!(!Number.isFinite(quantity) || quantity <= 0)) {
|
|
3234
|
-
|
|
3478
|
+
_context32.next = 3;
|
|
3235
3479
|
break;
|
|
3236
3480
|
}
|
|
3237
3481
|
throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
|
|
3238
3482
|
case 3:
|
|
3239
|
-
productId = (
|
|
3483
|
+
productId = (_ref46 = (_params$productId = params.productId) !== null && _params$productId !== void 0 ? _params$productId : (_params$product = params.product) === null || _params$product === void 0 ? void 0 : _params$product.id) !== null && _ref46 !== void 0 ? _ref46 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
|
|
3240
3484
|
sourceProduct = params.product;
|
|
3241
3485
|
if (!sourceProduct && productId !== undefined && productId !== null) {
|
|
3242
3486
|
sourceProduct = this.unifiedProductCatalog.find(function (product) {
|
|
@@ -3245,22 +3489,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3245
3489
|
});
|
|
3246
3490
|
}
|
|
3247
3491
|
if (!(!sourceProduct && productId !== undefined && productId !== null)) {
|
|
3248
|
-
|
|
3492
|
+
_context32.next = 11;
|
|
3249
3493
|
break;
|
|
3250
3494
|
}
|
|
3251
|
-
|
|
3495
|
+
_context32.next = 9;
|
|
3252
3496
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
3253
3497
|
product_ids: [Number(productId)].filter(Number.isFinite)
|
|
3254
3498
|
}));
|
|
3255
3499
|
case 9:
|
|
3256
|
-
products =
|
|
3500
|
+
products = _context32.sent;
|
|
3257
3501
|
sourceProduct = products.find(function (product) {
|
|
3258
3502
|
var _product$id4;
|
|
3259
3503
|
return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
|
|
3260
3504
|
});
|
|
3261
3505
|
case 11:
|
|
3262
3506
|
if (sourceProduct) {
|
|
3263
|
-
|
|
3507
|
+
_context32.next = 13;
|
|
3264
3508
|
break;
|
|
3265
3509
|
}
|
|
3266
3510
|
throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
|
|
@@ -3269,19 +3513,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3269
3513
|
quantity: quantity
|
|
3270
3514
|
}), 'unified_booking_sales_retail');
|
|
3271
3515
|
if (orderProduct) {
|
|
3272
|
-
|
|
3516
|
+
_context32.next = 16;
|
|
3273
3517
|
break;
|
|
3274
3518
|
}
|
|
3275
3519
|
throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
|
|
3276
3520
|
case 16:
|
|
3277
|
-
return
|
|
3521
|
+
return _context32.abrupt("return", this.addProductToOrder(orderProduct));
|
|
3278
3522
|
case 17:
|
|
3279
3523
|
case "end":
|
|
3280
|
-
return
|
|
3524
|
+
return _context32.stop();
|
|
3281
3525
|
}
|
|
3282
|
-
},
|
|
3526
|
+
}, _callee32, this);
|
|
3283
3527
|
}));
|
|
3284
|
-
function addRetailProduct(
|
|
3528
|
+
function addRetailProduct(_x19) {
|
|
3285
3529
|
return _addRetailProduct.apply(this, arguments);
|
|
3286
3530
|
}
|
|
3287
3531
|
return addRetailProduct;
|
|
@@ -3381,7 +3625,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3381
3625
|
}, {
|
|
3382
3626
|
key: "buildAvailabilityOperatingHoursSnapshot",
|
|
3383
3627
|
value: function buildAvailabilityOperatingHoursSnapshot(params) {
|
|
3384
|
-
var
|
|
3628
|
+
var _this7 = this;
|
|
3385
3629
|
var descriptor = params.prepare._availabilityOperatingHours || {
|
|
3386
3630
|
source: params.prepare.businessHours ? 'prepare_business_hours' : 'default_business_hours',
|
|
3387
3631
|
scheduleIds: []
|
|
@@ -3391,7 +3635,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3391
3635
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3392
3636
|
startAt: "".concat(date, "T").concat(params.businessHours.startTime, ":00"),
|
|
3393
3637
|
endAt: "".concat(date, "T").concat(params.businessHours.endTime, ":00"),
|
|
3394
|
-
fixedOffsetMinutes:
|
|
3638
|
+
fixedOffsetMinutes: _this7.getAvailabilityRuntimeOffsetMinutes(),
|
|
3395
3639
|
rollOverEnd: true
|
|
3396
3640
|
});
|
|
3397
3641
|
return range ? [{
|
|
@@ -3426,7 +3670,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3426
3670
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3427
3671
|
startAt: slot.start_at,
|
|
3428
3672
|
endAt: slot.end_at,
|
|
3429
|
-
fixedOffsetMinutes:
|
|
3673
|
+
fixedOffsetMinutes: _this7.getAvailabilityRuntimeOffsetMinutes(),
|
|
3430
3674
|
rollOverEnd: true
|
|
3431
3675
|
});
|
|
3432
3676
|
return range ? [{
|
|
@@ -3442,7 +3686,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3442
3686
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3443
3687
|
startAt: slot.start_at,
|
|
3444
3688
|
endAt: slot.end_at,
|
|
3445
|
-
fixedOffsetMinutes:
|
|
3689
|
+
fixedOffsetMinutes: _this7.getAvailabilityRuntimeOffsetMinutes(),
|
|
3446
3690
|
rollOverEnd: true
|
|
3447
3691
|
});
|
|
3448
3692
|
return range ? [{
|
|
@@ -3469,46 +3713,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3469
3713
|
}, {
|
|
3470
3714
|
key: "loadAvailabilityProducts",
|
|
3471
3715
|
value: function () {
|
|
3472
|
-
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3716
|
+
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
3473
3717
|
var _prepare$catalogScope,
|
|
3474
3718
|
_prepare$catalogScope2,
|
|
3475
|
-
|
|
3719
|
+
_this8 = this,
|
|
3476
3720
|
_prepare$resourceIds;
|
|
3477
3721
|
var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
|
|
3478
|
-
return _regeneratorRuntime().wrap(function
|
|
3479
|
-
while (1) switch (
|
|
3722
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3723
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3480
3724
|
case 0:
|
|
3481
3725
|
prepare = params.prepare, dateRange = params.dateRange;
|
|
3482
3726
|
explicitProductIds = prepare.productIds || [];
|
|
3483
3727
|
rawProducts = [];
|
|
3484
3728
|
if (!Array.isArray(prepare.rawProducts)) {
|
|
3485
|
-
|
|
3729
|
+
_context33.next = 8;
|
|
3486
3730
|
break;
|
|
3487
3731
|
}
|
|
3488
3732
|
rawProducts = prepare.rawProducts;
|
|
3489
3733
|
this.unifiedProductCatalog = _toConsumableArray(rawProducts);
|
|
3490
|
-
|
|
3734
|
+
_context33.next = 34;
|
|
3491
3735
|
break;
|
|
3492
3736
|
case 8:
|
|
3493
3737
|
if (!(explicitProductIds.length > 0)) {
|
|
3494
|
-
|
|
3738
|
+
_context33.next = 14;
|
|
3495
3739
|
break;
|
|
3496
3740
|
}
|
|
3497
|
-
|
|
3741
|
+
_context33.next = 11;
|
|
3498
3742
|
return this.loadProducts({
|
|
3499
3743
|
product_ids: explicitProductIds,
|
|
3500
3744
|
schedule_date: dateRange.startDate
|
|
3501
3745
|
});
|
|
3502
3746
|
case 11:
|
|
3503
|
-
rawProducts =
|
|
3504
|
-
|
|
3747
|
+
rawProducts = _context33.sent;
|
|
3748
|
+
_context33.next = 34;
|
|
3505
3749
|
break;
|
|
3506
3750
|
case 14:
|
|
3507
3751
|
if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
|
|
3508
|
-
|
|
3752
|
+
_context33.next = 30;
|
|
3509
3753
|
break;
|
|
3510
3754
|
}
|
|
3511
|
-
|
|
3755
|
+
_context33.next = 17;
|
|
3512
3756
|
return this.loadScheduleAvailableDate({
|
|
3513
3757
|
startDate: dateRange.startDate,
|
|
3514
3758
|
endDate: dateRange.endDate,
|
|
@@ -3524,44 +3768,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3524
3768
|
});
|
|
3525
3769
|
productIds = uniqueAvailabilityIds([].concat(_toConsumableArray(scheduleProductIds), _toConsumableArray(((_this$store$schedule$7 = (_this$store$schedule7 = this.store.schedule).getOtherProductsIds) === null || _this$store$schedule$7 === void 0 ? void 0 : _this$store$schedule$7.call(_this$store$schedule7)) || [])));
|
|
3526
3770
|
if (!(productIds.length > 0)) {
|
|
3527
|
-
|
|
3771
|
+
_context33.next = 27;
|
|
3528
3772
|
break;
|
|
3529
3773
|
}
|
|
3530
3774
|
assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
|
|
3531
|
-
|
|
3775
|
+
_context33.next = 24;
|
|
3532
3776
|
return this.loadProducts({
|
|
3533
3777
|
product_ids: productIds,
|
|
3534
3778
|
schedule_date: dateRange.startDate
|
|
3535
3779
|
});
|
|
3536
3780
|
case 24:
|
|
3537
|
-
rawProducts =
|
|
3538
|
-
|
|
3781
|
+
rawProducts = _context33.sent;
|
|
3782
|
+
_context33.next = 28;
|
|
3539
3783
|
break;
|
|
3540
3784
|
case 27:
|
|
3541
3785
|
this.unifiedProductCatalog = [];
|
|
3542
3786
|
case 28:
|
|
3543
|
-
|
|
3787
|
+
_context33.next = 34;
|
|
3544
3788
|
break;
|
|
3545
3789
|
case 30:
|
|
3546
3790
|
if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
|
|
3547
|
-
|
|
3791
|
+
_context33.next = 34;
|
|
3548
3792
|
break;
|
|
3549
3793
|
}
|
|
3550
|
-
|
|
3794
|
+
_context33.next = 33;
|
|
3551
3795
|
return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
|
|
3552
3796
|
schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
|
|
3553
3797
|
}));
|
|
3554
3798
|
case 33:
|
|
3555
|
-
rawProducts =
|
|
3799
|
+
rawProducts = _context33.sent;
|
|
3556
3800
|
case 34:
|
|
3557
3801
|
normalized = rawProducts.map(function (product) {
|
|
3558
|
-
return normalizeProductForAvailability(product, params.scheduleList,
|
|
3802
|
+
return normalizeProductForAvailability(product, params.scheduleList, _this8.getAvailabilityRuntimeOffsetMinutes());
|
|
3559
3803
|
});
|
|
3560
3804
|
if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
|
|
3561
|
-
|
|
3805
|
+
_context33.next = 37;
|
|
3562
3806
|
break;
|
|
3563
3807
|
}
|
|
3564
|
-
return
|
|
3808
|
+
return _context33.abrupt("return", normalized.filter(function (product) {
|
|
3565
3809
|
var _product$requirementG2;
|
|
3566
3810
|
return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
|
|
3567
3811
|
var _group$resourceIds3;
|
|
@@ -3574,16 +3818,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3574
3818
|
}));
|
|
3575
3819
|
case 37:
|
|
3576
3820
|
productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
|
|
3577
|
-
return
|
|
3821
|
+
return _context33.abrupt("return", productIdSet ? normalized.filter(function (product) {
|
|
3578
3822
|
return productIdSet.has(String(product.id));
|
|
3579
3823
|
}) : normalized);
|
|
3580
3824
|
case 39:
|
|
3581
3825
|
case "end":
|
|
3582
|
-
return
|
|
3826
|
+
return _context33.stop();
|
|
3583
3827
|
}
|
|
3584
|
-
},
|
|
3828
|
+
}, _callee33, this);
|
|
3585
3829
|
}));
|
|
3586
|
-
function loadAvailabilityProducts(
|
|
3830
|
+
function loadAvailabilityProducts(_x20) {
|
|
3587
3831
|
return _loadAvailabilityProducts.apply(this, arguments);
|
|
3588
3832
|
}
|
|
3589
3833
|
return loadAvailabilityProducts;
|
|
@@ -3596,12 +3840,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3596
3840
|
}, {
|
|
3597
3841
|
key: "fetchAvailabilityResourcesV2",
|
|
3598
3842
|
value: (function () {
|
|
3599
|
-
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3843
|
+
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
3600
3844
|
var response, data;
|
|
3601
|
-
return _regeneratorRuntime().wrap(function
|
|
3602
|
-
while (1) switch (
|
|
3845
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3846
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3603
3847
|
case 0:
|
|
3604
|
-
|
|
3848
|
+
_context34.next = 2;
|
|
3605
3849
|
return this.request.get('/schedule/resource/list/v2', {
|
|
3606
3850
|
start_date: params.dateRange.startDate,
|
|
3607
3851
|
end_date: params.dateRange.endDate,
|
|
@@ -3611,28 +3855,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3611
3855
|
useCache: false
|
|
3612
3856
|
});
|
|
3613
3857
|
case 2:
|
|
3614
|
-
response =
|
|
3858
|
+
response = _context34.sent;
|
|
3615
3859
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
3616
3860
|
if (!Array.isArray(data)) {
|
|
3617
|
-
|
|
3861
|
+
_context34.next = 6;
|
|
3618
3862
|
break;
|
|
3619
3863
|
}
|
|
3620
|
-
return
|
|
3864
|
+
return _context34.abrupt("return", data);
|
|
3621
3865
|
case 6:
|
|
3622
3866
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
|
|
3623
|
-
|
|
3867
|
+
_context34.next = 8;
|
|
3624
3868
|
break;
|
|
3625
3869
|
}
|
|
3626
|
-
return
|
|
3870
|
+
return _context34.abrupt("return", data.list);
|
|
3627
3871
|
case 8:
|
|
3628
|
-
return
|
|
3872
|
+
return _context34.abrupt("return", []);
|
|
3629
3873
|
case 9:
|
|
3630
3874
|
case "end":
|
|
3631
|
-
return
|
|
3875
|
+
return _context34.stop();
|
|
3632
3876
|
}
|
|
3633
|
-
},
|
|
3877
|
+
}, _callee34, this);
|
|
3634
3878
|
}));
|
|
3635
|
-
function fetchAvailabilityResourcesV2(
|
|
3879
|
+
function fetchAvailabilityResourcesV2(_x21) {
|
|
3636
3880
|
return _fetchAvailabilityResourcesV.apply(this, arguments);
|
|
3637
3881
|
}
|
|
3638
3882
|
return fetchAvailabilityResourcesV2;
|
|
@@ -3640,17 +3884,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3640
3884
|
}, {
|
|
3641
3885
|
key: "fetchAndPublishAvailabilityResourcesV2",
|
|
3642
3886
|
value: function () {
|
|
3643
|
-
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3887
|
+
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
3644
3888
|
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
|
|
3645
|
-
return _regeneratorRuntime().wrap(function
|
|
3646
|
-
while (1) switch (
|
|
3889
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3890
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3647
3891
|
case 0:
|
|
3648
3892
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
3649
3893
|
if (!(normalizedResourceIds.length === 0)) {
|
|
3650
|
-
|
|
3894
|
+
_context35.next = 3;
|
|
3651
3895
|
break;
|
|
3652
3896
|
}
|
|
3653
|
-
return
|
|
3897
|
+
return _context35.abrupt("return", []);
|
|
3654
3898
|
case 3:
|
|
3655
3899
|
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
3656
3900
|
cacheParams = {
|
|
@@ -3660,7 +3904,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3660
3904
|
};
|
|
3661
3905
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
3662
3906
|
if (!cachedRawResources) {
|
|
3663
|
-
|
|
3907
|
+
_context35.next = 9;
|
|
3664
3908
|
break;
|
|
3665
3909
|
}
|
|
3666
3910
|
if (params.useCacheOnHit) {
|
|
@@ -3672,23 +3916,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3672
3916
|
console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
|
|
3673
3917
|
});
|
|
3674
3918
|
}
|
|
3675
|
-
return
|
|
3919
|
+
return _context35.abrupt("return", cachedRawResources);
|
|
3676
3920
|
case 9:
|
|
3677
|
-
|
|
3921
|
+
_context35.next = 11;
|
|
3678
3922
|
return this.refreshAvailabilityRemoteResourceQuery({
|
|
3679
3923
|
timezone: params.timezone,
|
|
3680
3924
|
dateRange: params.dateRange,
|
|
3681
3925
|
resourceIds: normalizedResourceIds
|
|
3682
3926
|
});
|
|
3683
3927
|
case 11:
|
|
3684
|
-
return
|
|
3928
|
+
return _context35.abrupt("return", _context35.sent);
|
|
3685
3929
|
case 12:
|
|
3686
3930
|
case "end":
|
|
3687
|
-
return
|
|
3931
|
+
return _context35.stop();
|
|
3688
3932
|
}
|
|
3689
|
-
},
|
|
3933
|
+
}, _callee35, this);
|
|
3690
3934
|
}));
|
|
3691
|
-
function fetchAndPublishAvailabilityResourcesV2(
|
|
3935
|
+
function fetchAndPublishAvailabilityResourcesV2(_x22) {
|
|
3692
3936
|
return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
|
|
3693
3937
|
}
|
|
3694
3938
|
return fetchAndPublishAvailabilityResourcesV2;
|
|
@@ -3696,17 +3940,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3696
3940
|
}, {
|
|
3697
3941
|
key: "refreshAvailabilityRemoteResourceQuery",
|
|
3698
3942
|
value: function () {
|
|
3699
|
-
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3943
|
+
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
3700
3944
|
var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
|
|
3701
|
-
return _regeneratorRuntime().wrap(function
|
|
3702
|
-
while (1) switch (
|
|
3945
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3946
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3703
3947
|
case 0:
|
|
3704
3948
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
3705
3949
|
if (!(normalizedResourceIds.length === 0)) {
|
|
3706
|
-
|
|
3950
|
+
_context36.next = 3;
|
|
3707
3951
|
break;
|
|
3708
3952
|
}
|
|
3709
|
-
return
|
|
3953
|
+
return _context36.abrupt("return", []);
|
|
3710
3954
|
case 3:
|
|
3711
3955
|
queryKey = this.buildAvailabilityRemoteResourceQueryKey({
|
|
3712
3956
|
timezone: params.timezone,
|
|
@@ -3716,13 +3960,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3716
3960
|
epoch = this.availabilityRemoteResourceEpoch;
|
|
3717
3961
|
existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
3718
3962
|
if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
|
|
3719
|
-
|
|
3963
|
+
_context36.next = 10;
|
|
3720
3964
|
break;
|
|
3721
3965
|
}
|
|
3722
|
-
|
|
3966
|
+
_context36.next = 9;
|
|
3723
3967
|
return existing.promise;
|
|
3724
3968
|
case 9:
|
|
3725
|
-
return
|
|
3969
|
+
return _context36.abrupt("return", _context36.sent);
|
|
3726
3970
|
case 10:
|
|
3727
3971
|
this.availabilityRemoteResourceQuerySequence += 1;
|
|
3728
3972
|
writeVersion = this.availabilityRemoteResourceQuerySequence;
|
|
@@ -3734,11 +3978,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3734
3978
|
epoch: epoch,
|
|
3735
3979
|
promise: promise
|
|
3736
3980
|
});
|
|
3737
|
-
|
|
3738
|
-
|
|
3981
|
+
_context36.prev = 14;
|
|
3982
|
+
_context36.next = 17;
|
|
3739
3983
|
return promise;
|
|
3740
3984
|
case 17:
|
|
3741
|
-
rawResources =
|
|
3985
|
+
rawResources = _context36.sent;
|
|
3742
3986
|
if (epoch === this.availabilityRemoteResourceEpoch) {
|
|
3743
3987
|
this.availabilityRemoteOccupancyCache.publish({
|
|
3744
3988
|
scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
|
|
@@ -3749,21 +3993,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3749
3993
|
version: writeVersion
|
|
3750
3994
|
});
|
|
3751
3995
|
}
|
|
3752
|
-
return
|
|
3996
|
+
return _context36.abrupt("return", rawResources);
|
|
3753
3997
|
case 20:
|
|
3754
|
-
|
|
3998
|
+
_context36.prev = 20;
|
|
3755
3999
|
current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
3756
4000
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
3757
4001
|
this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
|
|
3758
4002
|
}
|
|
3759
|
-
return
|
|
4003
|
+
return _context36.finish(20);
|
|
3760
4004
|
case 24:
|
|
3761
4005
|
case "end":
|
|
3762
|
-
return
|
|
4006
|
+
return _context36.stop();
|
|
3763
4007
|
}
|
|
3764
|
-
},
|
|
4008
|
+
}, _callee36, this, [[14,, 20, 24]]);
|
|
3765
4009
|
}));
|
|
3766
|
-
function refreshAvailabilityRemoteResourceQuery(
|
|
4010
|
+
function refreshAvailabilityRemoteResourceQuery(_x23) {
|
|
3767
4011
|
return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
|
|
3768
4012
|
}
|
|
3769
4013
|
return refreshAvailabilityRemoteResourceQuery;
|
|
@@ -3771,26 +4015,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3771
4015
|
}, {
|
|
3772
4016
|
key: "loadAvailabilityResources",
|
|
3773
4017
|
value: function () {
|
|
3774
|
-
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4018
|
+
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
3775
4019
|
var resourceIds, cachedRawResources, rawResources;
|
|
3776
|
-
return _regeneratorRuntime().wrap(function
|
|
3777
|
-
while (1) switch (
|
|
4020
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
4021
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3778
4022
|
case 0:
|
|
3779
4023
|
resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
|
|
3780
4024
|
if (!(resourceIds.length === 0)) {
|
|
3781
|
-
|
|
4025
|
+
_context37.next = 3;
|
|
3782
4026
|
break;
|
|
3783
4027
|
}
|
|
3784
|
-
return
|
|
4028
|
+
return _context37.abrupt("return", {
|
|
3785
4029
|
resources: [],
|
|
3786
4030
|
resourceOccupancies: []
|
|
3787
4031
|
});
|
|
3788
4032
|
case 3:
|
|
3789
4033
|
if (!Array.isArray(params.rawResources)) {
|
|
3790
|
-
|
|
4034
|
+
_context37.next = 5;
|
|
3791
4035
|
break;
|
|
3792
4036
|
}
|
|
3793
|
-
return
|
|
4037
|
+
return _context37.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
3794
4038
|
rawResources: params.rawResources,
|
|
3795
4039
|
scheduleList: params.scheduleList,
|
|
3796
4040
|
dateRange: params.dateRange,
|
|
@@ -3798,7 +4042,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3798
4042
|
}));
|
|
3799
4043
|
case 5:
|
|
3800
4044
|
if (!(params.fetchPolicy === 'cache_only')) {
|
|
3801
|
-
|
|
4045
|
+
_context37.next = 10;
|
|
3802
4046
|
break;
|
|
3803
4047
|
}
|
|
3804
4048
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read({
|
|
@@ -3807,22 +4051,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3807
4051
|
dateRange: params.dateRange
|
|
3808
4052
|
});
|
|
3809
4053
|
if (!cachedRawResources) {
|
|
3810
|
-
|
|
4054
|
+
_context37.next = 9;
|
|
3811
4055
|
break;
|
|
3812
4056
|
}
|
|
3813
|
-
return
|
|
4057
|
+
return _context37.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
3814
4058
|
rawResources: cachedRawResources,
|
|
3815
4059
|
scheduleList: params.scheduleList,
|
|
3816
4060
|
dateRange: params.dateRange,
|
|
3817
4061
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
3818
4062
|
}));
|
|
3819
4063
|
case 9:
|
|
3820
|
-
return
|
|
4064
|
+
return _context37.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
|
|
3821
4065
|
resources: [],
|
|
3822
4066
|
resourceOccupancies: []
|
|
3823
4067
|
});
|
|
3824
4068
|
case 10:
|
|
3825
|
-
|
|
4069
|
+
_context37.next = 12;
|
|
3826
4070
|
return this.fetchAndPublishAvailabilityResourcesV2({
|
|
3827
4071
|
timezone: params.timezone,
|
|
3828
4072
|
dateRange: params.dateRange,
|
|
@@ -3830,8 +4074,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3830
4074
|
useCacheOnHit: true
|
|
3831
4075
|
});
|
|
3832
4076
|
case 12:
|
|
3833
|
-
rawResources =
|
|
3834
|
-
return
|
|
4077
|
+
rawResources = _context37.sent;
|
|
4078
|
+
return _context37.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
3835
4079
|
rawResources: rawResources,
|
|
3836
4080
|
scheduleList: params.scheduleList,
|
|
3837
4081
|
dateRange: params.dateRange,
|
|
@@ -3839,11 +4083,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3839
4083
|
}));
|
|
3840
4084
|
case 14:
|
|
3841
4085
|
case "end":
|
|
3842
|
-
return
|
|
4086
|
+
return _context37.stop();
|
|
3843
4087
|
}
|
|
3844
|
-
},
|
|
4088
|
+
}, _callee37, this);
|
|
3845
4089
|
}));
|
|
3846
|
-
function loadAvailabilityResources(
|
|
4090
|
+
function loadAvailabilityResources(_x24) {
|
|
3847
4091
|
return _loadAvailabilityResources.apply(this, arguments);
|
|
3848
4092
|
}
|
|
3849
4093
|
return loadAvailabilityResources;
|
|
@@ -3863,7 +4107,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3863
4107
|
var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
|
|
3864
4108
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
3865
4109
|
productLineUids.forEach(function (requestedUid) {
|
|
3866
|
-
var
|
|
4110
|
+
var _ref47, _product$booking_uid2, _product$metadata5;
|
|
3867
4111
|
var product = products.find(function (line) {
|
|
3868
4112
|
return getProductLineUid(line) === String(requestedUid);
|
|
3869
4113
|
});
|
|
@@ -3873,7 +4117,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3873
4117
|
});
|
|
3874
4118
|
}
|
|
3875
4119
|
var productUid = getProductLineUid(product);
|
|
3876
|
-
var linkedBookingUid = String((
|
|
4120
|
+
var linkedBookingUid = String((_ref47 = (_product$booking_uid2 = product.booking_uid) !== null && _product$booking_uid2 !== void 0 ? _product$booking_uid2 : (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.booking_uid) !== null && _ref47 !== void 0 ? _ref47 : '');
|
|
3877
4121
|
var linkedBookings = bookings.filter(function (booking) {
|
|
3878
4122
|
var _booking$product_uid;
|
|
3879
4123
|
return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
|
|
@@ -3916,24 +4160,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3916
4160
|
}, {
|
|
3917
4161
|
key: "collectCartResourceOccupancies",
|
|
3918
4162
|
value: function collectCartResourceOccupancies(tempOrder, exclusions) {
|
|
3919
|
-
var
|
|
4163
|
+
var _this9 = this;
|
|
3920
4164
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
3921
4165
|
return bookings.flatMap(function (booking) {
|
|
3922
|
-
var
|
|
4166
|
+
var _ref48, _booking$product_uid2, _booking$metadata2;
|
|
3923
4167
|
var bookingUid = getBookingUid(booking);
|
|
3924
|
-
var productUid = String((
|
|
4168
|
+
var productUid = String((_ref48 = (_booking$product_uid2 = booking.product_uid) !== null && _booking$product_uid2 !== void 0 ? _booking$product_uid2 : (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid) !== null && _ref48 !== void 0 ? _ref48 : '');
|
|
3925
4169
|
var scheduleEventId = toNumberId(booking.schedule_event_id);
|
|
3926
4170
|
var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
|
|
3927
4171
|
var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
|
|
3928
4172
|
var resources = Array.isArray(booking.resources) ? booking.resources : [];
|
|
3929
4173
|
return resources.flatMap(function (resource) {
|
|
3930
|
-
var
|
|
3931
|
-
var resourceId = (
|
|
4174
|
+
var _ref49, _resource$resource_id, _ref50, _resource$capacity;
|
|
4175
|
+
var resourceId = (_ref49 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref49 !== void 0 ? _ref49 : resource.id;
|
|
3932
4176
|
if (resourceId == null || !startAt || !endAt) return [];
|
|
3933
4177
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3934
4178
|
startAt: startAt,
|
|
3935
4179
|
endAt: endAt,
|
|
3936
|
-
fixedOffsetMinutes:
|
|
4180
|
+
fixedOffsetMinutes: _this9.getAvailabilityRuntimeOffsetMinutes(),
|
|
3937
4181
|
rollOverEnd: false
|
|
3938
4182
|
});
|
|
3939
4183
|
if (!range) return [];
|
|
@@ -3941,7 +4185,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3941
4185
|
resourceId: resourceId,
|
|
3942
4186
|
startAt: range.startAt,
|
|
3943
4187
|
endAt: range.endAt,
|
|
3944
|
-
pax: Math.max(1, Number((
|
|
4188
|
+
pax: Math.max(1, Number((_ref50 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref50 !== void 0 ? _ref50 : 1) || 1),
|
|
3945
4189
|
source: 'cart',
|
|
3946
4190
|
scheduleEventId: scheduleEventId,
|
|
3947
4191
|
bookingUid: bookingUid || undefined,
|
|
@@ -3951,7 +4195,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3951
4195
|
resource: resource
|
|
3952
4196
|
}
|
|
3953
4197
|
};
|
|
3954
|
-
return
|
|
4198
|
+
return _this9.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
|
|
3955
4199
|
});
|
|
3956
4200
|
});
|
|
3957
4201
|
}
|
|
@@ -4018,16 +4262,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4018
4262
|
}, {
|
|
4019
4263
|
key: "assertContextualQueryFreshness",
|
|
4020
4264
|
value: function assertContextualQueryFreshness(context, request) {
|
|
4021
|
-
var
|
|
4265
|
+
var _this10 = this;
|
|
4022
4266
|
if (request.target === 'time') {
|
|
4023
4267
|
request.candidates.forEach(function (candidate) {
|
|
4024
|
-
|
|
4268
|
+
_this10.assertAvailabilityCandidateFreshness(context, candidate);
|
|
4025
4269
|
});
|
|
4026
4270
|
return;
|
|
4027
4271
|
}
|
|
4028
4272
|
if (request.target === 'resource') {
|
|
4029
4273
|
request.selectedRanges.forEach(function (candidate) {
|
|
4030
|
-
|
|
4274
|
+
_this10.assertAvailabilityCandidateFreshness(context, candidate);
|
|
4031
4275
|
});
|
|
4032
4276
|
}
|
|
4033
4277
|
}
|
|
@@ -4074,8 +4318,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4074
4318
|
}, {
|
|
4075
4319
|
key: "buildAvailabilityProjectionSnapshot",
|
|
4076
4320
|
value: function () {
|
|
4077
|
-
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4078
|
-
var
|
|
4321
|
+
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
4322
|
+
var _this11 = this;
|
|
4079
4323
|
var options,
|
|
4080
4324
|
normalizedPrepareParams,
|
|
4081
4325
|
timezoneLabel,
|
|
@@ -4096,11 +4340,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4096
4340
|
durationCandidateAnchorAt,
|
|
4097
4341
|
orderRevision,
|
|
4098
4342
|
projection,
|
|
4099
|
-
|
|
4100
|
-
return _regeneratorRuntime().wrap(function
|
|
4101
|
-
while (1) switch (
|
|
4343
|
+
_args38 = arguments;
|
|
4344
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
4345
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
4102
4346
|
case 0:
|
|
4103
|
-
options =
|
|
4347
|
+
options = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : {};
|
|
4104
4348
|
normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
4105
4349
|
timezoneLabel = String(normalizedPrepareParams.timezone);
|
|
4106
4350
|
dateRange = normalizedPrepareParams.dateRange;
|
|
@@ -4114,15 +4358,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4114
4358
|
scheduleList: scheduleList,
|
|
4115
4359
|
businessHours: businessHours
|
|
4116
4360
|
});
|
|
4117
|
-
|
|
4361
|
+
_context38.next = 11;
|
|
4118
4362
|
return this.loadAvailabilityProducts({
|
|
4119
4363
|
prepare: normalizedPrepareParams,
|
|
4120
4364
|
dateRange: dateRange,
|
|
4121
4365
|
scheduleList: scheduleList
|
|
4122
4366
|
});
|
|
4123
4367
|
case 11:
|
|
4124
|
-
products =
|
|
4125
|
-
|
|
4368
|
+
products = _context38.sent;
|
|
4369
|
+
_context38.next = 14;
|
|
4126
4370
|
return this.loadAvailabilityResources({
|
|
4127
4371
|
timezone: timezoneLabel,
|
|
4128
4372
|
dateRange: dateRange,
|
|
@@ -4134,14 +4378,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4134
4378
|
fallbackResources: options.fallbackResources
|
|
4135
4379
|
});
|
|
4136
4380
|
case 14:
|
|
4137
|
-
loadedResources =
|
|
4381
|
+
loadedResources = _context38.sent;
|
|
4138
4382
|
tempOrder = this.getTempOrder();
|
|
4139
4383
|
exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
|
|
4140
4384
|
injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
|
|
4141
4385
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4142
4386
|
startAt: occupancy.startAt,
|
|
4143
4387
|
endAt: occupancy.endAt,
|
|
4144
|
-
fixedOffsetMinutes:
|
|
4388
|
+
fixedOffsetMinutes: _this11.getAvailabilityRuntimeOffsetMinutes(),
|
|
4145
4389
|
rollOverEnd: false
|
|
4146
4390
|
});
|
|
4147
4391
|
if (!range) return [];
|
|
@@ -4151,7 +4395,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4151
4395
|
})];
|
|
4152
4396
|
});
|
|
4153
4397
|
remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
|
|
4154
|
-
return !
|
|
4398
|
+
return !_this11.occupancyIsExcluded(occupancy, exclusions);
|
|
4155
4399
|
});
|
|
4156
4400
|
cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
|
|
4157
4401
|
preparedAt = this.getAvailabilityRuntimeDateTime();
|
|
@@ -4180,18 +4424,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4180
4424
|
prepareParams: normalizedPrepareParams,
|
|
4181
4425
|
durationCandidateAnchorAt: durationCandidateAnchorAt
|
|
4182
4426
|
});
|
|
4183
|
-
return
|
|
4427
|
+
return _context38.abrupt("return", {
|
|
4184
4428
|
projection: projection,
|
|
4185
4429
|
prepareParams: normalizedPrepareParams,
|
|
4186
4430
|
orderRevision: orderRevision
|
|
4187
4431
|
});
|
|
4188
4432
|
case 26:
|
|
4189
4433
|
case "end":
|
|
4190
|
-
return
|
|
4434
|
+
return _context38.stop();
|
|
4191
4435
|
}
|
|
4192
|
-
},
|
|
4436
|
+
}, _callee38, this);
|
|
4193
4437
|
}));
|
|
4194
|
-
function buildAvailabilityProjectionSnapshot(
|
|
4438
|
+
function buildAvailabilityProjectionSnapshot(_x25) {
|
|
4195
4439
|
return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
|
|
4196
4440
|
}
|
|
4197
4441
|
return buildAvailabilityProjectionSnapshot;
|
|
@@ -4199,10 +4443,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4199
4443
|
}, {
|
|
4200
4444
|
key: "getSharedPreparedAvailabilitySnapshot",
|
|
4201
4445
|
value: function () {
|
|
4202
|
-
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4446
|
+
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
4203
4447
|
var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
|
|
4204
|
-
return _regeneratorRuntime().wrap(function
|
|
4205
|
-
while (1) switch (
|
|
4448
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4449
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
4206
4450
|
case 0:
|
|
4207
4451
|
lifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
4208
4452
|
normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
@@ -4221,15 +4465,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4221
4465
|
}
|
|
4222
4466
|
})) : this.buildAvailabilityPrepareKey(normalizedParams);
|
|
4223
4467
|
if (!hasRawInputs) {
|
|
4224
|
-
|
|
4468
|
+
_context39.next = 11;
|
|
4225
4469
|
break;
|
|
4226
4470
|
}
|
|
4227
|
-
|
|
4471
|
+
_context39.next = 7;
|
|
4228
4472
|
return this.buildAvailabilityProjectionSnapshot(normalizedParams);
|
|
4229
4473
|
case 7:
|
|
4230
|
-
snapshot =
|
|
4474
|
+
snapshot = _context39.sent;
|
|
4231
4475
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
4232
|
-
|
|
4476
|
+
_context39.next = 10;
|
|
4233
4477
|
break;
|
|
4234
4478
|
}
|
|
4235
4479
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -4238,7 +4482,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4238
4482
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
4239
4483
|
});
|
|
4240
4484
|
case 10:
|
|
4241
|
-
return
|
|
4485
|
+
return _context39.abrupt("return", {
|
|
4242
4486
|
prepareKey: prepareKey,
|
|
4243
4487
|
snapshot: snapshot
|
|
4244
4488
|
});
|
|
@@ -4252,13 +4496,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4252
4496
|
promise: promise
|
|
4253
4497
|
});
|
|
4254
4498
|
}
|
|
4255
|
-
|
|
4256
|
-
|
|
4499
|
+
_context39.prev = 14;
|
|
4500
|
+
_context39.next = 17;
|
|
4257
4501
|
return promise;
|
|
4258
4502
|
case 17:
|
|
4259
|
-
_snapshot =
|
|
4503
|
+
_snapshot = _context39.sent;
|
|
4260
4504
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
4261
|
-
|
|
4505
|
+
_context39.next = 20;
|
|
4262
4506
|
break;
|
|
4263
4507
|
}
|
|
4264
4508
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -4267,24 +4511,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4267
4511
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
4268
4512
|
});
|
|
4269
4513
|
case 20:
|
|
4270
|
-
return
|
|
4514
|
+
return _context39.abrupt("return", {
|
|
4271
4515
|
prepareKey: prepareKey,
|
|
4272
4516
|
snapshot: _snapshot
|
|
4273
4517
|
});
|
|
4274
4518
|
case 21:
|
|
4275
|
-
|
|
4519
|
+
_context39.prev = 21;
|
|
4276
4520
|
current = this.availabilityPrepareInFlight.get(prepareKey);
|
|
4277
4521
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4278
4522
|
this.availabilityPrepareInFlight.delete(prepareKey);
|
|
4279
4523
|
}
|
|
4280
|
-
return
|
|
4524
|
+
return _context39.finish(21);
|
|
4281
4525
|
case 25:
|
|
4282
4526
|
case "end":
|
|
4283
|
-
return
|
|
4527
|
+
return _context39.stop();
|
|
4284
4528
|
}
|
|
4285
|
-
},
|
|
4529
|
+
}, _callee39, this, [[14,, 21, 25]]);
|
|
4286
4530
|
}));
|
|
4287
|
-
function getSharedPreparedAvailabilitySnapshot(
|
|
4531
|
+
function getSharedPreparedAvailabilitySnapshot(_x26) {
|
|
4288
4532
|
return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
|
|
4289
4533
|
}
|
|
4290
4534
|
return getSharedPreparedAvailabilitySnapshot;
|
|
@@ -4292,51 +4536,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4292
4536
|
}, {
|
|
4293
4537
|
key: "refreshAvailabilityContextProjection",
|
|
4294
4538
|
value: function () {
|
|
4295
|
-
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4296
|
-
var
|
|
4539
|
+
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
4540
|
+
var _this12 = this;
|
|
4297
4541
|
var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
|
|
4298
|
-
return _regeneratorRuntime().wrap(function
|
|
4299
|
-
while (1) switch (
|
|
4542
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4543
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
4300
4544
|
case 0:
|
|
4301
4545
|
existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
4302
4546
|
if (!existingInFlight) {
|
|
4303
|
-
|
|
4547
|
+
_context41.next = 5;
|
|
4304
4548
|
break;
|
|
4305
4549
|
}
|
|
4306
|
-
|
|
4550
|
+
_context41.next = 4;
|
|
4307
4551
|
return existingInFlight;
|
|
4308
4552
|
case 4:
|
|
4309
|
-
return
|
|
4553
|
+
return _context41.abrupt("return", _context41.sent);
|
|
4310
4554
|
case 5:
|
|
4311
4555
|
context = this.getAvailabilityContextEntry(params.contextId);
|
|
4312
4556
|
expectedVersion = context.activeVersion;
|
|
4313
4557
|
expectedRefreshNonce = context.refreshNonce;
|
|
4314
4558
|
expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
4315
|
-
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4559
|
+
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
4316
4560
|
var snapshot, currentContext, projectionEntry;
|
|
4317
|
-
return _regeneratorRuntime().wrap(function
|
|
4318
|
-
while (1) switch (
|
|
4561
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4562
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
4319
4563
|
case 0:
|
|
4320
|
-
|
|
4321
|
-
return
|
|
4564
|
+
_context40.next = 2;
|
|
4565
|
+
return _this12.buildAvailabilityProjectionSnapshot(_this12.cloneAvailabilityPrepareParams(context.prepareParams), {
|
|
4322
4566
|
durationCandidateAnchorAt: context.durationCandidateAnchorAt
|
|
4323
4567
|
});
|
|
4324
4568
|
case 2:
|
|
4325
|
-
snapshot =
|
|
4326
|
-
currentContext =
|
|
4569
|
+
snapshot = _context40.sent;
|
|
4570
|
+
currentContext = _this12.availabilityContextRegistry.get(params.contextId);
|
|
4327
4571
|
if (currentContext) {
|
|
4328
|
-
|
|
4572
|
+
_context40.next = 6;
|
|
4329
4573
|
break;
|
|
4330
4574
|
}
|
|
4331
|
-
return
|
|
4575
|
+
return _context40.abrupt("return", null);
|
|
4332
4576
|
case 6:
|
|
4333
|
-
if (!(expectedLifecycleGeneration !==
|
|
4334
|
-
|
|
4577
|
+
if (!(expectedLifecycleGeneration !== _this12.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
|
|
4578
|
+
_context40.next = 8;
|
|
4335
4579
|
break;
|
|
4336
4580
|
}
|
|
4337
|
-
return
|
|
4581
|
+
return _context40.abrupt("return", null);
|
|
4338
4582
|
case 8:
|
|
4339
|
-
projectionEntry =
|
|
4583
|
+
projectionEntry = _this12.storeAvailabilityProjectionEntry({
|
|
4340
4584
|
contextId: currentContext.contextId,
|
|
4341
4585
|
prepareParams: snapshot.prepareParams,
|
|
4342
4586
|
prepareKey: currentContext.prepareKey,
|
|
@@ -4344,8 +4588,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4344
4588
|
orderRevision: snapshot.orderRevision,
|
|
4345
4589
|
incrementVersion: true
|
|
4346
4590
|
});
|
|
4347
|
-
|
|
4348
|
-
return
|
|
4591
|
+
_context40.next = 11;
|
|
4592
|
+
return _this12.emitAvailabilityDiagnostic({
|
|
4349
4593
|
action: 'refresh',
|
|
4350
4594
|
contextId: currentContext.contextId,
|
|
4351
4595
|
contextVersion: projectionEntry.contextVersion,
|
|
@@ -4356,33 +4600,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4356
4600
|
reason: params.reason
|
|
4357
4601
|
});
|
|
4358
4602
|
case 11:
|
|
4359
|
-
return
|
|
4603
|
+
return _context40.abrupt("return", projectionEntry);
|
|
4360
4604
|
case 12:
|
|
4361
4605
|
case "end":
|
|
4362
|
-
return
|
|
4606
|
+
return _context40.stop();
|
|
4363
4607
|
}
|
|
4364
|
-
},
|
|
4608
|
+
}, _callee40);
|
|
4365
4609
|
}))();
|
|
4366
4610
|
this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
|
|
4367
|
-
|
|
4368
|
-
|
|
4611
|
+
_context41.prev = 11;
|
|
4612
|
+
_context41.next = 14;
|
|
4369
4613
|
return refreshPromise;
|
|
4370
4614
|
case 14:
|
|
4371
|
-
return
|
|
4615
|
+
return _context41.abrupt("return", _context41.sent);
|
|
4372
4616
|
case 15:
|
|
4373
|
-
|
|
4617
|
+
_context41.prev = 15;
|
|
4374
4618
|
current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
4375
4619
|
if (current === refreshPromise) {
|
|
4376
4620
|
this.availabilityProjectionRefreshInFlight.delete(params.contextId);
|
|
4377
4621
|
}
|
|
4378
|
-
return
|
|
4622
|
+
return _context41.finish(15);
|
|
4379
4623
|
case 19:
|
|
4380
4624
|
case "end":
|
|
4381
|
-
return
|
|
4625
|
+
return _context41.stop();
|
|
4382
4626
|
}
|
|
4383
|
-
},
|
|
4627
|
+
}, _callee41, this, [[11,, 15, 19]]);
|
|
4384
4628
|
}));
|
|
4385
|
-
function refreshAvailabilityContextProjection(
|
|
4629
|
+
function refreshAvailabilityContextProjection(_x27) {
|
|
4386
4630
|
return _refreshAvailabilityContextProjection.apply(this, arguments);
|
|
4387
4631
|
}
|
|
4388
4632
|
return refreshAvailabilityContextProjection;
|
|
@@ -4390,53 +4634,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4390
4634
|
}, {
|
|
4391
4635
|
key: "ensureAvailabilityContextProjection",
|
|
4392
4636
|
value: function () {
|
|
4393
|
-
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4637
|
+
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(contextId, reason) {
|
|
4394
4638
|
var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
|
|
4395
|
-
return _regeneratorRuntime().wrap(function
|
|
4396
|
-
while (1) switch (
|
|
4639
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4640
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4397
4641
|
case 0:
|
|
4398
4642
|
retries = 0;
|
|
4399
4643
|
case 1:
|
|
4400
4644
|
if (!(retries < 3)) {
|
|
4401
|
-
|
|
4645
|
+
_context42.next = 19;
|
|
4402
4646
|
break;
|
|
4403
4647
|
}
|
|
4404
4648
|
context = this.getAvailabilityContextEntry(contextId);
|
|
4405
4649
|
currentOrderRevision = this.getCurrentOrderRevision();
|
|
4406
4650
|
projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
|
|
4407
4651
|
if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
|
|
4408
|
-
|
|
4652
|
+
_context42.next = 7;
|
|
4409
4653
|
break;
|
|
4410
4654
|
}
|
|
4411
|
-
return
|
|
4655
|
+
return _context42.abrupt("return", {
|
|
4412
4656
|
context: context,
|
|
4413
4657
|
projectionEntry: projectionEntry,
|
|
4414
4658
|
refreshed: false
|
|
4415
4659
|
});
|
|
4416
4660
|
case 7:
|
|
4417
|
-
|
|
4661
|
+
_context42.next = 9;
|
|
4418
4662
|
return this.refreshAvailabilityContextProjection({
|
|
4419
4663
|
contextId: contextId,
|
|
4420
4664
|
reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
|
|
4421
4665
|
previousOrderRevision: context.lastKnownOrderRevision
|
|
4422
4666
|
});
|
|
4423
4667
|
case 9:
|
|
4424
|
-
refreshedProjectionEntry =
|
|
4668
|
+
refreshedProjectionEntry = _context42.sent;
|
|
4425
4669
|
if (refreshedProjectionEntry) {
|
|
4426
|
-
|
|
4670
|
+
_context42.next = 13;
|
|
4427
4671
|
break;
|
|
4428
4672
|
}
|
|
4429
4673
|
retries += 1;
|
|
4430
|
-
return
|
|
4674
|
+
return _context42.abrupt("continue", 1);
|
|
4431
4675
|
case 13:
|
|
4432
4676
|
if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
4433
|
-
|
|
4677
|
+
_context42.next = 16;
|
|
4434
4678
|
break;
|
|
4435
4679
|
}
|
|
4436
4680
|
retries += 1;
|
|
4437
|
-
return
|
|
4681
|
+
return _context42.abrupt("continue", 1);
|
|
4438
4682
|
case 16:
|
|
4439
|
-
return
|
|
4683
|
+
return _context42.abrupt("return", {
|
|
4440
4684
|
context: this.getAvailabilityContextEntry(contextId),
|
|
4441
4685
|
projectionEntry: refreshedProjectionEntry,
|
|
4442
4686
|
refreshed: true
|
|
@@ -4448,11 +4692,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4448
4692
|
});
|
|
4449
4693
|
case 20:
|
|
4450
4694
|
case "end":
|
|
4451
|
-
return
|
|
4695
|
+
return _context42.stop();
|
|
4452
4696
|
}
|
|
4453
|
-
},
|
|
4697
|
+
}, _callee42, this);
|
|
4454
4698
|
}));
|
|
4455
|
-
function ensureAvailabilityContextProjection(
|
|
4699
|
+
function ensureAvailabilityContextProjection(_x28, _x29) {
|
|
4456
4700
|
return _ensureAvailabilityContextProjection.apply(this, arguments);
|
|
4457
4701
|
}
|
|
4458
4702
|
return ensureAvailabilityContextProjection;
|
|
@@ -4460,18 +4704,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4460
4704
|
}, {
|
|
4461
4705
|
key: "tryAcquireAvailabilityCommitLock",
|
|
4462
4706
|
value: function () {
|
|
4463
|
-
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4707
|
+
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(contextId) {
|
|
4464
4708
|
var _currentContext$activ;
|
|
4465
4709
|
var _waitingContext$activ, waitingContext, currentContext;
|
|
4466
|
-
return _regeneratorRuntime().wrap(function
|
|
4467
|
-
while (1) switch (
|
|
4710
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4711
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4468
4712
|
case 0:
|
|
4469
4713
|
if (!this.availabilityCommitLocks.has(contextId)) {
|
|
4470
|
-
|
|
4714
|
+
_context43.next = 5;
|
|
4471
4715
|
break;
|
|
4472
4716
|
}
|
|
4473
4717
|
waitingContext = this.availabilityContextRegistry.get(contextId);
|
|
4474
|
-
|
|
4718
|
+
_context43.next = 4;
|
|
4475
4719
|
return this.emitAvailabilityDiagnostic({
|
|
4476
4720
|
action: 'commit_lock_wait',
|
|
4477
4721
|
contextId: contextId,
|
|
@@ -4488,7 +4732,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4488
4732
|
case 5:
|
|
4489
4733
|
this.availabilityCommitLocks.add(contextId);
|
|
4490
4734
|
currentContext = this.availabilityContextRegistry.get(contextId);
|
|
4491
|
-
|
|
4735
|
+
_context43.next = 9;
|
|
4492
4736
|
return this.emitAvailabilityDiagnostic({
|
|
4493
4737
|
action: 'commit_lock_acquired',
|
|
4494
4738
|
contextId: contextId,
|
|
@@ -4500,11 +4744,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4500
4744
|
});
|
|
4501
4745
|
case 9:
|
|
4502
4746
|
case "end":
|
|
4503
|
-
return
|
|
4747
|
+
return _context43.stop();
|
|
4504
4748
|
}
|
|
4505
|
-
},
|
|
4749
|
+
}, _callee43, this);
|
|
4506
4750
|
}));
|
|
4507
|
-
function tryAcquireAvailabilityCommitLock(
|
|
4751
|
+
function tryAcquireAvailabilityCommitLock(_x30) {
|
|
4508
4752
|
return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
|
|
4509
4753
|
}
|
|
4510
4754
|
return tryAcquireAvailabilityCommitLock;
|
|
@@ -4512,15 +4756,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4512
4756
|
}, {
|
|
4513
4757
|
key: "releaseAvailabilityCommitLock",
|
|
4514
4758
|
value: function () {
|
|
4515
|
-
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4759
|
+
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(contextId) {
|
|
4516
4760
|
var _releasedContext$acti;
|
|
4517
4761
|
var releasedContext;
|
|
4518
|
-
return _regeneratorRuntime().wrap(function
|
|
4519
|
-
while (1) switch (
|
|
4762
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4763
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4520
4764
|
case 0:
|
|
4521
4765
|
this.availabilityCommitLocks.delete(contextId);
|
|
4522
4766
|
releasedContext = this.availabilityContextRegistry.get(contextId);
|
|
4523
|
-
|
|
4767
|
+
_context44.next = 4;
|
|
4524
4768
|
return this.emitAvailabilityDiagnostic({
|
|
4525
4769
|
action: 'commit_lock_released',
|
|
4526
4770
|
contextId: contextId,
|
|
@@ -4532,11 +4776,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4532
4776
|
});
|
|
4533
4777
|
case 4:
|
|
4534
4778
|
case "end":
|
|
4535
|
-
return
|
|
4779
|
+
return _context44.stop();
|
|
4536
4780
|
}
|
|
4537
|
-
},
|
|
4781
|
+
}, _callee44, this);
|
|
4538
4782
|
}));
|
|
4539
|
-
function releaseAvailabilityCommitLock(
|
|
4783
|
+
function releaseAvailabilityCommitLock(_x31) {
|
|
4540
4784
|
return _releaseAvailabilityCommitLock.apply(this, arguments);
|
|
4541
4785
|
}
|
|
4542
4786
|
return releaseAvailabilityCommitLock;
|
|
@@ -4544,20 +4788,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4544
4788
|
}, {
|
|
4545
4789
|
key: "prepareAvailabilityProjection",
|
|
4546
4790
|
value: (function () {
|
|
4547
|
-
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4791
|
+
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
4548
4792
|
var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
|
|
4549
|
-
return _regeneratorRuntime().wrap(function
|
|
4550
|
-
while (1) switch (
|
|
4793
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4794
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4551
4795
|
case 0:
|
|
4552
4796
|
this.assertAvailabilityPrepareParams(params);
|
|
4553
|
-
|
|
4797
|
+
_context45.next = 3;
|
|
4554
4798
|
return this.resolveAvailabilityPrepareDefaults(params);
|
|
4555
4799
|
case 3:
|
|
4556
|
-
paramsWithDefaults =
|
|
4557
|
-
|
|
4800
|
+
paramsWithDefaults = _context45.sent;
|
|
4801
|
+
_context45.next = 6;
|
|
4558
4802
|
return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
|
|
4559
4803
|
case 6:
|
|
4560
|
-
_yield$this$getShared =
|
|
4804
|
+
_yield$this$getShared = _context45.sent;
|
|
4561
4805
|
prepareKey = _yield$this$getShared.prepareKey;
|
|
4562
4806
|
snapshot = _yield$this$getShared.snapshot;
|
|
4563
4807
|
contextId = this.createAvailabilityContextId();
|
|
@@ -4578,7 +4822,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4578
4822
|
refreshed: false,
|
|
4579
4823
|
reason: 'prepare'
|
|
4580
4824
|
};
|
|
4581
|
-
|
|
4825
|
+
_context45.next = 16;
|
|
4582
4826
|
return this.emitAvailabilityDiagnostic({
|
|
4583
4827
|
action: 'prepare',
|
|
4584
4828
|
contextId: contextId,
|
|
@@ -4589,17 +4833,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4589
4833
|
reason: 'prepare'
|
|
4590
4834
|
});
|
|
4591
4835
|
case 16:
|
|
4592
|
-
|
|
4836
|
+
_context45.next = 18;
|
|
4593
4837
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
|
|
4594
4838
|
case 18:
|
|
4595
|
-
return
|
|
4839
|
+
return _context45.abrupt("return", handle);
|
|
4596
4840
|
case 19:
|
|
4597
4841
|
case "end":
|
|
4598
|
-
return
|
|
4842
|
+
return _context45.stop();
|
|
4599
4843
|
}
|
|
4600
|
-
},
|
|
4844
|
+
}, _callee45, this);
|
|
4601
4845
|
}));
|
|
4602
|
-
function prepareAvailabilityProjection(
|
|
4846
|
+
function prepareAvailabilityProjection(_x32) {
|
|
4603
4847
|
return _prepareAvailabilityProjection.apply(this, arguments);
|
|
4604
4848
|
}
|
|
4605
4849
|
return prepareAvailabilityProjection;
|
|
@@ -4607,10 +4851,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4607
4851
|
}, {
|
|
4608
4852
|
key: "getProductTimeRanges",
|
|
4609
4853
|
value: (function () {
|
|
4610
|
-
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4854
|
+
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(contextId) {
|
|
4611
4855
|
var _this$otherParams$pla,
|
|
4612
|
-
_this$
|
|
4613
|
-
|
|
4856
|
+
_this$otherParams24,
|
|
4857
|
+
_this13 = this;
|
|
4614
4858
|
var request,
|
|
4615
4859
|
_yield$this$ensureAva,
|
|
4616
4860
|
context,
|
|
@@ -4618,23 +4862,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4618
4862
|
contextVersion,
|
|
4619
4863
|
isPosAvailabilityRequest,
|
|
4620
4864
|
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
4621
|
-
|
|
4622
|
-
return _regeneratorRuntime().wrap(function
|
|
4623
|
-
while (1) switch (
|
|
4865
|
+
_args46 = arguments;
|
|
4866
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4867
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4624
4868
|
case 0:
|
|
4625
|
-
request =
|
|
4626
|
-
|
|
4869
|
+
request = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {};
|
|
4870
|
+
_context46.next = 3;
|
|
4627
4871
|
return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
|
|
4628
4872
|
case 3:
|
|
4629
|
-
_yield$this$ensureAva =
|
|
4873
|
+
_yield$this$ensureAva = _context46.sent;
|
|
4630
4874
|
context = _yield$this$ensureAva.context;
|
|
4631
4875
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
4632
4876
|
contextVersion = context.activeVersion;
|
|
4633
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$
|
|
4877
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase() === 'pos';
|
|
4634
4878
|
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
4635
4879
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
4636
4880
|
});
|
|
4637
|
-
return
|
|
4881
|
+
return _context46.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
|
|
4638
4882
|
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
4639
4883
|
} : {}), {
|
|
4640
4884
|
evaluatedAt: this.getAvailabilityRuntimeDateTime(),
|
|
@@ -4644,17 +4888,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4644
4888
|
}).map(function (group) {
|
|
4645
4889
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
4646
4890
|
ranges: group.ranges.map(function (candidate) {
|
|
4647
|
-
return
|
|
4891
|
+
return _this13.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
|
|
4648
4892
|
})
|
|
4649
4893
|
});
|
|
4650
4894
|
}));
|
|
4651
4895
|
case 10:
|
|
4652
4896
|
case "end":
|
|
4653
|
-
return
|
|
4897
|
+
return _context46.stop();
|
|
4654
4898
|
}
|
|
4655
|
-
},
|
|
4899
|
+
}, _callee46, this);
|
|
4656
4900
|
}));
|
|
4657
|
-
function getProductTimeRanges(
|
|
4901
|
+
function getProductTimeRanges(_x33) {
|
|
4658
4902
|
return _getProductTimeRanges.apply(this, arguments);
|
|
4659
4903
|
}
|
|
4660
4904
|
return getProductTimeRanges;
|
|
@@ -4662,21 +4906,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4662
4906
|
}, {
|
|
4663
4907
|
key: "queryBookingAvailability",
|
|
4664
4908
|
value: (function () {
|
|
4665
|
-
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4666
|
-
var _this$otherParams$pla2, _this$
|
|
4909
|
+
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(contextId, request) {
|
|
4910
|
+
var _this$otherParams$pla2, _this$otherParams25;
|
|
4667
4911
|
var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, result, contextVersion, contextualResult;
|
|
4668
|
-
return _regeneratorRuntime().wrap(function
|
|
4669
|
-
while (1) switch (
|
|
4912
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4913
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4670
4914
|
case 0:
|
|
4671
|
-
|
|
4915
|
+
_context47.next = 2;
|
|
4672
4916
|
return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
|
|
4673
4917
|
case 2:
|
|
4674
|
-
_yield$this$ensureAva2 =
|
|
4918
|
+
_yield$this$ensureAva2 = _context47.sent;
|
|
4675
4919
|
context = _yield$this$ensureAva2.context;
|
|
4676
4920
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
4677
4921
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
4678
4922
|
this.assertContextualQueryFreshness(context, request);
|
|
4679
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$
|
|
4923
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
4680
4924
|
result = queryAvailabilityProjection(projectionEntry.projection, request, {
|
|
4681
4925
|
useExactDurationCandidateMinute: isPosAvailabilityRequest,
|
|
4682
4926
|
allowExcludedScheduleDateOverride: isPosAvailabilityRequest
|
|
@@ -4707,18 +4951,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4707
4951
|
});
|
|
4708
4952
|
})
|
|
4709
4953
|
}) : result;
|
|
4710
|
-
return
|
|
4954
|
+
return _context47.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
|
|
4711
4955
|
contextId: context.contextId,
|
|
4712
4956
|
contextVersion: contextVersion,
|
|
4713
4957
|
refreshed: refreshed
|
|
4714
4958
|
}));
|
|
4715
4959
|
case 12:
|
|
4716
4960
|
case "end":
|
|
4717
|
-
return
|
|
4961
|
+
return _context47.stop();
|
|
4718
4962
|
}
|
|
4719
|
-
},
|
|
4963
|
+
}, _callee47, this);
|
|
4720
4964
|
}));
|
|
4721
|
-
function queryBookingAvailability(
|
|
4965
|
+
function queryBookingAvailability(_x34, _x35) {
|
|
4722
4966
|
return _queryBookingAvailability.apply(this, arguments);
|
|
4723
4967
|
}
|
|
4724
4968
|
return queryBookingAvailability;
|
|
@@ -4775,9 +5019,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4775
5019
|
}, {
|
|
4776
5020
|
key: "findLinkedBooking",
|
|
4777
5021
|
value: function findLinkedBooking(product) {
|
|
4778
|
-
var
|
|
5022
|
+
var _ref52, _product$booking_uid3, _product$metadata6, _this$getTempOrder3;
|
|
4779
5023
|
var productUid = getProductLineUid(product);
|
|
4780
|
-
var bookingUid = String((
|
|
5024
|
+
var bookingUid = String((_ref52 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid) !== null && _ref52 !== void 0 ? _ref52 : '');
|
|
4781
5025
|
return (((_this$getTempOrder3 = this.getTempOrder()) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.bookings) || []).find(function (booking) {
|
|
4782
5026
|
var _booking$product_uid3;
|
|
4783
5027
|
return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
|
|
@@ -4788,27 +5032,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4788
5032
|
}, {
|
|
4789
5033
|
key: "commitAvailabilitySelection",
|
|
4790
5034
|
value: (function () {
|
|
4791
|
-
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4792
|
-
var normalizedContextId, _params$bookingCount,
|
|
4793
|
-
return _regeneratorRuntime().wrap(function
|
|
4794
|
-
while (1) switch (
|
|
5035
|
+
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId, params) {
|
|
5036
|
+
var normalizedContextId, _params$bookingCount, _ref53, _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$otherParams26, _ref54, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref55, _ref56, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, 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, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref57, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _params$salesNotes, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
|
|
5037
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5038
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4795
5039
|
case 0:
|
|
4796
5040
|
normalizedContextId = String(contextId || '').trim();
|
|
4797
5041
|
if (normalizedContextId) {
|
|
4798
|
-
|
|
5042
|
+
_context48.next = 3;
|
|
4799
5043
|
break;
|
|
4800
5044
|
}
|
|
4801
5045
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
|
|
4802
5046
|
candidate: params.candidate
|
|
4803
5047
|
});
|
|
4804
5048
|
case 3:
|
|
4805
|
-
|
|
5049
|
+
_context48.next = 5;
|
|
4806
5050
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
4807
5051
|
case 5:
|
|
4808
|
-
|
|
5052
|
+
_context48.prev = 5;
|
|
4809
5053
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
4810
5054
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
4811
|
-
|
|
5055
|
+
_context48.next = 9;
|
|
4812
5056
|
break;
|
|
4813
5057
|
}
|
|
4814
5058
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
@@ -4816,16 +5060,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4816
5060
|
});
|
|
4817
5061
|
case 9:
|
|
4818
5062
|
if (!(params.mode === 'edit' && bookingCount !== 1)) {
|
|
4819
|
-
|
|
5063
|
+
_context48.next = 11;
|
|
4820
5064
|
break;
|
|
4821
5065
|
}
|
|
4822
5066
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
4823
5067
|
bookingCount: bookingCount
|
|
4824
5068
|
});
|
|
4825
5069
|
case 11:
|
|
4826
|
-
orderProductQuantity = (
|
|
5070
|
+
orderProductQuantity = (_ref53 = (_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 && _ref53 !== void 0 ? _ref53 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
|
|
4827
5071
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
4828
|
-
|
|
5072
|
+
_context48.next = 14;
|
|
4829
5073
|
break;
|
|
4830
5074
|
}
|
|
4831
5075
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
@@ -4835,22 +5079,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4835
5079
|
case 14:
|
|
4836
5080
|
partySize = Number(params.partySize);
|
|
4837
5081
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
4838
|
-
|
|
5082
|
+
_context48.next = 17;
|
|
4839
5083
|
break;
|
|
4840
5084
|
}
|
|
4841
5085
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
4842
5086
|
partySize: params.partySize
|
|
4843
5087
|
});
|
|
4844
5088
|
case 17:
|
|
4845
|
-
|
|
5089
|
+
_context48.next = 19;
|
|
4846
5090
|
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
4847
5091
|
case 19:
|
|
4848
|
-
_yield$this$ensureAva3 =
|
|
5092
|
+
_yield$this$ensureAva3 = _context48.sent;
|
|
4849
5093
|
context = _yield$this$ensureAva3.context;
|
|
4850
5094
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
4851
5095
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
4852
5096
|
if (!refreshed) {
|
|
4853
|
-
|
|
5097
|
+
_context48.next = 25;
|
|
4854
5098
|
break;
|
|
4855
5099
|
}
|
|
4856
5100
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -4861,11 +5105,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4861
5105
|
case 25:
|
|
4862
5106
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
4863
5107
|
if (!(params.mode === 'edit')) {
|
|
4864
|
-
|
|
5108
|
+
_context48.next = 31;
|
|
4865
5109
|
break;
|
|
4866
5110
|
}
|
|
4867
5111
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
4868
|
-
|
|
5112
|
+
_context48.next = 29;
|
|
4869
5113
|
break;
|
|
4870
5114
|
}
|
|
4871
5115
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -4874,11 +5118,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4874
5118
|
editingProductLineUids: boundEditingUids
|
|
4875
5119
|
});
|
|
4876
5120
|
case 29:
|
|
4877
|
-
|
|
5121
|
+
_context48.next = 33;
|
|
4878
5122
|
break;
|
|
4879
5123
|
case 31:
|
|
4880
5124
|
if (!(boundEditingUids.length > 0)) {
|
|
4881
|
-
|
|
5125
|
+
_context48.next = 33;
|
|
4882
5126
|
break;
|
|
4883
5127
|
}
|
|
4884
5128
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
@@ -4887,7 +5131,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4887
5131
|
});
|
|
4888
5132
|
case 33:
|
|
4889
5133
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
4890
|
-
|
|
5134
|
+
_context48.next = 35;
|
|
4891
5135
|
break;
|
|
4892
5136
|
}
|
|
4893
5137
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -4897,7 +5141,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4897
5141
|
});
|
|
4898
5142
|
case 35:
|
|
4899
5143
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
4900
|
-
|
|
5144
|
+
_context48.next = 37;
|
|
4901
5145
|
break;
|
|
4902
5146
|
}
|
|
4903
5147
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -4908,7 +5152,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4908
5152
|
});
|
|
4909
5153
|
case 37:
|
|
4910
5154
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
4911
|
-
|
|
5155
|
+
_context48.next = 39;
|
|
4912
5156
|
break;
|
|
4913
5157
|
}
|
|
4914
5158
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -4920,7 +5164,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4920
5164
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
4921
5165
|
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;
|
|
4922
5166
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
4923
|
-
|
|
5167
|
+
_context48.next = 43;
|
|
4924
5168
|
break;
|
|
4925
5169
|
}
|
|
4926
5170
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
@@ -4929,14 +5173,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4929
5173
|
});
|
|
4930
5174
|
case 43:
|
|
4931
5175
|
if (!(params.mode === 'edit' && !params.productLineUid)) {
|
|
4932
|
-
|
|
5176
|
+
_context48.next = 45;
|
|
4933
5177
|
break;
|
|
4934
5178
|
}
|
|
4935
5179
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
4936
5180
|
case 45:
|
|
4937
5181
|
editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
4938
5182
|
if (!(params.mode === 'edit' && !editingLine)) {
|
|
4939
|
-
|
|
5183
|
+
_context48.next = 48;
|
|
4940
5184
|
break;
|
|
4941
5185
|
}
|
|
4942
5186
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
@@ -4944,7 +5188,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4944
5188
|
});
|
|
4945
5189
|
case 48:
|
|
4946
5190
|
if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
4947
|
-
|
|
5191
|
+
_context48.next = 50;
|
|
4948
5192
|
break;
|
|
4949
5193
|
}
|
|
4950
5194
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -4954,7 +5198,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4954
5198
|
});
|
|
4955
5199
|
case 50:
|
|
4956
5200
|
if (Array.isArray(params.requirementSelections)) {
|
|
4957
|
-
|
|
5201
|
+
_context48.next = 52;
|
|
4958
5202
|
break;
|
|
4959
5203
|
}
|
|
4960
5204
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
@@ -4971,7 +5215,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4971
5215
|
};
|
|
4972
5216
|
prepareParams = baseProjection.meta.prepareParams;
|
|
4973
5217
|
if (prepareParams) {
|
|
4974
|
-
|
|
5218
|
+
_context48.next = 57;
|
|
4975
5219
|
break;
|
|
4976
5220
|
}
|
|
4977
5221
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
@@ -4983,7 +5227,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4983
5227
|
})),
|
|
4984
5228
|
includesInjectedRawOccupancies: true
|
|
4985
5229
|
};
|
|
4986
|
-
|
|
5230
|
+
_context48.next = 60;
|
|
4987
5231
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
4988
5232
|
editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
|
|
4989
5233
|
}), {
|
|
@@ -4992,13 +5236,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4992
5236
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
4993
5237
|
});
|
|
4994
5238
|
case 60:
|
|
4995
|
-
commitSnapshot =
|
|
5239
|
+
commitSnapshot = _context48.sent;
|
|
4996
5240
|
refreshedProjection = commitSnapshot.projection;
|
|
4997
5241
|
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 : ''))) {
|
|
4998
|
-
|
|
5242
|
+
_context48.next = 67;
|
|
4999
5243
|
break;
|
|
5000
5244
|
}
|
|
5001
|
-
|
|
5245
|
+
_context48.next = 65;
|
|
5002
5246
|
return this.refreshAvailabilityContextProjection({
|
|
5003
5247
|
contextId: normalizedContextId,
|
|
5004
5248
|
reason: 'commit_order_revision_changed',
|
|
@@ -5019,7 +5263,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5019
5263
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
5020
5264
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
5021
5265
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
5022
|
-
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$
|
|
5266
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
|
|
5023
5267
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
5024
5268
|
productIds: [params.candidate.productId],
|
|
5025
5269
|
dateRange: {
|
|
@@ -5043,7 +5287,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5043
5287
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
5044
5288
|
});
|
|
5045
5289
|
if (refreshedCandidateBase) {
|
|
5046
|
-
|
|
5290
|
+
_context48.next = 75;
|
|
5047
5291
|
break;
|
|
5048
5292
|
}
|
|
5049
5293
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -5056,7 +5300,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5056
5300
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
5057
5301
|
});
|
|
5058
5302
|
if (product) {
|
|
5059
|
-
|
|
5303
|
+
_context48.next = 78;
|
|
5060
5304
|
break;
|
|
5061
5305
|
}
|
|
5062
5306
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
@@ -5093,7 +5337,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5093
5337
|
});
|
|
5094
5338
|
}
|
|
5095
5339
|
if (validation.ok) {
|
|
5096
|
-
|
|
5340
|
+
_context48.next = 83;
|
|
5097
5341
|
break;
|
|
5098
5342
|
}
|
|
5099
5343
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -5116,7 +5360,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5116
5360
|
incrementVersion: true
|
|
5117
5361
|
});
|
|
5118
5362
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
5119
|
-
|
|
5363
|
+
_context48.next = 87;
|
|
5120
5364
|
return this.emitAvailabilityDiagnostic({
|
|
5121
5365
|
action: 'refresh',
|
|
5122
5366
|
contextId: normalizedContextId,
|
|
@@ -5139,7 +5383,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5139
5383
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
5140
5384
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
5141
5385
|
if (!(params.mode === 'edit' && !existingBookingUid)) {
|
|
5142
|
-
|
|
5386
|
+
_context48.next = 93;
|
|
5143
5387
|
break;
|
|
5144
5388
|
}
|
|
5145
5389
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
@@ -5153,15 +5397,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5153
5397
|
product: product,
|
|
5154
5398
|
resources: refreshedProjection.resources,
|
|
5155
5399
|
bookingUid: existingBookingUid || undefined,
|
|
5156
|
-
holder: (
|
|
5157
|
-
holderIds: (
|
|
5400
|
+
holder: (_ref54 = (_params$orderProduct$3 = (_params$orderProduct6 = params.orderProduct) === null || _params$orderProduct6 === void 0 || (_params$orderProduct6 = _params$orderProduct6._extend) === null || _params$orderProduct6 === void 0 ? void 0 : _params$orderProduct6.holder) !== null && _params$orderProduct$3 !== void 0 ? _params$orderProduct$3 : existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _ref54 !== void 0 ? _ref54 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
|
|
5401
|
+
holderIds: (_ref55 = (_ref56 = (_params$orderProduct$4 = (_params$orderProduct7 = params.orderProduct) === null || _params$orderProduct7 === void 0 || (_params$orderProduct7 = _params$orderProduct7._extend) === null || _params$orderProduct7 === void 0 ? void 0 : _params$orderProduct7.holder_id) !== null && _params$orderProduct$4 !== void 0 ? _params$orderProduct$4 : (_params$orderProduct8 = params.orderProduct) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8._extend) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8.holder) === null || _params$orderProduct8 === void 0 ? void 0 : _params$orderProduct8.form_record) !== null && _ref56 !== void 0 ? _ref56 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref55 !== void 0 ? _ref55 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
|
|
5158
5402
|
});
|
|
5159
5403
|
transformed = this.buildUnifiedOrderProduct(_objectSpread(_objectSpread({}, params.orderProduct), {}, {
|
|
5160
5404
|
num: bookingCount,
|
|
5161
5405
|
quantity: bookingCount
|
|
5162
5406
|
}), 'unified_booking_sales', product);
|
|
5163
5407
|
if (transformed) {
|
|
5164
|
-
|
|
5408
|
+
_context48.next = 98;
|
|
5165
5409
|
break;
|
|
5166
5410
|
}
|
|
5167
5411
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
@@ -5180,7 +5424,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5180
5424
|
productLineUids = [];
|
|
5181
5425
|
bookingUids = [];
|
|
5182
5426
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
5183
|
-
|
|
5427
|
+
_context48.next = 117;
|
|
5184
5428
|
break;
|
|
5185
5429
|
}
|
|
5186
5430
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -5190,10 +5434,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5190
5434
|
unique_identification_number: params.productLineUid,
|
|
5191
5435
|
booking_uid: existingBookingUid
|
|
5192
5436
|
});
|
|
5193
|
-
|
|
5437
|
+
_context48.next = 111;
|
|
5194
5438
|
return this.updateOrderProduct(_objectSpread(_objectSpread({
|
|
5195
5439
|
product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
|
|
5196
|
-
product_variant_id: (
|
|
5440
|
+
product_variant_id: (_ref57 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref57 !== void 0 ? _ref57 : 0,
|
|
5197
5441
|
unique_identification_number: params.productLineUid,
|
|
5198
5442
|
updates: transformed,
|
|
5199
5443
|
booking: booking
|
|
@@ -5207,7 +5451,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5207
5451
|
bookingUid = existingBookingUid;
|
|
5208
5452
|
productLineUids = [productLineUid];
|
|
5209
5453
|
bookingUids = [bookingUid];
|
|
5210
|
-
|
|
5454
|
+
_context48.next = 129;
|
|
5211
5455
|
break;
|
|
5212
5456
|
case 117:
|
|
5213
5457
|
beforeProductLineUids = new Set((((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || []).map(function (line) {
|
|
@@ -5216,12 +5460,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5216
5460
|
beforeBookingUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.bookings) || []).map(function (item) {
|
|
5217
5461
|
return getBookingUid(item);
|
|
5218
5462
|
}).filter(Boolean));
|
|
5219
|
-
|
|
5463
|
+
_context48.next = 121;
|
|
5220
5464
|
return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length ? {
|
|
5221
5465
|
salesNotes: params.salesNotes
|
|
5222
5466
|
} : undefined);
|
|
5223
5467
|
case 121:
|
|
5224
|
-
products =
|
|
5468
|
+
products = _context48.sent;
|
|
5225
5469
|
addedLines = products.filter(function (line) {
|
|
5226
5470
|
var _line$product_id, _line$metadata;
|
|
5227
5471
|
return sameAvailabilityId((_line$product_id = line.product_id) !== null && _line$product_id !== void 0 ? _line$product_id : line.id, refreshedCandidate.productId) && ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeProductLineUids.has(getProductLineUid(line));
|
|
@@ -5238,8 +5482,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5238
5482
|
}).filter(Boolean);
|
|
5239
5483
|
if (bookingUids.length === 0) {
|
|
5240
5484
|
bookingUids = addedLines.map(function (line) {
|
|
5241
|
-
var
|
|
5242
|
-
return String((
|
|
5485
|
+
var _ref58, _line$booking_uid, _line$metadata2;
|
|
5486
|
+
return String((_ref58 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.booking_uid) !== null && _ref58 !== void 0 ? _ref58 : '');
|
|
5243
5487
|
}).filter(Boolean);
|
|
5244
5488
|
}
|
|
5245
5489
|
productLineUid = productLineUids[productLineUids.length - 1] || '';
|
|
@@ -5258,23 +5502,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5258
5502
|
productLineUids: productLineUids,
|
|
5259
5503
|
bookingUids: bookingUids
|
|
5260
5504
|
};
|
|
5261
|
-
|
|
5505
|
+
_context48.next = 134;
|
|
5262
5506
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
5263
5507
|
case 134:
|
|
5264
|
-
return
|
|
5508
|
+
return _context48.abrupt("return", result);
|
|
5265
5509
|
case 135:
|
|
5266
|
-
|
|
5267
|
-
|
|
5510
|
+
_context48.prev = 135;
|
|
5511
|
+
_context48.next = 138;
|
|
5268
5512
|
return this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
5269
5513
|
case 138:
|
|
5270
|
-
return
|
|
5514
|
+
return _context48.finish(135);
|
|
5271
5515
|
case 139:
|
|
5272
5516
|
case "end":
|
|
5273
|
-
return
|
|
5517
|
+
return _context48.stop();
|
|
5274
5518
|
}
|
|
5275
|
-
},
|
|
5519
|
+
}, _callee48, this, [[5,, 135, 139]]);
|
|
5276
5520
|
}));
|
|
5277
|
-
function commitAvailabilitySelection(
|
|
5521
|
+
function commitAvailabilitySelection(_x36, _x37) {
|
|
5278
5522
|
return _commitAvailabilitySelection.apply(this, arguments);
|
|
5279
5523
|
}
|
|
5280
5524
|
return commitAvailabilitySelection;
|