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