@pisell/pisellos 2.3.93 → 2.3.95
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/itemRule/adapter.d.ts +4 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +135 -35
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +25 -1
- package/dist/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/dist/model/strategy/adapter/itemRule/type.js +19 -1
- package/dist/modules/Order/index.d.ts +18 -3
- package/dist/modules/Order/index.js +885 -485
- package/dist/modules/Order/salesNotes.d.ts +31 -0
- package/dist/modules/Order/salesNotes.js +492 -0
- package/dist/modules/Order/types.d.ts +91 -5
- package/dist/modules/Order/types.js +5 -0
- package/dist/modules/Order/utils.d.ts +12 -0
- package/dist/modules/Order/utils.js +75 -26
- package/dist/modules/ProductList/index.d.ts +2 -1
- package/dist/modules/ProductList/index.js +100 -20
- package/dist/modules/ProductList/types.d.ts +10 -0
- package/dist/modules/ResourcePlanner/planner.js +5 -3
- package/dist/modules/ResourcePlanner/types.d.ts +5 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +43 -3
- package/dist/solution/BaseSales/index.d.ts +9 -1
- package/dist/solution/BaseSales/index.js +894 -706
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/utils/orderCustomer.js +3 -2
- package/dist/solution/RegisterAndLogin/config.d.ts +9 -3
- package/dist/solution/RegisterAndLogin/config.js +95 -40
- package/dist/solution/RegisterAndLogin/index.js +4 -1
- package/dist/solution/ScanOrder/index.d.ts +1 -0
- package/dist/solution/ScanOrder/index.js +31 -27
- package/dist/solution/ScanOrder/utils.d.ts +1 -0
- package/dist/solution/ScanOrder/utils.js +2 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +15 -2
- package/dist/solution/UnifiedBookingSales/index.js +767 -488
- package/dist/solution/UnifiedBookingSales/types.d.ts +14 -1
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/dist/solution/VenueBooking/index.js +8 -4
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +73 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +23 -1
- package/lib/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/lib/model/strategy/adapter/itemRule/type.js +19 -1
- package/lib/modules/Order/index.d.ts +18 -3
- package/lib/modules/Order/index.js +325 -28
- package/lib/modules/Order/salesNotes.d.ts +31 -0
- package/lib/modules/Order/salesNotes.js +382 -0
- package/lib/modules/Order/types.d.ts +91 -5
- package/lib/modules/Order/types.js +4 -0
- package/lib/modules/Order/utils.d.ts +12 -0
- package/lib/modules/Order/utils.js +68 -16
- package/lib/modules/ProductList/index.d.ts +2 -1
- package/lib/modules/ProductList/index.js +47 -2
- package/lib/modules/ProductList/types.d.ts +10 -0
- package/lib/modules/ResourcePlanner/planner.js +5 -3
- package/lib/modules/ResourcePlanner/types.d.ts +5 -0
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +37 -3
- package/lib/solution/BaseSales/index.d.ts +9 -1
- package/lib/solution/BaseSales/index.js +105 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/utils/orderCustomer.js +2 -1
- package/lib/solution/RegisterAndLogin/config.d.ts +9 -3
- package/lib/solution/RegisterAndLogin/config.js +49 -8
- package/lib/solution/RegisterAndLogin/index.js +4 -1
- package/lib/solution/ScanOrder/index.d.ts +1 -0
- package/lib/solution/ScanOrder/index.js +5 -1
- package/lib/solution/ScanOrder/utils.d.ts +1 -0
- package/lib/solution/ScanOrder/utils.js +1 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +15 -2
- package/lib/solution/UnifiedBookingSales/index.js +140 -6
- package/lib/solution/UnifiedBookingSales/types.d.ts +14 -1
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/lib/solution/VenueBooking/index.js +5 -1
- package/package.json +1 -1
|
@@ -43,6 +43,7 @@ import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
|
|
|
43
43
|
import { BookingTicket } from "../BookingTicket";
|
|
44
44
|
import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
|
|
45
45
|
import { isCustomerUserPlatform } from "../../utils/platform";
|
|
46
|
+
import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
46
47
|
export * from "./types";
|
|
47
48
|
export { AvailabilityError } from "../../modules/ResourcePlanner";
|
|
48
49
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'basic', 'checkout', 'availability'];
|
|
@@ -76,6 +77,29 @@ function getCandidateStartTime(candidate) {
|
|
|
76
77
|
return undefined;
|
|
77
78
|
}
|
|
78
79
|
}
|
|
80
|
+
function normalizePositiveIntegerList(value) {
|
|
81
|
+
if (!Array.isArray(value)) return [];
|
|
82
|
+
return Array.from(new Set(value.map(function (item) {
|
|
83
|
+
return normalizePositiveInteger(item);
|
|
84
|
+
}).filter(function (item) {
|
|
85
|
+
return item !== undefined;
|
|
86
|
+
})));
|
|
87
|
+
}
|
|
88
|
+
function toConfiguredBoolean(value) {
|
|
89
|
+
if (typeof value === 'boolean') return value;
|
|
90
|
+
if (typeof value === 'number') return value !== 0;
|
|
91
|
+
if (typeof value === 'string') {
|
|
92
|
+
return ['1', 'true', 'yes', 'y', 'on'].includes(value.trim().toLowerCase());
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
function normalizeItemRuleStrategyConfigs(value) {
|
|
97
|
+
if (!Array.isArray(value)) return [];
|
|
98
|
+
return value.filter(function (config) {
|
|
99
|
+
var _metadata;
|
|
100
|
+
return Boolean(config && _typeof(config) === 'object' && ((_metadata = config.metadata) === null || _metadata === void 0 ? void 0 : _metadata.type) === 'item_rule');
|
|
101
|
+
});
|
|
102
|
+
}
|
|
79
103
|
function isRecord(value) {
|
|
80
104
|
return !!value && _typeof(value) === 'object' && !Array.isArray(value);
|
|
81
105
|
}
|
|
@@ -202,8 +226,9 @@ function filterCustomerBoundDiscounts(discountList) {
|
|
|
202
226
|
}
|
|
203
227
|
var DEFAULT_AVAILABILITY_SLOT_STEP_MINUTES = 30;
|
|
204
228
|
var DEFAULT_AVAILABILITY_BUSINESS_HOURS = {
|
|
205
|
-
|
|
206
|
-
|
|
229
|
+
// Same start/end is interpreted as an overnight range, i.e. 24 hours.
|
|
230
|
+
startTime: '00:00',
|
|
231
|
+
endTime: '00:00'
|
|
207
232
|
};
|
|
208
233
|
var MAX_AVAILABILITY_RANGE_DAYS = 90;
|
|
209
234
|
var MAX_AVAILABILITY_CONTEXT_REGISTRY = 128;
|
|
@@ -1264,6 +1289,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1264
1289
|
_defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceQuerySequence", 0);
|
|
1265
1290
|
_defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceEpoch", 0);
|
|
1266
1291
|
_defineProperty(_assertThisInitialized(_this), "availabilityCommitLocks", new Set());
|
|
1292
|
+
_defineProperty(_assertThisInitialized(_this), "allergyItemRuleEvaluator", new ItemRuleEvaluator());
|
|
1293
|
+
_defineProperty(_assertThisInitialized(_this), "allergyItemRuleConfigs", []);
|
|
1294
|
+
_defineProperty(_assertThisInitialized(_this), "allergyItemRuleConfigsPromise", null);
|
|
1267
1295
|
return _this;
|
|
1268
1296
|
}
|
|
1269
1297
|
_createClass(UnifiedBookingSalesImpl, [{
|
|
@@ -1283,16 +1311,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1283
1311
|
this.openDataTarget = null;
|
|
1284
1312
|
this.availabilityRuntimeOffsetMinutes = captureRuntimeOffsetMinutes();
|
|
1285
1313
|
this.clearAvailabilityRemoteResourceState();
|
|
1286
|
-
|
|
1314
|
+
this.resetAllergyItemRuleState();
|
|
1315
|
+
_context.next = 8;
|
|
1287
1316
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "initialize", this).call(this, core, options);
|
|
1288
|
-
case
|
|
1317
|
+
case 8:
|
|
1289
1318
|
openDataBusinessCode = String((_ref23 = (_this$otherParams$bus = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.business_code) !== null && _ref23 !== void 0 ? _ref23 : '').trim();
|
|
1290
1319
|
openDataChannel = String((_this$otherParams$cha = (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
|
|
1291
1320
|
if ((_this$otherParams4 = this.otherParams) !== null && _this$otherParams4 !== void 0 && _this$otherParams4.openData && openDataBusinessCode && openDataChannel) {
|
|
1292
1321
|
this.openDataTarget = "".concat(openDataBusinessCode, "+").concat(openDataChannel);
|
|
1293
1322
|
}
|
|
1294
1323
|
this.captureAvailabilityScheduleCatalog();
|
|
1295
|
-
case
|
|
1324
|
+
case 12:
|
|
1296
1325
|
case "end":
|
|
1297
1326
|
return _context.stop();
|
|
1298
1327
|
}
|
|
@@ -1502,13 +1531,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1502
1531
|
key: "setOtherParams",
|
|
1503
1532
|
value: function () {
|
|
1504
1533
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
1534
|
+
var _this$otherParams11, _this$otherParams13;
|
|
1505
1535
|
var _ref32,
|
|
1506
1536
|
_ref32$cover,
|
|
1507
1537
|
cover,
|
|
1508
1538
|
previousScope,
|
|
1539
|
+
previousItemRuleConfig,
|
|
1509
1540
|
explicitlySetsOpenData,
|
|
1510
1541
|
nextScope,
|
|
1511
|
-
_this$
|
|
1542
|
+
_this$otherParams12,
|
|
1512
1543
|
shouldResetAvailabilityState,
|
|
1513
1544
|
_args3 = arguments;
|
|
1514
1545
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -1516,24 +1547,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1516
1547
|
case 0:
|
|
1517
1548
|
_ref32 = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {}, _ref32$cover = _ref32.cover, cover = _ref32$cover === void 0 ? false : _ref32$cover;
|
|
1518
1549
|
previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1550
|
+
previousItemRuleConfig = (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.itemRule;
|
|
1519
1551
|
explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
1520
|
-
_context3.next =
|
|
1552
|
+
_context3.next = 6;
|
|
1521
1553
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
1522
1554
|
cover: cover
|
|
1523
1555
|
});
|
|
1524
|
-
case
|
|
1556
|
+
case 6:
|
|
1525
1557
|
nextScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1526
1558
|
if (explicitlySetsOpenData) {
|
|
1527
|
-
this.openDataTarget = (_this$
|
|
1559
|
+
this.openDataTarget = (_this$otherParams12 = this.otherParams) !== null && _this$otherParams12 !== void 0 && _this$otherParams12.openData && nextScope.businessCode && nextScope.channel ? "".concat(nextScope.businessCode, "+").concat(nextScope.channel) : null;
|
|
1528
1560
|
}
|
|
1529
1561
|
shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone;
|
|
1530
1562
|
if (!shouldResetAvailabilityState) {
|
|
1531
|
-
_context3.next =
|
|
1563
|
+
_context3.next = 12;
|
|
1532
1564
|
break;
|
|
1533
1565
|
}
|
|
1534
|
-
_context3.next =
|
|
1566
|
+
_context3.next = 12;
|
|
1535
1567
|
return this.resetAvailabilityProjectionState('set_other_params_reset');
|
|
1536
|
-
case
|
|
1568
|
+
case 12:
|
|
1569
|
+
if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.itemRule)) {
|
|
1570
|
+
this.resetAllergyItemRuleState();
|
|
1571
|
+
}
|
|
1572
|
+
case 13:
|
|
1537
1573
|
case "end":
|
|
1538
1574
|
return _context3.stop();
|
|
1539
1575
|
}
|
|
@@ -1556,9 +1592,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1556
1592
|
_context4.next = 4;
|
|
1557
1593
|
return this.resetAvailabilityProjectionState('destroy');
|
|
1558
1594
|
case 4:
|
|
1559
|
-
|
|
1595
|
+
this.resetAllergyItemRuleState();
|
|
1596
|
+
_context4.next = 7;
|
|
1560
1597
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "destroy", this).call(this);
|
|
1561
|
-
case
|
|
1598
|
+
case 7:
|
|
1562
1599
|
case "end":
|
|
1563
1600
|
return _context4.stop();
|
|
1564
1601
|
}
|
|
@@ -1763,8 +1800,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1763
1800
|
}, {
|
|
1764
1801
|
key: "isSessionStoragePersistEnabled",
|
|
1765
1802
|
value: function isSessionStoragePersistEnabled() {
|
|
1766
|
-
var _this$
|
|
1767
|
-
return Boolean(this.cacheId && ((_this$
|
|
1803
|
+
var _this$otherParams14;
|
|
1804
|
+
return Boolean(this.cacheId && ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.enableSessionStoragePersist) === true);
|
|
1768
1805
|
}
|
|
1769
1806
|
}, {
|
|
1770
1807
|
key: "shouldUseSessionStorageForSubModule",
|
|
@@ -1833,8 +1870,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1833
1870
|
}, {
|
|
1834
1871
|
key: "shouldUseCheckoutSyncTask",
|
|
1835
1872
|
value: function shouldUseCheckoutSyncTask() {
|
|
1836
|
-
var _this$
|
|
1837
|
-
var configured = (_this$
|
|
1873
|
+
var _this$otherParams15;
|
|
1874
|
+
var configured = (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.checkoutSyncTaskEnabled;
|
|
1838
1875
|
return typeof configured === 'boolean' ? configured : false;
|
|
1839
1876
|
}
|
|
1840
1877
|
|
|
@@ -1989,8 +2026,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1989
2026
|
}, {
|
|
1990
2027
|
key: "isAuthenticatedCustomerUserPlatform",
|
|
1991
2028
|
value: function isAuthenticatedCustomerUserPlatform() {
|
|
1992
|
-
var _this$
|
|
1993
|
-
return isCustomerUserPlatform((_this$
|
|
2029
|
+
var _this$otherParams16;
|
|
2030
|
+
return isCustomerUserPlatform((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform);
|
|
1994
2031
|
}
|
|
1995
2032
|
}, {
|
|
1996
2033
|
key: "resolveDiscountOrderIdentity",
|
|
@@ -2168,13 +2205,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2168
2205
|
key: "getOpenData",
|
|
2169
2206
|
value: function () {
|
|
2170
2207
|
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
2171
|
-
var _this$
|
|
2208
|
+
var _this$otherParams17, _this$otherParams18, _this$store$openData;
|
|
2172
2209
|
var businessCode, channel, target, cachedData;
|
|
2173
2210
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
2174
2211
|
while (1) switch (_context12.prev = _context12.next) {
|
|
2175
2212
|
case 0:
|
|
2176
|
-
businessCode = String(((_this$
|
|
2177
|
-
channel = String(((_this$
|
|
2213
|
+
businessCode = String(((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.businessCode) || '').trim();
|
|
2214
|
+
channel = String(((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.channel) || '').trim();
|
|
2178
2215
|
if (!(!businessCode || !channel)) {
|
|
2179
2216
|
_context12.next = 4;
|
|
2180
2217
|
break;
|
|
@@ -2204,20 +2241,222 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2204
2241
|
}
|
|
2205
2242
|
return getOpenData;
|
|
2206
2243
|
}()
|
|
2244
|
+
}, {
|
|
2245
|
+
key: "resetAllergyItemRuleState",
|
|
2246
|
+
value: function resetAllergyItemRuleState() {
|
|
2247
|
+
this.allergyItemRuleConfigs = [];
|
|
2248
|
+
this.allergyItemRuleConfigsPromise = null;
|
|
2249
|
+
this.allergyItemRuleEvaluator.setStrategyConfigs([]);
|
|
2250
|
+
}
|
|
2251
|
+
}, {
|
|
2252
|
+
key: "fetchAllergyItemRuleConfigs",
|
|
2253
|
+
value: function () {
|
|
2254
|
+
var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(strategyModelIds) {
|
|
2255
|
+
var _response$data, response, list;
|
|
2256
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
2257
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
2258
|
+
case 0:
|
|
2259
|
+
if (strategyModelIds.length) {
|
|
2260
|
+
_context13.next = 2;
|
|
2261
|
+
break;
|
|
2262
|
+
}
|
|
2263
|
+
return _context13.abrupt("return", []);
|
|
2264
|
+
case 2:
|
|
2265
|
+
_context13.prev = 2;
|
|
2266
|
+
_context13.next = 5;
|
|
2267
|
+
return this.request.get('/promotion', {
|
|
2268
|
+
skip: 1,
|
|
2269
|
+
num: 99,
|
|
2270
|
+
status: 'active',
|
|
2271
|
+
ids: strategyModelIds
|
|
2272
|
+
});
|
|
2273
|
+
case 5:
|
|
2274
|
+
response = _context13.sent;
|
|
2275
|
+
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))) {
|
|
2276
|
+
_context13.next = 8;
|
|
2277
|
+
break;
|
|
2278
|
+
}
|
|
2279
|
+
throw new Error('[UnifiedBookingSales] 商品过敏策略加载失败');
|
|
2280
|
+
case 8:
|
|
2281
|
+
list = response.data.list;
|
|
2282
|
+
return _context13.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
|
|
2283
|
+
return item === null || item === void 0 ? void 0 : item.metadata;
|
|
2284
|
+
})));
|
|
2285
|
+
case 12:
|
|
2286
|
+
_context13.prev = 12;
|
|
2287
|
+
_context13.t0 = _context13["catch"](2);
|
|
2288
|
+
throw _context13.t0;
|
|
2289
|
+
case 15:
|
|
2290
|
+
case "end":
|
|
2291
|
+
return _context13.stop();
|
|
2292
|
+
}
|
|
2293
|
+
}, _callee13, this, [[2, 12]]);
|
|
2294
|
+
}));
|
|
2295
|
+
function fetchAllergyItemRuleConfigs(_x8) {
|
|
2296
|
+
return _fetchAllergyItemRuleConfigs.apply(this, arguments);
|
|
2297
|
+
}
|
|
2298
|
+
return fetchAllergyItemRuleConfigs;
|
|
2299
|
+
}()
|
|
2300
|
+
}, {
|
|
2301
|
+
key: "ensureAllergyItemRuleConfigsLoaded",
|
|
2302
|
+
value: function () {
|
|
2303
|
+
var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
2304
|
+
var _this3 = this;
|
|
2305
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
2306
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
2307
|
+
case 0:
|
|
2308
|
+
if (!(this.allergyItemRuleConfigs.length > 0)) {
|
|
2309
|
+
_context15.next = 2;
|
|
2310
|
+
break;
|
|
2311
|
+
}
|
|
2312
|
+
return _context15.abrupt("return", this.allergyItemRuleConfigs);
|
|
2313
|
+
case 2:
|
|
2314
|
+
if (!this.allergyItemRuleConfigsPromise) {
|
|
2315
|
+
_context15.next = 4;
|
|
2316
|
+
break;
|
|
2317
|
+
}
|
|
2318
|
+
return _context15.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
2319
|
+
case 4:
|
|
2320
|
+
this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
2321
|
+
var _this3$otherParams;
|
|
2322
|
+
var staticConfigs, openData, enabled, strategyModelIds, loaded;
|
|
2323
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
2324
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
2325
|
+
case 0:
|
|
2326
|
+
staticConfigs = normalizeItemRuleStrategyConfigs((_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 || (_this3$otherParams = _this3$otherParams.itemRule) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.strategyConfigs);
|
|
2327
|
+
if (!(staticConfigs.length > 0)) {
|
|
2328
|
+
_context14.next = 5;
|
|
2329
|
+
break;
|
|
2330
|
+
}
|
|
2331
|
+
_this3.allergyItemRuleConfigs = staticConfigs;
|
|
2332
|
+
_this3.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2333
|
+
return _context14.abrupt("return", staticConfigs);
|
|
2334
|
+
case 5:
|
|
2335
|
+
_context14.next = 7;
|
|
2336
|
+
return _this3.getOpenData();
|
|
2337
|
+
case 7:
|
|
2338
|
+
openData = _context14.sent;
|
|
2339
|
+
enabled = toConfiguredBoolean(openData === null || openData === void 0 ? void 0 : openData['sale.enable_item_rules']);
|
|
2340
|
+
strategyModelIds = normalizePositiveIntegerList(openData === null || openData === void 0 ? void 0 : openData['sale.enabled_item_rules']);
|
|
2341
|
+
if (!(!enabled || !strategyModelIds.length)) {
|
|
2342
|
+
_context14.next = 13;
|
|
2343
|
+
break;
|
|
2344
|
+
}
|
|
2345
|
+
_this3.allergyItemRuleEvaluator.setStrategyConfigs([]);
|
|
2346
|
+
return _context14.abrupt("return", []);
|
|
2347
|
+
case 13:
|
|
2348
|
+
_context14.next = 15;
|
|
2349
|
+
return _this3.fetchAllergyItemRuleConfigs(strategyModelIds);
|
|
2350
|
+
case 15:
|
|
2351
|
+
loaded = _context14.sent;
|
|
2352
|
+
_this3.allergyItemRuleConfigs = loaded;
|
|
2353
|
+
_this3.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
|
|
2354
|
+
return _context14.abrupt("return", loaded);
|
|
2355
|
+
case 19:
|
|
2356
|
+
case "end":
|
|
2357
|
+
return _context14.stop();
|
|
2358
|
+
}
|
|
2359
|
+
}, _callee14);
|
|
2360
|
+
}))();
|
|
2361
|
+
return _context15.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
2362
|
+
case 6:
|
|
2363
|
+
case "end":
|
|
2364
|
+
return _context15.stop();
|
|
2365
|
+
}
|
|
2366
|
+
}, _callee15, this);
|
|
2367
|
+
}));
|
|
2368
|
+
function ensureAllergyItemRuleConfigsLoaded() {
|
|
2369
|
+
return _ensureAllergyItemRuleConfigsLoaded.apply(this, arguments);
|
|
2370
|
+
}
|
|
2371
|
+
return ensureAllergyItemRuleConfigsLoaded;
|
|
2372
|
+
}()
|
|
2373
|
+
/**
|
|
2374
|
+
* 评估当前渠道与商品是否命中 ALLERGY_CHECK。
|
|
2375
|
+
* 只返回优先级最高 Action 中当前商品 Target 的 dataSource,不跨商品或 Action 合并。
|
|
2376
|
+
*/
|
|
2377
|
+
}, {
|
|
2378
|
+
key: "resolveProductAllergyRequirement",
|
|
2379
|
+
value: (function () {
|
|
2380
|
+
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
2381
|
+
var _this$otherParams19, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref35, _runtimeConfig$servic, _this$otherParams20, _ref36, _ref37, _params$channel, _this$otherParams21, _this$otherParams22, _runtimeConfig$submis;
|
|
2382
|
+
var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
|
|
2383
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
2384
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
2385
|
+
case 0:
|
|
2386
|
+
productId = normalizePositiveInteger(params.productId);
|
|
2387
|
+
if (productId) {
|
|
2388
|
+
_context16.next = 3;
|
|
2389
|
+
break;
|
|
2390
|
+
}
|
|
2391
|
+
return _context16.abrupt("return", null);
|
|
2392
|
+
case 3:
|
|
2393
|
+
_context16.next = 5;
|
|
2394
|
+
return this.ensureAllergyItemRuleConfigsLoaded();
|
|
2395
|
+
case 5:
|
|
2396
|
+
strategyConfigs = _context16.sent;
|
|
2397
|
+
if (strategyConfigs.length) {
|
|
2398
|
+
_context16.next = 8;
|
|
2399
|
+
break;
|
|
2400
|
+
}
|
|
2401
|
+
return _context16.abrupt("return", null);
|
|
2402
|
+
case 8:
|
|
2403
|
+
productVariantId = normalizePositiveInteger(params.productVariantId);
|
|
2404
|
+
runtimeConfig = ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.itemRule) || {};
|
|
2405
|
+
runtimePax = runtimeConfig.pax || {};
|
|
2406
|
+
cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
|
|
2407
|
+
var _item$product_id, _item$product_variant, _ref34, _item$num;
|
|
2408
|
+
return {
|
|
2409
|
+
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),
|
|
2410
|
+
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,
|
|
2411
|
+
quantity: Number((_ref34 = (_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 && _ref34 !== void 0 ? _ref34 : 0)
|
|
2412
|
+
};
|
|
2413
|
+
}).filter(function (item) {
|
|
2414
|
+
return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
|
|
2415
|
+
});
|
|
2416
|
+
return _context16.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
|
|
2417
|
+
pax: {
|
|
2418
|
+
total: Number((_runtimePax$total = runtimePax.total) !== null && _runtimePax$total !== void 0 ? _runtimePax$total : 0) || 0,
|
|
2419
|
+
adult: Number((_runtimePax$adult = runtimePax.adult) !== null && _runtimePax$adult !== void 0 ? _runtimePax$adult : 0) || 0,
|
|
2420
|
+
child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
|
|
2421
|
+
},
|
|
2422
|
+
cartItems: cartItems,
|
|
2423
|
+
serviceType: String((_ref35 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.serviceType) !== null && _ref35 !== void 0 ? _ref35 : ''),
|
|
2424
|
+
channel: String((_ref36 = (_ref37 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.channel) !== null && _ref37 !== void 0 ? _ref37 : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.platform) !== null && _ref36 !== void 0 ? _ref36 : ''),
|
|
2425
|
+
currentProduct: _objectSpread({
|
|
2426
|
+
product_id: productId
|
|
2427
|
+
}, productVariantId ? {
|
|
2428
|
+
product_variant_id: productVariantId
|
|
2429
|
+
} : {}),
|
|
2430
|
+
submissionIndex: Number((_runtimeConfig$submis = runtimeConfig.submissionIndex) !== null && _runtimeConfig$submis !== void 0 ? _runtimeConfig$submis : 0) || 0,
|
|
2431
|
+
strategyConfigs: strategyConfigs,
|
|
2432
|
+
custom: runtimeConfig.custom
|
|
2433
|
+
}));
|
|
2434
|
+
case 13:
|
|
2435
|
+
case "end":
|
|
2436
|
+
return _context16.stop();
|
|
2437
|
+
}
|
|
2438
|
+
}, _callee16, this);
|
|
2439
|
+
}));
|
|
2440
|
+
function resolveProductAllergyRequirement(_x9) {
|
|
2441
|
+
return _resolveProductAllergyRequirement.apply(this, arguments);
|
|
2442
|
+
}
|
|
2443
|
+
return resolveProductAllergyRequirement;
|
|
2444
|
+
}()
|
|
2207
2445
|
/**
|
|
2208
2446
|
* Load a resource policy without depending on the legacy appointmentBooking solution.
|
|
2209
2447
|
*/
|
|
2448
|
+
)
|
|
2210
2449
|
}, {
|
|
2211
2450
|
key: "getProtocol",
|
|
2212
2451
|
value: (function () {
|
|
2213
|
-
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2452
|
+
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(policyId) {
|
|
2214
2453
|
var normalizedPolicyId, policyUrl;
|
|
2215
|
-
return _regeneratorRuntime().wrap(function
|
|
2216
|
-
while (1) switch (
|
|
2454
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
2455
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
2217
2456
|
case 0:
|
|
2218
2457
|
normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
|
|
2219
2458
|
if (normalizedPolicyId) {
|
|
2220
|
-
|
|
2459
|
+
_context17.next = 3;
|
|
2221
2460
|
break;
|
|
2222
2461
|
}
|
|
2223
2462
|
throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
|
|
@@ -2226,14 +2465,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2226
2465
|
if (this.otherParams.platform === 'kiosk' || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
|
|
2227
2466
|
policyUrl = 'policy';
|
|
2228
2467
|
}
|
|
2229
|
-
return
|
|
2468
|
+
return _context17.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
|
|
2230
2469
|
case 6:
|
|
2231
2470
|
case "end":
|
|
2232
|
-
return
|
|
2471
|
+
return _context17.stop();
|
|
2233
2472
|
}
|
|
2234
|
-
},
|
|
2473
|
+
}, _callee17, this);
|
|
2235
2474
|
}));
|
|
2236
|
-
function getProtocol(
|
|
2475
|
+
function getProtocol(_x10) {
|
|
2237
2476
|
return _getProtocol.apply(this, arguments);
|
|
2238
2477
|
}
|
|
2239
2478
|
return getProtocol;
|
|
@@ -2246,27 +2485,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2246
2485
|
}, {
|
|
2247
2486
|
key: "loadProducts",
|
|
2248
2487
|
value: (function () {
|
|
2249
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2488
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
2250
2489
|
var params,
|
|
2251
2490
|
options,
|
|
2252
2491
|
schedule_date,
|
|
2253
2492
|
schedule_datetime,
|
|
2254
2493
|
result,
|
|
2255
|
-
|
|
2256
|
-
return _regeneratorRuntime().wrap(function
|
|
2257
|
-
while (1) switch (
|
|
2494
|
+
_args18 = arguments;
|
|
2495
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
2496
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2258
2497
|
case 0:
|
|
2259
|
-
params =
|
|
2260
|
-
options =
|
|
2498
|
+
params = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
|
|
2499
|
+
options = _args18.length > 1 ? _args18[1] : undefined;
|
|
2261
2500
|
if (this.store.products) {
|
|
2262
|
-
|
|
2501
|
+
_context18.next = 4;
|
|
2263
2502
|
break;
|
|
2264
2503
|
}
|
|
2265
2504
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
2266
2505
|
case 4:
|
|
2267
2506
|
schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
2268
2507
|
schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
2269
|
-
|
|
2508
|
+
_context18.next = 8;
|
|
2270
2509
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
2271
2510
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
2272
2511
|
with_schedule: 1
|
|
@@ -2276,44 +2515,72 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2276
2515
|
cacheId: this.cacheId
|
|
2277
2516
|
}), options);
|
|
2278
2517
|
case 8:
|
|
2279
|
-
result =
|
|
2518
|
+
result = _context18.sent;
|
|
2280
2519
|
this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
2281
|
-
|
|
2520
|
+
_context18.next = 12;
|
|
2282
2521
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
|
|
2283
2522
|
case 12:
|
|
2284
|
-
return
|
|
2523
|
+
return _context18.abrupt("return", result);
|
|
2285
2524
|
case 13:
|
|
2286
2525
|
case "end":
|
|
2287
|
-
return
|
|
2526
|
+
return _context18.stop();
|
|
2288
2527
|
}
|
|
2289
|
-
},
|
|
2528
|
+
}, _callee18, this);
|
|
2290
2529
|
}));
|
|
2291
2530
|
function loadProducts() {
|
|
2292
2531
|
return _loadProducts.apply(this, arguments);
|
|
2293
2532
|
}
|
|
2294
2533
|
return loadProducts;
|
|
2295
|
-
}()
|
|
2534
|
+
}())
|
|
2535
|
+
}, {
|
|
2536
|
+
key: "queryProducts",
|
|
2537
|
+
value: function () {
|
|
2538
|
+
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
2539
|
+
var params,
|
|
2540
|
+
_args19 = arguments;
|
|
2541
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
2542
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2543
|
+
case 0:
|
|
2544
|
+
params = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
|
|
2545
|
+
if (this.store.products) {
|
|
2546
|
+
_context19.next = 3;
|
|
2547
|
+
break;
|
|
2548
|
+
}
|
|
2549
|
+
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
2550
|
+
case 3:
|
|
2551
|
+
return _context19.abrupt("return", this.store.products.queryProducts(params));
|
|
2552
|
+
case 4:
|
|
2553
|
+
case "end":
|
|
2554
|
+
return _context19.stop();
|
|
2555
|
+
}
|
|
2556
|
+
}, _callee19, this);
|
|
2557
|
+
}));
|
|
2558
|
+
function queryProducts() {
|
|
2559
|
+
return _queryProducts.apply(this, arguments);
|
|
2560
|
+
}
|
|
2561
|
+
return queryProducts;
|
|
2562
|
+
}() /** Date-first entry point. It delegates protocol details and cache ownership to ScheduleModule. */
|
|
2296
2563
|
}, {
|
|
2297
2564
|
key: "loadScheduleAvailableDate",
|
|
2298
2565
|
value: (function () {
|
|
2299
|
-
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2300
|
-
return _regeneratorRuntime().wrap(function
|
|
2301
|
-
while (1) switch (
|
|
2566
|
+
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
2567
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2568
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2302
2569
|
case 0:
|
|
2303
2570
|
if (this.store.schedule) {
|
|
2304
|
-
|
|
2571
|
+
_context20.next = 2;
|
|
2305
2572
|
break;
|
|
2306
2573
|
}
|
|
2307
2574
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
2308
2575
|
case 2:
|
|
2309
|
-
return
|
|
2576
|
+
return _context20.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
|
|
2310
2577
|
case 3:
|
|
2311
2578
|
case "end":
|
|
2312
|
-
return
|
|
2579
|
+
return _context20.stop();
|
|
2313
2580
|
}
|
|
2314
|
-
},
|
|
2581
|
+
}, _callee20, this);
|
|
2315
2582
|
}));
|
|
2316
|
-
function loadScheduleAvailableDate(
|
|
2583
|
+
function loadScheduleAvailableDate(_x11) {
|
|
2317
2584
|
return _loadScheduleAvailableDate.apply(this, arguments);
|
|
2318
2585
|
}
|
|
2319
2586
|
return loadScheduleAvailableDate;
|
|
@@ -2327,15 +2594,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2327
2594
|
}, {
|
|
2328
2595
|
key: "loadProductsByScheduleDate",
|
|
2329
2596
|
value: (function () {
|
|
2330
|
-
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2597
|
+
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
2331
2598
|
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;
|
|
2332
2599
|
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
|
|
2333
|
-
return _regeneratorRuntime().wrap(function
|
|
2334
|
-
while (1) switch (
|
|
2600
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2601
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2335
2602
|
case 0:
|
|
2336
2603
|
date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
|
|
2337
2604
|
if (this.store.schedule) {
|
|
2338
|
-
|
|
2605
|
+
_context21.next = 3;
|
|
2339
2606
|
break;
|
|
2340
2607
|
}
|
|
2341
2608
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
@@ -2346,10 +2613,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2346
2613
|
});
|
|
2347
2614
|
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;
|
|
2348
2615
|
if (!(!hasCachedDate && !hasOtherProducts)) {
|
|
2349
|
-
|
|
2616
|
+
_context21.next = 9;
|
|
2350
2617
|
break;
|
|
2351
2618
|
}
|
|
2352
|
-
|
|
2619
|
+
_context21.next = 9;
|
|
2353
2620
|
return this.loadScheduleAvailableDate({
|
|
2354
2621
|
startDate: date,
|
|
2355
2622
|
endDate: date,
|
|
@@ -2369,45 +2636,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2369
2636
|
return !productIdFilter || productIdFilter.has(String(id));
|
|
2370
2637
|
});
|
|
2371
2638
|
if (availableProductIds.length) {
|
|
2372
|
-
|
|
2639
|
+
_context21.next = 17;
|
|
2373
2640
|
break;
|
|
2374
2641
|
}
|
|
2375
2642
|
this.unifiedProductCatalog = [];
|
|
2376
|
-
|
|
2643
|
+
_context21.next = 16;
|
|
2377
2644
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
|
|
2378
2645
|
case 16:
|
|
2379
|
-
return
|
|
2646
|
+
return _context21.abrupt("return", []);
|
|
2380
2647
|
case 17:
|
|
2381
|
-
|
|
2648
|
+
_context21.next = 19;
|
|
2382
2649
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
2383
2650
|
product_ids: availableProductIds,
|
|
2384
2651
|
schedule_date: date
|
|
2385
2652
|
}));
|
|
2386
2653
|
case 19:
|
|
2387
|
-
products =
|
|
2654
|
+
products = _context21.sent;
|
|
2388
2655
|
if (!(products.length || availableProductIds.length <= 1)) {
|
|
2389
|
-
|
|
2656
|
+
_context21.next = 22;
|
|
2390
2657
|
break;
|
|
2391
2658
|
}
|
|
2392
|
-
return
|
|
2659
|
+
return _context21.abrupt("return", products);
|
|
2393
2660
|
case 22:
|
|
2394
2661
|
fallbackProducts = [];
|
|
2395
2662
|
_iterator = _createForOfIteratorHelper(availableProductIds);
|
|
2396
|
-
|
|
2663
|
+
_context21.prev = 24;
|
|
2397
2664
|
_iterator.s();
|
|
2398
2665
|
case 26:
|
|
2399
2666
|
if ((_step = _iterator.n()).done) {
|
|
2400
|
-
|
|
2667
|
+
_context21.next = 34;
|
|
2401
2668
|
break;
|
|
2402
2669
|
}
|
|
2403
2670
|
productId = _step.value;
|
|
2404
|
-
|
|
2671
|
+
_context21.next = 30;
|
|
2405
2672
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
2406
2673
|
product_ids: [productId],
|
|
2407
2674
|
schedule_date: date
|
|
2408
2675
|
}));
|
|
2409
2676
|
case 30:
|
|
2410
|
-
result =
|
|
2677
|
+
result = _context21.sent;
|
|
2411
2678
|
result.forEach(function (product) {
|
|
2412
2679
|
var _id;
|
|
2413
2680
|
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;
|
|
@@ -2419,32 +2686,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2419
2686
|
}
|
|
2420
2687
|
});
|
|
2421
2688
|
case 32:
|
|
2422
|
-
|
|
2689
|
+
_context21.next = 26;
|
|
2423
2690
|
break;
|
|
2424
2691
|
case 34:
|
|
2425
|
-
|
|
2692
|
+
_context21.next = 39;
|
|
2426
2693
|
break;
|
|
2427
2694
|
case 36:
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
_iterator.e(
|
|
2695
|
+
_context21.prev = 36;
|
|
2696
|
+
_context21.t0 = _context21["catch"](24);
|
|
2697
|
+
_iterator.e(_context21.t0);
|
|
2431
2698
|
case 39:
|
|
2432
|
-
|
|
2699
|
+
_context21.prev = 39;
|
|
2433
2700
|
_iterator.f();
|
|
2434
|
-
return
|
|
2701
|
+
return _context21.finish(39);
|
|
2435
2702
|
case 42:
|
|
2436
2703
|
this.unifiedProductCatalog = [].concat(fallbackProducts);
|
|
2437
|
-
|
|
2704
|
+
_context21.next = 45;
|
|
2438
2705
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
|
|
2439
2706
|
case 45:
|
|
2440
|
-
return
|
|
2707
|
+
return _context21.abrupt("return", fallbackProducts);
|
|
2441
2708
|
case 46:
|
|
2442
2709
|
case "end":
|
|
2443
|
-
return
|
|
2710
|
+
return _context21.stop();
|
|
2444
2711
|
}
|
|
2445
|
-
},
|
|
2712
|
+
}, _callee21, this, [[24, 36, 39, 42]]);
|
|
2446
2713
|
}));
|
|
2447
|
-
function loadProductsByScheduleDate(
|
|
2714
|
+
function loadProductsByScheduleDate(_x12) {
|
|
2448
2715
|
return _loadProductsByScheduleDate.apply(this, arguments);
|
|
2449
2716
|
}
|
|
2450
2717
|
return loadProductsByScheduleDate;
|
|
@@ -2497,7 +2764,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2497
2764
|
}, {
|
|
2498
2765
|
key: "applyPlannerDiscounts",
|
|
2499
2766
|
value: (function () {
|
|
2500
|
-
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2767
|
+
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
2501
2768
|
var _params$customerId;
|
|
2502
2769
|
var params,
|
|
2503
2770
|
tempOrder,
|
|
@@ -2514,24 +2781,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2514
2781
|
discount,
|
|
2515
2782
|
discountId,
|
|
2516
2783
|
nextTempOrder,
|
|
2517
|
-
|
|
2518
|
-
return _regeneratorRuntime().wrap(function
|
|
2519
|
-
while (1) switch (
|
|
2784
|
+
_args22 = arguments;
|
|
2785
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2786
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2520
2787
|
case 0:
|
|
2521
|
-
params =
|
|
2788
|
+
params = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
|
|
2522
2789
|
tempOrder = this.getTempOrder();
|
|
2523
2790
|
requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
2524
2791
|
parsedCustomerId = Number(requestedCustomerId);
|
|
2525
2792
|
customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
|
|
2526
|
-
|
|
2793
|
+
_context22.next = 7;
|
|
2527
2794
|
return this.getSummary();
|
|
2528
2795
|
case 7:
|
|
2529
|
-
summaryBefore =
|
|
2796
|
+
summaryBefore = _context22.sent;
|
|
2530
2797
|
if (customerId) {
|
|
2531
|
-
|
|
2798
|
+
_context22.next = 10;
|
|
2532
2799
|
break;
|
|
2533
2800
|
}
|
|
2534
|
-
return
|
|
2801
|
+
return _context22.abrupt("return", buildPlannerDiscountResult({
|
|
2535
2802
|
customerId: null,
|
|
2536
2803
|
discountList: this.getDiscountList(),
|
|
2537
2804
|
products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
|
|
@@ -2540,7 +2807,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2540
2807
|
status: 'no_customer'
|
|
2541
2808
|
}));
|
|
2542
2809
|
case 10:
|
|
2543
|
-
|
|
2810
|
+
_context22.next = 12;
|
|
2544
2811
|
return this.loadDiscountConfig({
|
|
2545
2812
|
customerId: customerId,
|
|
2546
2813
|
action: 'create'
|
|
@@ -2552,7 +2819,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2552
2819
|
return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
|
|
2553
2820
|
});
|
|
2554
2821
|
if (!preferredDiscount) {
|
|
2555
|
-
|
|
2822
|
+
_context22.next = 40;
|
|
2556
2823
|
break;
|
|
2557
2824
|
}
|
|
2558
2825
|
// A requested card is an explicit UI choice, not a best-effort preference. Clear prior
|
|
@@ -2564,98 +2831,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2564
2831
|
return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
|
|
2565
2832
|
});
|
|
2566
2833
|
_iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
|
|
2567
|
-
|
|
2834
|
+
_context22.prev = 18;
|
|
2568
2835
|
_iterator2.s();
|
|
2569
2836
|
case 20:
|
|
2570
2837
|
if ((_step2 = _iterator2.n()).done) {
|
|
2571
|
-
|
|
2838
|
+
_context22.next = 28;
|
|
2572
2839
|
break;
|
|
2573
2840
|
}
|
|
2574
2841
|
discount = _step2.value;
|
|
2575
2842
|
discountId = Number(resolvePlannerDiscountId(discount));
|
|
2576
2843
|
if (!Number.isFinite(discountId)) {
|
|
2577
|
-
|
|
2844
|
+
_context22.next = 26;
|
|
2578
2845
|
break;
|
|
2579
2846
|
}
|
|
2580
|
-
|
|
2847
|
+
_context22.next = 26;
|
|
2581
2848
|
return this.setDiscountSelected({
|
|
2582
2849
|
discountId: discountId,
|
|
2583
2850
|
isSelected: false
|
|
2584
2851
|
});
|
|
2585
2852
|
case 26:
|
|
2586
|
-
|
|
2853
|
+
_context22.next = 20;
|
|
2587
2854
|
break;
|
|
2588
2855
|
case 28:
|
|
2589
|
-
|
|
2856
|
+
_context22.next = 33;
|
|
2590
2857
|
break;
|
|
2591
2858
|
case 30:
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
_iterator2.e(
|
|
2859
|
+
_context22.prev = 30;
|
|
2860
|
+
_context22.t0 = _context22["catch"](18);
|
|
2861
|
+
_iterator2.e(_context22.t0);
|
|
2595
2862
|
case 33:
|
|
2596
|
-
|
|
2863
|
+
_context22.prev = 33;
|
|
2597
2864
|
_iterator2.f();
|
|
2598
|
-
return
|
|
2865
|
+
return _context22.finish(33);
|
|
2599
2866
|
case 36:
|
|
2600
|
-
|
|
2867
|
+
_context22.next = 38;
|
|
2601
2868
|
return this.setDiscountSelected({
|
|
2602
2869
|
discountId: Number(preferredId),
|
|
2603
2870
|
isSelected: true
|
|
2604
2871
|
});
|
|
2605
2872
|
case 38:
|
|
2606
|
-
|
|
2873
|
+
_context22.next = 49;
|
|
2607
2874
|
break;
|
|
2608
2875
|
case 40:
|
|
2609
2876
|
if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
|
|
2610
|
-
|
|
2877
|
+
_context22.next = 46;
|
|
2611
2878
|
break;
|
|
2612
2879
|
}
|
|
2613
2880
|
if (!(params.applyBestDiscount !== false)) {
|
|
2614
|
-
|
|
2881
|
+
_context22.next = 44;
|
|
2615
2882
|
break;
|
|
2616
2883
|
}
|
|
2617
|
-
|
|
2884
|
+
_context22.next = 44;
|
|
2618
2885
|
return this.bestDiscount();
|
|
2619
2886
|
case 44:
|
|
2620
|
-
|
|
2887
|
+
_context22.next = 49;
|
|
2621
2888
|
break;
|
|
2622
2889
|
case 46:
|
|
2623
2890
|
if (!(params.applyBestDiscount !== false)) {
|
|
2624
|
-
|
|
2891
|
+
_context22.next = 49;
|
|
2625
2892
|
break;
|
|
2626
2893
|
}
|
|
2627
|
-
|
|
2894
|
+
_context22.next = 49;
|
|
2628
2895
|
return this.bestDiscount();
|
|
2629
2896
|
case 49:
|
|
2630
2897
|
nextTempOrder = this.getTempOrder();
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2898
|
+
_context22.t1 = buildPlannerDiscountResult;
|
|
2899
|
+
_context22.t2 = customerId;
|
|
2900
|
+
_context22.t3 = this.getDiscountList();
|
|
2901
|
+
_context22.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
|
|
2902
|
+
_context22.t5 = summaryBefore;
|
|
2903
|
+
_context22.next = 57;
|
|
2637
2904
|
return this.getSummary();
|
|
2638
2905
|
case 57:
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
customerId:
|
|
2645
|
-
discountList:
|
|
2646
|
-
products:
|
|
2647
|
-
summaryBefore:
|
|
2648
|
-
summaryAfter:
|
|
2649
|
-
status:
|
|
2650
|
-
preferredDiscountId:
|
|
2651
|
-
preferredDiscountFound:
|
|
2906
|
+
_context22.t6 = _context22.sent;
|
|
2907
|
+
_context22.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
|
|
2908
|
+
_context22.t8 = preferredDiscountId;
|
|
2909
|
+
_context22.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
|
|
2910
|
+
_context22.t10 = {
|
|
2911
|
+
customerId: _context22.t2,
|
|
2912
|
+
discountList: _context22.t3,
|
|
2913
|
+
products: _context22.t4,
|
|
2914
|
+
summaryBefore: _context22.t5,
|
|
2915
|
+
summaryAfter: _context22.t6,
|
|
2916
|
+
status: _context22.t7,
|
|
2917
|
+
preferredDiscountId: _context22.t8,
|
|
2918
|
+
preferredDiscountFound: _context22.t9
|
|
2652
2919
|
};
|
|
2653
|
-
return
|
|
2920
|
+
return _context22.abrupt("return", (0, _context22.t1)(_context22.t10));
|
|
2654
2921
|
case 63:
|
|
2655
2922
|
case "end":
|
|
2656
|
-
return
|
|
2923
|
+
return _context22.stop();
|
|
2657
2924
|
}
|
|
2658
|
-
},
|
|
2925
|
+
}, _callee22, this, [[18, 30, 33, 36]]);
|
|
2659
2926
|
}));
|
|
2660
2927
|
function applyPlannerDiscounts() {
|
|
2661
2928
|
return _applyPlannerDiscounts.apply(this, arguments);
|
|
@@ -2665,16 +2932,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2665
2932
|
}, {
|
|
2666
2933
|
key: "buildUnifiedOrderProduct",
|
|
2667
2934
|
value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
|
|
2668
|
-
var
|
|
2935
|
+
var _ref38, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref39, _sourceProduct$produc, _ref40, _ref41, _sourceProduct$quanti, _sourceProduct$price, _ref42, _ref43, _sourceProduct$sellin;
|
|
2669
2936
|
var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
|
|
2670
|
-
var quotationShelfId = (
|
|
2937
|
+
var quotationShelfId = (_ref38 = (_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 && _ref38 !== void 0 ? _ref38 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
|
|
2671
2938
|
var orderProduct = this.transformBaseProductToOrderProduct({
|
|
2672
2939
|
payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
|
|
2673
2940
|
id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
|
|
2674
|
-
product_id: (
|
|
2675
|
-
quantity: (
|
|
2941
|
+
product_id: (_ref39 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref39 !== void 0 ? _ref39 : product === null || product === void 0 ? void 0 : product.id,
|
|
2942
|
+
quantity: (_ref40 = (_ref41 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref41 !== void 0 ? _ref41 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref40 !== void 0 ? _ref40 : 1,
|
|
2676
2943
|
price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
|
|
2677
|
-
selling_price: (
|
|
2944
|
+
selling_price: (_ref42 = (_ref43 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref43 !== void 0 ? _ref43 : normalizedProductRaw.selling_price) !== null && _ref42 !== void 0 ? _ref42 : normalizedProductRaw.price,
|
|
2678
2945
|
metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
|
|
2679
2946
|
}),
|
|
2680
2947
|
sourceProduct: sourceProduct
|
|
@@ -2693,29 +2960,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2693
2960
|
}, {
|
|
2694
2961
|
key: "removeExistingStagedLines",
|
|
2695
2962
|
value: (function () {
|
|
2696
|
-
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2963
|
+
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(ownershipKey) {
|
|
2697
2964
|
var _this$getTempOrder;
|
|
2698
2965
|
var existingLines;
|
|
2699
|
-
return _regeneratorRuntime().wrap(function
|
|
2700
|
-
while (1) switch (
|
|
2966
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2967
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2701
2968
|
case 0:
|
|
2702
2969
|
existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
|
|
2703
2970
|
var _product$metadata4;
|
|
2704
2971
|
return (product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4[ownershipKey]) === true;
|
|
2705
2972
|
});
|
|
2706
2973
|
if (!(existingLines.length > 0)) {
|
|
2707
|
-
|
|
2974
|
+
_context23.next = 4;
|
|
2708
2975
|
break;
|
|
2709
2976
|
}
|
|
2710
|
-
|
|
2977
|
+
_context23.next = 4;
|
|
2711
2978
|
return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
|
|
2712
2979
|
case 4:
|
|
2713
2980
|
case "end":
|
|
2714
|
-
return
|
|
2981
|
+
return _context23.stop();
|
|
2715
2982
|
}
|
|
2716
|
-
},
|
|
2983
|
+
}, _callee23, this);
|
|
2717
2984
|
}));
|
|
2718
|
-
function removeExistingStagedLines(
|
|
2985
|
+
function removeExistingStagedLines(_x13) {
|
|
2719
2986
|
return _removeExistingStagedLines.apply(this, arguments);
|
|
2720
2987
|
}
|
|
2721
2988
|
return removeExistingStagedLines;
|
|
@@ -2723,25 +2990,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2723
2990
|
}, {
|
|
2724
2991
|
key: "stageProducts",
|
|
2725
2992
|
value: function () {
|
|
2726
|
-
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2993
|
+
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params, ownershipKey) {
|
|
2727
2994
|
var _params$rawProducts;
|
|
2728
2995
|
var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
|
|
2729
|
-
return _regeneratorRuntime().wrap(function
|
|
2730
|
-
while (1) switch (
|
|
2996
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2997
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2731
2998
|
case 0:
|
|
2732
2999
|
productIds = params.productIds || [];
|
|
2733
3000
|
if (productIds.length) {
|
|
2734
|
-
|
|
3001
|
+
_context24.next = 3;
|
|
2735
3002
|
break;
|
|
2736
3003
|
}
|
|
2737
|
-
return
|
|
3004
|
+
return _context24.abrupt("return", this.getTempOrder());
|
|
2738
3005
|
case 3:
|
|
2739
3006
|
if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
|
|
2740
|
-
|
|
3007
|
+
_context24.next = 7;
|
|
2741
3008
|
break;
|
|
2742
3009
|
}
|
|
2743
3010
|
this.unifiedProductCatalog = params.rawProducts;
|
|
2744
|
-
|
|
3011
|
+
_context24.next = 12;
|
|
2745
3012
|
break;
|
|
2746
3013
|
case 7:
|
|
2747
3014
|
existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
|
|
@@ -2752,15 +3019,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2752
3019
|
return !existingIds.has(String(id));
|
|
2753
3020
|
});
|
|
2754
3021
|
if (!(missingIds.length || params.productLoadParams)) {
|
|
2755
|
-
|
|
3022
|
+
_context24.next = 12;
|
|
2756
3023
|
break;
|
|
2757
3024
|
}
|
|
2758
|
-
|
|
3025
|
+
_context24.next = 12;
|
|
2759
3026
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
2760
3027
|
product_ids: productIds.map(Number).filter(Number.isFinite)
|
|
2761
3028
|
}));
|
|
2762
3029
|
case 12:
|
|
2763
|
-
|
|
3030
|
+
_context24.next = 14;
|
|
2764
3031
|
return this.removeExistingStagedLines(ownershipKey);
|
|
2765
3032
|
case 14:
|
|
2766
3033
|
productIdSet = new Set(productIds.map(function (id) {
|
|
@@ -2773,30 +3040,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2773
3040
|
_i = 0, _arr = selectedProducts;
|
|
2774
3041
|
case 17:
|
|
2775
3042
|
if (!(_i < _arr.length)) {
|
|
2776
|
-
|
|
3043
|
+
_context24.next = 26;
|
|
2777
3044
|
break;
|
|
2778
3045
|
}
|
|
2779
3046
|
sourceProduct = _arr[_i];
|
|
2780
3047
|
productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
|
|
2781
3048
|
if (!productInput) {
|
|
2782
|
-
|
|
3049
|
+
_context24.next = 23;
|
|
2783
3050
|
break;
|
|
2784
3051
|
}
|
|
2785
|
-
|
|
3052
|
+
_context24.next = 23;
|
|
2786
3053
|
return this.addProductToOrder(productInput);
|
|
2787
3054
|
case 23:
|
|
2788
3055
|
_i++;
|
|
2789
|
-
|
|
3056
|
+
_context24.next = 17;
|
|
2790
3057
|
break;
|
|
2791
3058
|
case 26:
|
|
2792
|
-
return
|
|
3059
|
+
return _context24.abrupt("return", this.getTempOrder());
|
|
2793
3060
|
case 27:
|
|
2794
3061
|
case "end":
|
|
2795
|
-
return
|
|
3062
|
+
return _context24.stop();
|
|
2796
3063
|
}
|
|
2797
|
-
},
|
|
3064
|
+
}, _callee24, this);
|
|
2798
3065
|
}));
|
|
2799
|
-
function stageProducts(
|
|
3066
|
+
function stageProducts(_x14, _x15) {
|
|
2800
3067
|
return _stageProducts.apply(this, arguments);
|
|
2801
3068
|
}
|
|
2802
3069
|
return stageProducts;
|
|
@@ -2808,18 +3075,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2808
3075
|
}, {
|
|
2809
3076
|
key: "stageRetailProducts",
|
|
2810
3077
|
value: (function () {
|
|
2811
|
-
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2812
|
-
return _regeneratorRuntime().wrap(function
|
|
2813
|
-
while (1) switch (
|
|
3078
|
+
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
3079
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
3080
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2814
3081
|
case 0:
|
|
2815
|
-
return
|
|
3082
|
+
return _context25.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
|
|
2816
3083
|
case 1:
|
|
2817
3084
|
case "end":
|
|
2818
|
-
return
|
|
3085
|
+
return _context25.stop();
|
|
2819
3086
|
}
|
|
2820
|
-
},
|
|
3087
|
+
}, _callee25, this);
|
|
2821
3088
|
}));
|
|
2822
|
-
function stageRetailProducts(
|
|
3089
|
+
function stageRetailProducts(_x16) {
|
|
2823
3090
|
return _stageRetailProducts.apply(this, arguments);
|
|
2824
3091
|
}
|
|
2825
3092
|
return stageRetailProducts;
|
|
@@ -2833,20 +3100,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2833
3100
|
}, {
|
|
2834
3101
|
key: "addRetailProduct",
|
|
2835
3102
|
value: (function () {
|
|
2836
|
-
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2837
|
-
var _params$quantity,
|
|
3103
|
+
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
3104
|
+
var _params$quantity, _ref44, _params$productId, _params$product, _params$product2;
|
|
2838
3105
|
var quantity, productId, sourceProduct, products, orderProduct;
|
|
2839
|
-
return _regeneratorRuntime().wrap(function
|
|
2840
|
-
while (1) switch (
|
|
3106
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3107
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2841
3108
|
case 0:
|
|
2842
3109
|
quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
|
|
2843
3110
|
if (!(!Number.isFinite(quantity) || quantity <= 0)) {
|
|
2844
|
-
|
|
3111
|
+
_context26.next = 3;
|
|
2845
3112
|
break;
|
|
2846
3113
|
}
|
|
2847
3114
|
throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
|
|
2848
3115
|
case 3:
|
|
2849
|
-
productId = (
|
|
3116
|
+
productId = (_ref44 = (_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 && _ref44 !== void 0 ? _ref44 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
|
|
2850
3117
|
sourceProduct = params.product;
|
|
2851
3118
|
if (!sourceProduct && productId !== undefined && productId !== null) {
|
|
2852
3119
|
sourceProduct = this.unifiedProductCatalog.find(function (product) {
|
|
@@ -2855,22 +3122,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2855
3122
|
});
|
|
2856
3123
|
}
|
|
2857
3124
|
if (!(!sourceProduct && productId !== undefined && productId !== null)) {
|
|
2858
|
-
|
|
3125
|
+
_context26.next = 11;
|
|
2859
3126
|
break;
|
|
2860
3127
|
}
|
|
2861
|
-
|
|
3128
|
+
_context26.next = 9;
|
|
2862
3129
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
2863
3130
|
product_ids: [Number(productId)].filter(Number.isFinite)
|
|
2864
3131
|
}));
|
|
2865
3132
|
case 9:
|
|
2866
|
-
products =
|
|
3133
|
+
products = _context26.sent;
|
|
2867
3134
|
sourceProduct = products.find(function (product) {
|
|
2868
3135
|
var _product$id4;
|
|
2869
3136
|
return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
|
|
2870
3137
|
});
|
|
2871
3138
|
case 11:
|
|
2872
3139
|
if (sourceProduct) {
|
|
2873
|
-
|
|
3140
|
+
_context26.next = 13;
|
|
2874
3141
|
break;
|
|
2875
3142
|
}
|
|
2876
3143
|
throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
|
|
@@ -2879,19 +3146,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2879
3146
|
quantity: quantity
|
|
2880
3147
|
}), 'unified_booking_sales_retail');
|
|
2881
3148
|
if (orderProduct) {
|
|
2882
|
-
|
|
3149
|
+
_context26.next = 16;
|
|
2883
3150
|
break;
|
|
2884
3151
|
}
|
|
2885
3152
|
throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
|
|
2886
3153
|
case 16:
|
|
2887
|
-
return
|
|
3154
|
+
return _context26.abrupt("return", this.addProductToOrder(orderProduct));
|
|
2888
3155
|
case 17:
|
|
2889
3156
|
case "end":
|
|
2890
|
-
return
|
|
3157
|
+
return _context26.stop();
|
|
2891
3158
|
}
|
|
2892
|
-
},
|
|
3159
|
+
}, _callee26, this);
|
|
2893
3160
|
}));
|
|
2894
|
-
function addRetailProduct(
|
|
3161
|
+
function addRetailProduct(_x17) {
|
|
2895
3162
|
return _addRetailProduct.apply(this, arguments);
|
|
2896
3163
|
}
|
|
2897
3164
|
return addRetailProduct;
|
|
@@ -2991,7 +3258,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2991
3258
|
}, {
|
|
2992
3259
|
key: "buildAvailabilityOperatingHoursSnapshot",
|
|
2993
3260
|
value: function buildAvailabilityOperatingHoursSnapshot(params) {
|
|
2994
|
-
var
|
|
3261
|
+
var _this4 = this;
|
|
2995
3262
|
var descriptor = params.prepare._availabilityOperatingHours || {
|
|
2996
3263
|
source: params.prepare.businessHours ? 'prepare_business_hours' : 'default_business_hours',
|
|
2997
3264
|
scheduleIds: []
|
|
@@ -3001,7 +3268,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3001
3268
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3002
3269
|
startAt: "".concat(date, "T").concat(params.businessHours.startTime, ":00"),
|
|
3003
3270
|
endAt: "".concat(date, "T").concat(params.businessHours.endTime, ":00"),
|
|
3004
|
-
fixedOffsetMinutes:
|
|
3271
|
+
fixedOffsetMinutes: _this4.getAvailabilityRuntimeOffsetMinutes(),
|
|
3005
3272
|
rollOverEnd: true
|
|
3006
3273
|
});
|
|
3007
3274
|
return range ? [{
|
|
@@ -3036,7 +3303,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3036
3303
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3037
3304
|
startAt: slot.start_at,
|
|
3038
3305
|
endAt: slot.end_at,
|
|
3039
|
-
fixedOffsetMinutes:
|
|
3306
|
+
fixedOffsetMinutes: _this4.getAvailabilityRuntimeOffsetMinutes(),
|
|
3040
3307
|
rollOverEnd: true
|
|
3041
3308
|
});
|
|
3042
3309
|
return range ? [{
|
|
@@ -3056,46 +3323,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3056
3323
|
}, {
|
|
3057
3324
|
key: "loadAvailabilityProducts",
|
|
3058
3325
|
value: function () {
|
|
3059
|
-
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3326
|
+
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
3060
3327
|
var _prepare$catalogScope,
|
|
3061
3328
|
_prepare$catalogScope2,
|
|
3062
|
-
|
|
3329
|
+
_this5 = this,
|
|
3063
3330
|
_prepare$resourceIds;
|
|
3064
3331
|
var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
|
|
3065
|
-
return _regeneratorRuntime().wrap(function
|
|
3066
|
-
while (1) switch (
|
|
3332
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3333
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
3067
3334
|
case 0:
|
|
3068
3335
|
prepare = params.prepare, dateRange = params.dateRange;
|
|
3069
3336
|
explicitProductIds = prepare.productIds || [];
|
|
3070
3337
|
rawProducts = [];
|
|
3071
3338
|
if (!Array.isArray(prepare.rawProducts)) {
|
|
3072
|
-
|
|
3339
|
+
_context27.next = 8;
|
|
3073
3340
|
break;
|
|
3074
3341
|
}
|
|
3075
3342
|
rawProducts = prepare.rawProducts;
|
|
3076
3343
|
this.unifiedProductCatalog = _toConsumableArray(rawProducts);
|
|
3077
|
-
|
|
3344
|
+
_context27.next = 34;
|
|
3078
3345
|
break;
|
|
3079
3346
|
case 8:
|
|
3080
3347
|
if (!(explicitProductIds.length > 0)) {
|
|
3081
|
-
|
|
3348
|
+
_context27.next = 14;
|
|
3082
3349
|
break;
|
|
3083
3350
|
}
|
|
3084
|
-
|
|
3351
|
+
_context27.next = 11;
|
|
3085
3352
|
return this.loadProducts({
|
|
3086
3353
|
product_ids: explicitProductIds,
|
|
3087
3354
|
schedule_date: dateRange.startDate
|
|
3088
3355
|
});
|
|
3089
3356
|
case 11:
|
|
3090
|
-
rawProducts =
|
|
3091
|
-
|
|
3357
|
+
rawProducts = _context27.sent;
|
|
3358
|
+
_context27.next = 34;
|
|
3092
3359
|
break;
|
|
3093
3360
|
case 14:
|
|
3094
3361
|
if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
|
|
3095
|
-
|
|
3362
|
+
_context27.next = 30;
|
|
3096
3363
|
break;
|
|
3097
3364
|
}
|
|
3098
|
-
|
|
3365
|
+
_context27.next = 17;
|
|
3099
3366
|
return this.loadScheduleAvailableDate({
|
|
3100
3367
|
startDate: dateRange.startDate,
|
|
3101
3368
|
endDate: dateRange.endDate,
|
|
@@ -3111,44 +3378,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3111
3378
|
});
|
|
3112
3379
|
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)) || [])));
|
|
3113
3380
|
if (!(productIds.length > 0)) {
|
|
3114
|
-
|
|
3381
|
+
_context27.next = 27;
|
|
3115
3382
|
break;
|
|
3116
3383
|
}
|
|
3117
3384
|
assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
|
|
3118
|
-
|
|
3385
|
+
_context27.next = 24;
|
|
3119
3386
|
return this.loadProducts({
|
|
3120
3387
|
product_ids: productIds,
|
|
3121
3388
|
schedule_date: dateRange.startDate
|
|
3122
3389
|
});
|
|
3123
3390
|
case 24:
|
|
3124
|
-
rawProducts =
|
|
3125
|
-
|
|
3391
|
+
rawProducts = _context27.sent;
|
|
3392
|
+
_context27.next = 28;
|
|
3126
3393
|
break;
|
|
3127
3394
|
case 27:
|
|
3128
3395
|
this.unifiedProductCatalog = [];
|
|
3129
3396
|
case 28:
|
|
3130
|
-
|
|
3397
|
+
_context27.next = 34;
|
|
3131
3398
|
break;
|
|
3132
3399
|
case 30:
|
|
3133
3400
|
if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
|
|
3134
|
-
|
|
3401
|
+
_context27.next = 34;
|
|
3135
3402
|
break;
|
|
3136
3403
|
}
|
|
3137
|
-
|
|
3404
|
+
_context27.next = 33;
|
|
3138
3405
|
return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
|
|
3139
3406
|
schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
|
|
3140
3407
|
}));
|
|
3141
3408
|
case 33:
|
|
3142
|
-
rawProducts =
|
|
3409
|
+
rawProducts = _context27.sent;
|
|
3143
3410
|
case 34:
|
|
3144
3411
|
normalized = rawProducts.map(function (product) {
|
|
3145
|
-
return normalizeProductForAvailability(product, params.scheduleList,
|
|
3412
|
+
return normalizeProductForAvailability(product, params.scheduleList, _this5.getAvailabilityRuntimeOffsetMinutes());
|
|
3146
3413
|
});
|
|
3147
3414
|
if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
|
|
3148
|
-
|
|
3415
|
+
_context27.next = 37;
|
|
3149
3416
|
break;
|
|
3150
3417
|
}
|
|
3151
|
-
return
|
|
3418
|
+
return _context27.abrupt("return", normalized.filter(function (product) {
|
|
3152
3419
|
var _product$requirementG2;
|
|
3153
3420
|
return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
|
|
3154
3421
|
var _group$resourceIds3;
|
|
@@ -3161,16 +3428,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3161
3428
|
}));
|
|
3162
3429
|
case 37:
|
|
3163
3430
|
productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
|
|
3164
|
-
return
|
|
3431
|
+
return _context27.abrupt("return", productIdSet ? normalized.filter(function (product) {
|
|
3165
3432
|
return productIdSet.has(String(product.id));
|
|
3166
3433
|
}) : normalized);
|
|
3167
3434
|
case 39:
|
|
3168
3435
|
case "end":
|
|
3169
|
-
return
|
|
3436
|
+
return _context27.stop();
|
|
3170
3437
|
}
|
|
3171
|
-
},
|
|
3438
|
+
}, _callee27, this);
|
|
3172
3439
|
}));
|
|
3173
|
-
function loadAvailabilityProducts(
|
|
3440
|
+
function loadAvailabilityProducts(_x18) {
|
|
3174
3441
|
return _loadAvailabilityProducts.apply(this, arguments);
|
|
3175
3442
|
}
|
|
3176
3443
|
return loadAvailabilityProducts;
|
|
@@ -3183,12 +3450,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3183
3450
|
}, {
|
|
3184
3451
|
key: "fetchAvailabilityResourcesV2",
|
|
3185
3452
|
value: (function () {
|
|
3186
|
-
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3453
|
+
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
3187
3454
|
var response, data;
|
|
3188
|
-
return _regeneratorRuntime().wrap(function
|
|
3189
|
-
while (1) switch (
|
|
3455
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3456
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3190
3457
|
case 0:
|
|
3191
|
-
|
|
3458
|
+
_context28.next = 2;
|
|
3192
3459
|
return this.request.get('/schedule/resource/list/v2', {
|
|
3193
3460
|
start_date: params.dateRange.startDate,
|
|
3194
3461
|
end_date: params.dateRange.endDate,
|
|
@@ -3198,28 +3465,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3198
3465
|
useCache: false
|
|
3199
3466
|
});
|
|
3200
3467
|
case 2:
|
|
3201
|
-
response =
|
|
3468
|
+
response = _context28.sent;
|
|
3202
3469
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
3203
3470
|
if (!Array.isArray(data)) {
|
|
3204
|
-
|
|
3471
|
+
_context28.next = 6;
|
|
3205
3472
|
break;
|
|
3206
3473
|
}
|
|
3207
|
-
return
|
|
3474
|
+
return _context28.abrupt("return", data);
|
|
3208
3475
|
case 6:
|
|
3209
3476
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
|
|
3210
|
-
|
|
3477
|
+
_context28.next = 8;
|
|
3211
3478
|
break;
|
|
3212
3479
|
}
|
|
3213
|
-
return
|
|
3480
|
+
return _context28.abrupt("return", data.list);
|
|
3214
3481
|
case 8:
|
|
3215
|
-
return
|
|
3482
|
+
return _context28.abrupt("return", []);
|
|
3216
3483
|
case 9:
|
|
3217
3484
|
case "end":
|
|
3218
|
-
return
|
|
3485
|
+
return _context28.stop();
|
|
3219
3486
|
}
|
|
3220
|
-
},
|
|
3487
|
+
}, _callee28, this);
|
|
3221
3488
|
}));
|
|
3222
|
-
function fetchAvailabilityResourcesV2(
|
|
3489
|
+
function fetchAvailabilityResourcesV2(_x19) {
|
|
3223
3490
|
return _fetchAvailabilityResourcesV.apply(this, arguments);
|
|
3224
3491
|
}
|
|
3225
3492
|
return fetchAvailabilityResourcesV2;
|
|
@@ -3227,17 +3494,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3227
3494
|
}, {
|
|
3228
3495
|
key: "fetchAndPublishAvailabilityResourcesV2",
|
|
3229
3496
|
value: function () {
|
|
3230
|
-
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3497
|
+
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
3231
3498
|
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
|
|
3232
|
-
return _regeneratorRuntime().wrap(function
|
|
3233
|
-
while (1) switch (
|
|
3499
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3500
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3234
3501
|
case 0:
|
|
3235
3502
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
3236
3503
|
if (!(normalizedResourceIds.length === 0)) {
|
|
3237
|
-
|
|
3504
|
+
_context29.next = 3;
|
|
3238
3505
|
break;
|
|
3239
3506
|
}
|
|
3240
|
-
return
|
|
3507
|
+
return _context29.abrupt("return", []);
|
|
3241
3508
|
case 3:
|
|
3242
3509
|
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
3243
3510
|
cacheParams = {
|
|
@@ -3247,7 +3514,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3247
3514
|
};
|
|
3248
3515
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
3249
3516
|
if (!cachedRawResources) {
|
|
3250
|
-
|
|
3517
|
+
_context29.next = 9;
|
|
3251
3518
|
break;
|
|
3252
3519
|
}
|
|
3253
3520
|
if (params.useCacheOnHit) {
|
|
@@ -3259,23 +3526,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3259
3526
|
console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
|
|
3260
3527
|
});
|
|
3261
3528
|
}
|
|
3262
|
-
return
|
|
3529
|
+
return _context29.abrupt("return", cachedRawResources);
|
|
3263
3530
|
case 9:
|
|
3264
|
-
|
|
3531
|
+
_context29.next = 11;
|
|
3265
3532
|
return this.refreshAvailabilityRemoteResourceQuery({
|
|
3266
3533
|
timezone: params.timezone,
|
|
3267
3534
|
dateRange: params.dateRange,
|
|
3268
3535
|
resourceIds: normalizedResourceIds
|
|
3269
3536
|
});
|
|
3270
3537
|
case 11:
|
|
3271
|
-
return
|
|
3538
|
+
return _context29.abrupt("return", _context29.sent);
|
|
3272
3539
|
case 12:
|
|
3273
3540
|
case "end":
|
|
3274
|
-
return
|
|
3541
|
+
return _context29.stop();
|
|
3275
3542
|
}
|
|
3276
|
-
},
|
|
3543
|
+
}, _callee29, this);
|
|
3277
3544
|
}));
|
|
3278
|
-
function fetchAndPublishAvailabilityResourcesV2(
|
|
3545
|
+
function fetchAndPublishAvailabilityResourcesV2(_x20) {
|
|
3279
3546
|
return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
|
|
3280
3547
|
}
|
|
3281
3548
|
return fetchAndPublishAvailabilityResourcesV2;
|
|
@@ -3283,17 +3550,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3283
3550
|
}, {
|
|
3284
3551
|
key: "refreshAvailabilityRemoteResourceQuery",
|
|
3285
3552
|
value: function () {
|
|
3286
|
-
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3553
|
+
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
3287
3554
|
var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
|
|
3288
|
-
return _regeneratorRuntime().wrap(function
|
|
3289
|
-
while (1) switch (
|
|
3555
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3556
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3290
3557
|
case 0:
|
|
3291
3558
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
3292
3559
|
if (!(normalizedResourceIds.length === 0)) {
|
|
3293
|
-
|
|
3560
|
+
_context30.next = 3;
|
|
3294
3561
|
break;
|
|
3295
3562
|
}
|
|
3296
|
-
return
|
|
3563
|
+
return _context30.abrupt("return", []);
|
|
3297
3564
|
case 3:
|
|
3298
3565
|
queryKey = this.buildAvailabilityRemoteResourceQueryKey({
|
|
3299
3566
|
timezone: params.timezone,
|
|
@@ -3303,13 +3570,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3303
3570
|
epoch = this.availabilityRemoteResourceEpoch;
|
|
3304
3571
|
existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
3305
3572
|
if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
|
|
3306
|
-
|
|
3573
|
+
_context30.next = 10;
|
|
3307
3574
|
break;
|
|
3308
3575
|
}
|
|
3309
|
-
|
|
3576
|
+
_context30.next = 9;
|
|
3310
3577
|
return existing.promise;
|
|
3311
3578
|
case 9:
|
|
3312
|
-
return
|
|
3579
|
+
return _context30.abrupt("return", _context30.sent);
|
|
3313
3580
|
case 10:
|
|
3314
3581
|
this.availabilityRemoteResourceQuerySequence += 1;
|
|
3315
3582
|
writeVersion = this.availabilityRemoteResourceQuerySequence;
|
|
@@ -3321,11 +3588,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3321
3588
|
epoch: epoch,
|
|
3322
3589
|
promise: promise
|
|
3323
3590
|
});
|
|
3324
|
-
|
|
3325
|
-
|
|
3591
|
+
_context30.prev = 14;
|
|
3592
|
+
_context30.next = 17;
|
|
3326
3593
|
return promise;
|
|
3327
3594
|
case 17:
|
|
3328
|
-
rawResources =
|
|
3595
|
+
rawResources = _context30.sent;
|
|
3329
3596
|
if (epoch === this.availabilityRemoteResourceEpoch) {
|
|
3330
3597
|
this.availabilityRemoteOccupancyCache.publish({
|
|
3331
3598
|
scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
|
|
@@ -3336,21 +3603,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3336
3603
|
version: writeVersion
|
|
3337
3604
|
});
|
|
3338
3605
|
}
|
|
3339
|
-
return
|
|
3606
|
+
return _context30.abrupt("return", rawResources);
|
|
3340
3607
|
case 20:
|
|
3341
|
-
|
|
3608
|
+
_context30.prev = 20;
|
|
3342
3609
|
current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
3343
3610
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
3344
3611
|
this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
|
|
3345
3612
|
}
|
|
3346
|
-
return
|
|
3613
|
+
return _context30.finish(20);
|
|
3347
3614
|
case 24:
|
|
3348
3615
|
case "end":
|
|
3349
|
-
return
|
|
3616
|
+
return _context30.stop();
|
|
3350
3617
|
}
|
|
3351
|
-
},
|
|
3618
|
+
}, _callee30, this, [[14,, 20, 24]]);
|
|
3352
3619
|
}));
|
|
3353
|
-
function refreshAvailabilityRemoteResourceQuery(
|
|
3620
|
+
function refreshAvailabilityRemoteResourceQuery(_x21) {
|
|
3354
3621
|
return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
|
|
3355
3622
|
}
|
|
3356
3623
|
return refreshAvailabilityRemoteResourceQuery;
|
|
@@ -3358,26 +3625,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3358
3625
|
}, {
|
|
3359
3626
|
key: "loadAvailabilityResources",
|
|
3360
3627
|
value: function () {
|
|
3361
|
-
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3628
|
+
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3362
3629
|
var resourceIds, cachedRawResources, rawResources;
|
|
3363
|
-
return _regeneratorRuntime().wrap(function
|
|
3364
|
-
while (1) switch (
|
|
3630
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3631
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3365
3632
|
case 0:
|
|
3366
3633
|
resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
|
|
3367
3634
|
if (!(resourceIds.length === 0)) {
|
|
3368
|
-
|
|
3635
|
+
_context31.next = 3;
|
|
3369
3636
|
break;
|
|
3370
3637
|
}
|
|
3371
|
-
return
|
|
3638
|
+
return _context31.abrupt("return", {
|
|
3372
3639
|
resources: [],
|
|
3373
3640
|
resourceOccupancies: []
|
|
3374
3641
|
});
|
|
3375
3642
|
case 3:
|
|
3376
3643
|
if (!Array.isArray(params.rawResources)) {
|
|
3377
|
-
|
|
3644
|
+
_context31.next = 5;
|
|
3378
3645
|
break;
|
|
3379
3646
|
}
|
|
3380
|
-
return
|
|
3647
|
+
return _context31.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
3381
3648
|
rawResources: params.rawResources,
|
|
3382
3649
|
scheduleList: params.scheduleList,
|
|
3383
3650
|
dateRange: params.dateRange,
|
|
@@ -3385,7 +3652,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3385
3652
|
}));
|
|
3386
3653
|
case 5:
|
|
3387
3654
|
if (!(params.fetchPolicy === 'cache_only')) {
|
|
3388
|
-
|
|
3655
|
+
_context31.next = 10;
|
|
3389
3656
|
break;
|
|
3390
3657
|
}
|
|
3391
3658
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read({
|
|
@@ -3394,22 +3661,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3394
3661
|
dateRange: params.dateRange
|
|
3395
3662
|
});
|
|
3396
3663
|
if (!cachedRawResources) {
|
|
3397
|
-
|
|
3664
|
+
_context31.next = 9;
|
|
3398
3665
|
break;
|
|
3399
3666
|
}
|
|
3400
|
-
return
|
|
3667
|
+
return _context31.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
3401
3668
|
rawResources: cachedRawResources,
|
|
3402
3669
|
scheduleList: params.scheduleList,
|
|
3403
3670
|
dateRange: params.dateRange,
|
|
3404
3671
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
3405
3672
|
}));
|
|
3406
3673
|
case 9:
|
|
3407
|
-
return
|
|
3674
|
+
return _context31.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
|
|
3408
3675
|
resources: [],
|
|
3409
3676
|
resourceOccupancies: []
|
|
3410
3677
|
});
|
|
3411
3678
|
case 10:
|
|
3412
|
-
|
|
3679
|
+
_context31.next = 12;
|
|
3413
3680
|
return this.fetchAndPublishAvailabilityResourcesV2({
|
|
3414
3681
|
timezone: params.timezone,
|
|
3415
3682
|
dateRange: params.dateRange,
|
|
@@ -3417,8 +3684,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3417
3684
|
useCacheOnHit: true
|
|
3418
3685
|
});
|
|
3419
3686
|
case 12:
|
|
3420
|
-
rawResources =
|
|
3421
|
-
return
|
|
3687
|
+
rawResources = _context31.sent;
|
|
3688
|
+
return _context31.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
3422
3689
|
rawResources: rawResources,
|
|
3423
3690
|
scheduleList: params.scheduleList,
|
|
3424
3691
|
dateRange: params.dateRange,
|
|
@@ -3426,11 +3693,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3426
3693
|
}));
|
|
3427
3694
|
case 14:
|
|
3428
3695
|
case "end":
|
|
3429
|
-
return
|
|
3696
|
+
return _context31.stop();
|
|
3430
3697
|
}
|
|
3431
|
-
},
|
|
3698
|
+
}, _callee31, this);
|
|
3432
3699
|
}));
|
|
3433
|
-
function loadAvailabilityResources(
|
|
3700
|
+
function loadAvailabilityResources(_x22) {
|
|
3434
3701
|
return _loadAvailabilityResources.apply(this, arguments);
|
|
3435
3702
|
}
|
|
3436
3703
|
return loadAvailabilityResources;
|
|
@@ -3450,7 +3717,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3450
3717
|
var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
|
|
3451
3718
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
3452
3719
|
productLineUids.forEach(function (requestedUid) {
|
|
3453
|
-
var
|
|
3720
|
+
var _ref45, _product$booking_uid2, _product$metadata5;
|
|
3454
3721
|
var product = products.find(function (line) {
|
|
3455
3722
|
return getProductLineUid(line) === String(requestedUid);
|
|
3456
3723
|
});
|
|
@@ -3460,7 +3727,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3460
3727
|
});
|
|
3461
3728
|
}
|
|
3462
3729
|
var productUid = getProductLineUid(product);
|
|
3463
|
-
var linkedBookingUid = String((
|
|
3730
|
+
var linkedBookingUid = String((_ref45 = (_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 && _ref45 !== void 0 ? _ref45 : '');
|
|
3464
3731
|
var linkedBookings = bookings.filter(function (booking) {
|
|
3465
3732
|
var _booking$product_uid;
|
|
3466
3733
|
return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
|
|
@@ -3503,24 +3770,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3503
3770
|
}, {
|
|
3504
3771
|
key: "collectCartResourceOccupancies",
|
|
3505
3772
|
value: function collectCartResourceOccupancies(tempOrder, exclusions) {
|
|
3506
|
-
var
|
|
3773
|
+
var _this6 = this;
|
|
3507
3774
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
3508
3775
|
return bookings.flatMap(function (booking) {
|
|
3509
|
-
var
|
|
3776
|
+
var _ref46, _booking$product_uid2, _booking$metadata2;
|
|
3510
3777
|
var bookingUid = getBookingUid(booking);
|
|
3511
|
-
var productUid = String((
|
|
3778
|
+
var productUid = String((_ref46 = (_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 && _ref46 !== void 0 ? _ref46 : '');
|
|
3512
3779
|
var scheduleEventId = toNumberId(booking.schedule_event_id);
|
|
3513
3780
|
var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
|
|
3514
3781
|
var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
|
|
3515
3782
|
var resources = Array.isArray(booking.resources) ? booking.resources : [];
|
|
3516
3783
|
return resources.flatMap(function (resource) {
|
|
3517
|
-
var
|
|
3518
|
-
var resourceId = (
|
|
3784
|
+
var _ref47, _resource$resource_id, _ref48, _resource$capacity;
|
|
3785
|
+
var resourceId = (_ref47 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref47 !== void 0 ? _ref47 : resource.id;
|
|
3519
3786
|
if (resourceId == null || !startAt || !endAt) return [];
|
|
3520
3787
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3521
3788
|
startAt: startAt,
|
|
3522
3789
|
endAt: endAt,
|
|
3523
|
-
fixedOffsetMinutes:
|
|
3790
|
+
fixedOffsetMinutes: _this6.getAvailabilityRuntimeOffsetMinutes(),
|
|
3524
3791
|
rollOverEnd: false
|
|
3525
3792
|
});
|
|
3526
3793
|
if (!range) return [];
|
|
@@ -3528,7 +3795,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3528
3795
|
resourceId: resourceId,
|
|
3529
3796
|
startAt: range.startAt,
|
|
3530
3797
|
endAt: range.endAt,
|
|
3531
|
-
pax: Math.max(1, Number((
|
|
3798
|
+
pax: Math.max(1, Number((_ref48 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref48 !== void 0 ? _ref48 : 1) || 1),
|
|
3532
3799
|
source: 'cart',
|
|
3533
3800
|
scheduleEventId: scheduleEventId,
|
|
3534
3801
|
bookingUid: bookingUid || undefined,
|
|
@@ -3538,7 +3805,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3538
3805
|
resource: resource
|
|
3539
3806
|
}
|
|
3540
3807
|
};
|
|
3541
|
-
return
|
|
3808
|
+
return _this6.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
|
|
3542
3809
|
});
|
|
3543
3810
|
});
|
|
3544
3811
|
}
|
|
@@ -3605,16 +3872,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3605
3872
|
}, {
|
|
3606
3873
|
key: "assertContextualQueryFreshness",
|
|
3607
3874
|
value: function assertContextualQueryFreshness(context, request) {
|
|
3608
|
-
var
|
|
3875
|
+
var _this7 = this;
|
|
3609
3876
|
if (request.target === 'time') {
|
|
3610
3877
|
request.candidates.forEach(function (candidate) {
|
|
3611
|
-
|
|
3878
|
+
_this7.assertAvailabilityCandidateFreshness(context, candidate);
|
|
3612
3879
|
});
|
|
3613
3880
|
return;
|
|
3614
3881
|
}
|
|
3615
3882
|
if (request.target === 'resource') {
|
|
3616
3883
|
request.selectedRanges.forEach(function (candidate) {
|
|
3617
|
-
|
|
3884
|
+
_this7.assertAvailabilityCandidateFreshness(context, candidate);
|
|
3618
3885
|
});
|
|
3619
3886
|
}
|
|
3620
3887
|
}
|
|
@@ -3661,8 +3928,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3661
3928
|
}, {
|
|
3662
3929
|
key: "buildAvailabilityProjectionSnapshot",
|
|
3663
3930
|
value: function () {
|
|
3664
|
-
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3665
|
-
var
|
|
3931
|
+
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3932
|
+
var _this8 = this;
|
|
3666
3933
|
var options,
|
|
3667
3934
|
normalizedPrepareParams,
|
|
3668
3935
|
timezoneLabel,
|
|
@@ -3683,11 +3950,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3683
3950
|
durationCandidateAnchorAt,
|
|
3684
3951
|
orderRevision,
|
|
3685
3952
|
projection,
|
|
3686
|
-
|
|
3687
|
-
return _regeneratorRuntime().wrap(function
|
|
3688
|
-
while (1) switch (
|
|
3953
|
+
_args32 = arguments;
|
|
3954
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3955
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3689
3956
|
case 0:
|
|
3690
|
-
options =
|
|
3957
|
+
options = _args32.length > 1 && _args32[1] !== undefined ? _args32[1] : {};
|
|
3691
3958
|
normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
3692
3959
|
timezoneLabel = String(normalizedPrepareParams.timezone);
|
|
3693
3960
|
dateRange = normalizedPrepareParams.dateRange;
|
|
@@ -3701,15 +3968,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3701
3968
|
scheduleList: scheduleList,
|
|
3702
3969
|
businessHours: businessHours
|
|
3703
3970
|
});
|
|
3704
|
-
|
|
3971
|
+
_context32.next = 11;
|
|
3705
3972
|
return this.loadAvailabilityProducts({
|
|
3706
3973
|
prepare: normalizedPrepareParams,
|
|
3707
3974
|
dateRange: dateRange,
|
|
3708
3975
|
scheduleList: scheduleList
|
|
3709
3976
|
});
|
|
3710
3977
|
case 11:
|
|
3711
|
-
products =
|
|
3712
|
-
|
|
3978
|
+
products = _context32.sent;
|
|
3979
|
+
_context32.next = 14;
|
|
3713
3980
|
return this.loadAvailabilityResources({
|
|
3714
3981
|
timezone: timezoneLabel,
|
|
3715
3982
|
dateRange: dateRange,
|
|
@@ -3721,14 +3988,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3721
3988
|
fallbackResources: options.fallbackResources
|
|
3722
3989
|
});
|
|
3723
3990
|
case 14:
|
|
3724
|
-
loadedResources =
|
|
3991
|
+
loadedResources = _context32.sent;
|
|
3725
3992
|
tempOrder = this.getTempOrder();
|
|
3726
3993
|
exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
|
|
3727
3994
|
injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
|
|
3728
3995
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3729
3996
|
startAt: occupancy.startAt,
|
|
3730
3997
|
endAt: occupancy.endAt,
|
|
3731
|
-
fixedOffsetMinutes:
|
|
3998
|
+
fixedOffsetMinutes: _this8.getAvailabilityRuntimeOffsetMinutes(),
|
|
3732
3999
|
rollOverEnd: false
|
|
3733
4000
|
});
|
|
3734
4001
|
if (!range) return [];
|
|
@@ -3738,7 +4005,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3738
4005
|
})];
|
|
3739
4006
|
});
|
|
3740
4007
|
remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
|
|
3741
|
-
return !
|
|
4008
|
+
return !_this8.occupancyIsExcluded(occupancy, exclusions);
|
|
3742
4009
|
});
|
|
3743
4010
|
cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
|
|
3744
4011
|
preparedAt = this.getAvailabilityRuntimeDateTime();
|
|
@@ -3767,18 +4034,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3767
4034
|
prepareParams: normalizedPrepareParams,
|
|
3768
4035
|
durationCandidateAnchorAt: durationCandidateAnchorAt
|
|
3769
4036
|
});
|
|
3770
|
-
return
|
|
4037
|
+
return _context32.abrupt("return", {
|
|
3771
4038
|
projection: projection,
|
|
3772
4039
|
prepareParams: normalizedPrepareParams,
|
|
3773
4040
|
orderRevision: orderRevision
|
|
3774
4041
|
});
|
|
3775
4042
|
case 26:
|
|
3776
4043
|
case "end":
|
|
3777
|
-
return
|
|
4044
|
+
return _context32.stop();
|
|
3778
4045
|
}
|
|
3779
|
-
},
|
|
4046
|
+
}, _callee32, this);
|
|
3780
4047
|
}));
|
|
3781
|
-
function buildAvailabilityProjectionSnapshot(
|
|
4048
|
+
function buildAvailabilityProjectionSnapshot(_x23) {
|
|
3782
4049
|
return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
|
|
3783
4050
|
}
|
|
3784
4051
|
return buildAvailabilityProjectionSnapshot;
|
|
@@ -3786,10 +4053,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3786
4053
|
}, {
|
|
3787
4054
|
key: "getSharedPreparedAvailabilitySnapshot",
|
|
3788
4055
|
value: function () {
|
|
3789
|
-
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4056
|
+
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
3790
4057
|
var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
|
|
3791
|
-
return _regeneratorRuntime().wrap(function
|
|
3792
|
-
while (1) switch (
|
|
4058
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
4059
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3793
4060
|
case 0:
|
|
3794
4061
|
lifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
3795
4062
|
normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
@@ -3808,15 +4075,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3808
4075
|
}
|
|
3809
4076
|
})) : this.buildAvailabilityPrepareKey(normalizedParams);
|
|
3810
4077
|
if (!hasRawInputs) {
|
|
3811
|
-
|
|
4078
|
+
_context33.next = 11;
|
|
3812
4079
|
break;
|
|
3813
4080
|
}
|
|
3814
|
-
|
|
4081
|
+
_context33.next = 7;
|
|
3815
4082
|
return this.buildAvailabilityProjectionSnapshot(normalizedParams);
|
|
3816
4083
|
case 7:
|
|
3817
|
-
snapshot =
|
|
4084
|
+
snapshot = _context33.sent;
|
|
3818
4085
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
3819
|
-
|
|
4086
|
+
_context33.next = 10;
|
|
3820
4087
|
break;
|
|
3821
4088
|
}
|
|
3822
4089
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -3825,7 +4092,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3825
4092
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
3826
4093
|
});
|
|
3827
4094
|
case 10:
|
|
3828
|
-
return
|
|
4095
|
+
return _context33.abrupt("return", {
|
|
3829
4096
|
prepareKey: prepareKey,
|
|
3830
4097
|
snapshot: snapshot
|
|
3831
4098
|
});
|
|
@@ -3839,13 +4106,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3839
4106
|
promise: promise
|
|
3840
4107
|
});
|
|
3841
4108
|
}
|
|
3842
|
-
|
|
3843
|
-
|
|
4109
|
+
_context33.prev = 14;
|
|
4110
|
+
_context33.next = 17;
|
|
3844
4111
|
return promise;
|
|
3845
4112
|
case 17:
|
|
3846
|
-
_snapshot =
|
|
4113
|
+
_snapshot = _context33.sent;
|
|
3847
4114
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
3848
|
-
|
|
4115
|
+
_context33.next = 20;
|
|
3849
4116
|
break;
|
|
3850
4117
|
}
|
|
3851
4118
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -3854,24 +4121,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3854
4121
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
3855
4122
|
});
|
|
3856
4123
|
case 20:
|
|
3857
|
-
return
|
|
4124
|
+
return _context33.abrupt("return", {
|
|
3858
4125
|
prepareKey: prepareKey,
|
|
3859
4126
|
snapshot: _snapshot
|
|
3860
4127
|
});
|
|
3861
4128
|
case 21:
|
|
3862
|
-
|
|
4129
|
+
_context33.prev = 21;
|
|
3863
4130
|
current = this.availabilityPrepareInFlight.get(prepareKey);
|
|
3864
4131
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
3865
4132
|
this.availabilityPrepareInFlight.delete(prepareKey);
|
|
3866
4133
|
}
|
|
3867
|
-
return
|
|
4134
|
+
return _context33.finish(21);
|
|
3868
4135
|
case 25:
|
|
3869
4136
|
case "end":
|
|
3870
|
-
return
|
|
4137
|
+
return _context33.stop();
|
|
3871
4138
|
}
|
|
3872
|
-
},
|
|
4139
|
+
}, _callee33, this, [[14,, 21, 25]]);
|
|
3873
4140
|
}));
|
|
3874
|
-
function getSharedPreparedAvailabilitySnapshot(
|
|
4141
|
+
function getSharedPreparedAvailabilitySnapshot(_x24) {
|
|
3875
4142
|
return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
|
|
3876
4143
|
}
|
|
3877
4144
|
return getSharedPreparedAvailabilitySnapshot;
|
|
@@ -3879,51 +4146,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3879
4146
|
}, {
|
|
3880
4147
|
key: "refreshAvailabilityContextProjection",
|
|
3881
4148
|
value: function () {
|
|
3882
|
-
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3883
|
-
var
|
|
4149
|
+
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
4150
|
+
var _this9 = this;
|
|
3884
4151
|
var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
|
|
3885
|
-
return _regeneratorRuntime().wrap(function
|
|
3886
|
-
while (1) switch (
|
|
4152
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
4153
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3887
4154
|
case 0:
|
|
3888
4155
|
existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
3889
4156
|
if (!existingInFlight) {
|
|
3890
|
-
|
|
4157
|
+
_context35.next = 5;
|
|
3891
4158
|
break;
|
|
3892
4159
|
}
|
|
3893
|
-
|
|
4160
|
+
_context35.next = 4;
|
|
3894
4161
|
return existingInFlight;
|
|
3895
4162
|
case 4:
|
|
3896
|
-
return
|
|
4163
|
+
return _context35.abrupt("return", _context35.sent);
|
|
3897
4164
|
case 5:
|
|
3898
4165
|
context = this.getAvailabilityContextEntry(params.contextId);
|
|
3899
4166
|
expectedVersion = context.activeVersion;
|
|
3900
4167
|
expectedRefreshNonce = context.refreshNonce;
|
|
3901
4168
|
expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
3902
|
-
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4169
|
+
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
3903
4170
|
var snapshot, currentContext, projectionEntry;
|
|
3904
|
-
return _regeneratorRuntime().wrap(function
|
|
3905
|
-
while (1) switch (
|
|
4171
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
4172
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3906
4173
|
case 0:
|
|
3907
|
-
|
|
3908
|
-
return
|
|
4174
|
+
_context34.next = 2;
|
|
4175
|
+
return _this9.buildAvailabilityProjectionSnapshot(_this9.cloneAvailabilityPrepareParams(context.prepareParams), {
|
|
3909
4176
|
durationCandidateAnchorAt: context.durationCandidateAnchorAt
|
|
3910
4177
|
});
|
|
3911
4178
|
case 2:
|
|
3912
|
-
snapshot =
|
|
3913
|
-
currentContext =
|
|
4179
|
+
snapshot = _context34.sent;
|
|
4180
|
+
currentContext = _this9.availabilityContextRegistry.get(params.contextId);
|
|
3914
4181
|
if (currentContext) {
|
|
3915
|
-
|
|
4182
|
+
_context34.next = 6;
|
|
3916
4183
|
break;
|
|
3917
4184
|
}
|
|
3918
|
-
return
|
|
4185
|
+
return _context34.abrupt("return", null);
|
|
3919
4186
|
case 6:
|
|
3920
|
-
if (!(expectedLifecycleGeneration !==
|
|
3921
|
-
|
|
4187
|
+
if (!(expectedLifecycleGeneration !== _this9.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
|
|
4188
|
+
_context34.next = 8;
|
|
3922
4189
|
break;
|
|
3923
4190
|
}
|
|
3924
|
-
return
|
|
4191
|
+
return _context34.abrupt("return", null);
|
|
3925
4192
|
case 8:
|
|
3926
|
-
projectionEntry =
|
|
4193
|
+
projectionEntry = _this9.storeAvailabilityProjectionEntry({
|
|
3927
4194
|
contextId: currentContext.contextId,
|
|
3928
4195
|
prepareParams: snapshot.prepareParams,
|
|
3929
4196
|
prepareKey: currentContext.prepareKey,
|
|
@@ -3931,8 +4198,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3931
4198
|
orderRevision: snapshot.orderRevision,
|
|
3932
4199
|
incrementVersion: true
|
|
3933
4200
|
});
|
|
3934
|
-
|
|
3935
|
-
return
|
|
4201
|
+
_context34.next = 11;
|
|
4202
|
+
return _this9.emitAvailabilityDiagnostic({
|
|
3936
4203
|
action: 'refresh',
|
|
3937
4204
|
contextId: currentContext.contextId,
|
|
3938
4205
|
contextVersion: projectionEntry.contextVersion,
|
|
@@ -3943,33 +4210,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3943
4210
|
reason: params.reason
|
|
3944
4211
|
});
|
|
3945
4212
|
case 11:
|
|
3946
|
-
return
|
|
4213
|
+
return _context34.abrupt("return", projectionEntry);
|
|
3947
4214
|
case 12:
|
|
3948
4215
|
case "end":
|
|
3949
|
-
return
|
|
4216
|
+
return _context34.stop();
|
|
3950
4217
|
}
|
|
3951
|
-
},
|
|
4218
|
+
}, _callee34);
|
|
3952
4219
|
}))();
|
|
3953
4220
|
this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
|
|
3954
|
-
|
|
3955
|
-
|
|
4221
|
+
_context35.prev = 11;
|
|
4222
|
+
_context35.next = 14;
|
|
3956
4223
|
return refreshPromise;
|
|
3957
4224
|
case 14:
|
|
3958
|
-
return
|
|
4225
|
+
return _context35.abrupt("return", _context35.sent);
|
|
3959
4226
|
case 15:
|
|
3960
|
-
|
|
4227
|
+
_context35.prev = 15;
|
|
3961
4228
|
current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
3962
4229
|
if (current === refreshPromise) {
|
|
3963
4230
|
this.availabilityProjectionRefreshInFlight.delete(params.contextId);
|
|
3964
4231
|
}
|
|
3965
|
-
return
|
|
4232
|
+
return _context35.finish(15);
|
|
3966
4233
|
case 19:
|
|
3967
4234
|
case "end":
|
|
3968
|
-
return
|
|
4235
|
+
return _context35.stop();
|
|
3969
4236
|
}
|
|
3970
|
-
},
|
|
4237
|
+
}, _callee35, this, [[11,, 15, 19]]);
|
|
3971
4238
|
}));
|
|
3972
|
-
function refreshAvailabilityContextProjection(
|
|
4239
|
+
function refreshAvailabilityContextProjection(_x25) {
|
|
3973
4240
|
return _refreshAvailabilityContextProjection.apply(this, arguments);
|
|
3974
4241
|
}
|
|
3975
4242
|
return refreshAvailabilityContextProjection;
|
|
@@ -3977,53 +4244,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3977
4244
|
}, {
|
|
3978
4245
|
key: "ensureAvailabilityContextProjection",
|
|
3979
4246
|
value: function () {
|
|
3980
|
-
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4247
|
+
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(contextId, reason) {
|
|
3981
4248
|
var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
|
|
3982
|
-
return _regeneratorRuntime().wrap(function
|
|
3983
|
-
while (1) switch (
|
|
4249
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
4250
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3984
4251
|
case 0:
|
|
3985
4252
|
retries = 0;
|
|
3986
4253
|
case 1:
|
|
3987
4254
|
if (!(retries < 3)) {
|
|
3988
|
-
|
|
4255
|
+
_context36.next = 19;
|
|
3989
4256
|
break;
|
|
3990
4257
|
}
|
|
3991
4258
|
context = this.getAvailabilityContextEntry(contextId);
|
|
3992
4259
|
currentOrderRevision = this.getCurrentOrderRevision();
|
|
3993
4260
|
projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
|
|
3994
4261
|
if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
|
|
3995
|
-
|
|
4262
|
+
_context36.next = 7;
|
|
3996
4263
|
break;
|
|
3997
4264
|
}
|
|
3998
|
-
return
|
|
4265
|
+
return _context36.abrupt("return", {
|
|
3999
4266
|
context: context,
|
|
4000
4267
|
projectionEntry: projectionEntry,
|
|
4001
4268
|
refreshed: false
|
|
4002
4269
|
});
|
|
4003
4270
|
case 7:
|
|
4004
|
-
|
|
4271
|
+
_context36.next = 9;
|
|
4005
4272
|
return this.refreshAvailabilityContextProjection({
|
|
4006
4273
|
contextId: contextId,
|
|
4007
4274
|
reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
|
|
4008
4275
|
previousOrderRevision: context.lastKnownOrderRevision
|
|
4009
4276
|
});
|
|
4010
4277
|
case 9:
|
|
4011
|
-
refreshedProjectionEntry =
|
|
4278
|
+
refreshedProjectionEntry = _context36.sent;
|
|
4012
4279
|
if (refreshedProjectionEntry) {
|
|
4013
|
-
|
|
4280
|
+
_context36.next = 13;
|
|
4014
4281
|
break;
|
|
4015
4282
|
}
|
|
4016
4283
|
retries += 1;
|
|
4017
|
-
return
|
|
4284
|
+
return _context36.abrupt("continue", 1);
|
|
4018
4285
|
case 13:
|
|
4019
4286
|
if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
4020
|
-
|
|
4287
|
+
_context36.next = 16;
|
|
4021
4288
|
break;
|
|
4022
4289
|
}
|
|
4023
4290
|
retries += 1;
|
|
4024
|
-
return
|
|
4291
|
+
return _context36.abrupt("continue", 1);
|
|
4025
4292
|
case 16:
|
|
4026
|
-
return
|
|
4293
|
+
return _context36.abrupt("return", {
|
|
4027
4294
|
context: this.getAvailabilityContextEntry(contextId),
|
|
4028
4295
|
projectionEntry: refreshedProjectionEntry,
|
|
4029
4296
|
refreshed: true
|
|
@@ -4035,11 +4302,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4035
4302
|
});
|
|
4036
4303
|
case 20:
|
|
4037
4304
|
case "end":
|
|
4038
|
-
return
|
|
4305
|
+
return _context36.stop();
|
|
4039
4306
|
}
|
|
4040
|
-
},
|
|
4307
|
+
}, _callee36, this);
|
|
4041
4308
|
}));
|
|
4042
|
-
function ensureAvailabilityContextProjection(
|
|
4309
|
+
function ensureAvailabilityContextProjection(_x26, _x27) {
|
|
4043
4310
|
return _ensureAvailabilityContextProjection.apply(this, arguments);
|
|
4044
4311
|
}
|
|
4045
4312
|
return ensureAvailabilityContextProjection;
|
|
@@ -4047,18 +4314,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4047
4314
|
}, {
|
|
4048
4315
|
key: "tryAcquireAvailabilityCommitLock",
|
|
4049
4316
|
value: function () {
|
|
4050
|
-
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4317
|
+
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(contextId) {
|
|
4051
4318
|
var _currentContext$activ;
|
|
4052
4319
|
var _waitingContext$activ, waitingContext, currentContext;
|
|
4053
|
-
return _regeneratorRuntime().wrap(function
|
|
4054
|
-
while (1) switch (
|
|
4320
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
4321
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
4055
4322
|
case 0:
|
|
4056
4323
|
if (!this.availabilityCommitLocks.has(contextId)) {
|
|
4057
|
-
|
|
4324
|
+
_context37.next = 5;
|
|
4058
4325
|
break;
|
|
4059
4326
|
}
|
|
4060
4327
|
waitingContext = this.availabilityContextRegistry.get(contextId);
|
|
4061
|
-
|
|
4328
|
+
_context37.next = 4;
|
|
4062
4329
|
return this.emitAvailabilityDiagnostic({
|
|
4063
4330
|
action: 'commit_lock_wait',
|
|
4064
4331
|
contextId: contextId,
|
|
@@ -4075,7 +4342,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4075
4342
|
case 5:
|
|
4076
4343
|
this.availabilityCommitLocks.add(contextId);
|
|
4077
4344
|
currentContext = this.availabilityContextRegistry.get(contextId);
|
|
4078
|
-
|
|
4345
|
+
_context37.next = 9;
|
|
4079
4346
|
return this.emitAvailabilityDiagnostic({
|
|
4080
4347
|
action: 'commit_lock_acquired',
|
|
4081
4348
|
contextId: contextId,
|
|
@@ -4087,11 +4354,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4087
4354
|
});
|
|
4088
4355
|
case 9:
|
|
4089
4356
|
case "end":
|
|
4090
|
-
return
|
|
4357
|
+
return _context37.stop();
|
|
4091
4358
|
}
|
|
4092
|
-
},
|
|
4359
|
+
}, _callee37, this);
|
|
4093
4360
|
}));
|
|
4094
|
-
function tryAcquireAvailabilityCommitLock(
|
|
4361
|
+
function tryAcquireAvailabilityCommitLock(_x28) {
|
|
4095
4362
|
return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
|
|
4096
4363
|
}
|
|
4097
4364
|
return tryAcquireAvailabilityCommitLock;
|
|
@@ -4099,15 +4366,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4099
4366
|
}, {
|
|
4100
4367
|
key: "releaseAvailabilityCommitLock",
|
|
4101
4368
|
value: function () {
|
|
4102
|
-
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4369
|
+
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(contextId) {
|
|
4103
4370
|
var _releasedContext$acti;
|
|
4104
4371
|
var releasedContext;
|
|
4105
|
-
return _regeneratorRuntime().wrap(function
|
|
4106
|
-
while (1) switch (
|
|
4372
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
4373
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
4107
4374
|
case 0:
|
|
4108
4375
|
this.availabilityCommitLocks.delete(contextId);
|
|
4109
4376
|
releasedContext = this.availabilityContextRegistry.get(contextId);
|
|
4110
|
-
|
|
4377
|
+
_context38.next = 4;
|
|
4111
4378
|
return this.emitAvailabilityDiagnostic({
|
|
4112
4379
|
action: 'commit_lock_released',
|
|
4113
4380
|
contextId: contextId,
|
|
@@ -4119,11 +4386,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4119
4386
|
});
|
|
4120
4387
|
case 4:
|
|
4121
4388
|
case "end":
|
|
4122
|
-
return
|
|
4389
|
+
return _context38.stop();
|
|
4123
4390
|
}
|
|
4124
|
-
},
|
|
4391
|
+
}, _callee38, this);
|
|
4125
4392
|
}));
|
|
4126
|
-
function releaseAvailabilityCommitLock(
|
|
4393
|
+
function releaseAvailabilityCommitLock(_x29) {
|
|
4127
4394
|
return _releaseAvailabilityCommitLock.apply(this, arguments);
|
|
4128
4395
|
}
|
|
4129
4396
|
return releaseAvailabilityCommitLock;
|
|
@@ -4131,20 +4398,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4131
4398
|
}, {
|
|
4132
4399
|
key: "prepareAvailabilityProjection",
|
|
4133
4400
|
value: (function () {
|
|
4134
|
-
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4401
|
+
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
4135
4402
|
var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
|
|
4136
|
-
return _regeneratorRuntime().wrap(function
|
|
4137
|
-
while (1) switch (
|
|
4403
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4404
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
4138
4405
|
case 0:
|
|
4139
4406
|
this.assertAvailabilityPrepareParams(params);
|
|
4140
|
-
|
|
4407
|
+
_context39.next = 3;
|
|
4141
4408
|
return this.resolveAvailabilityPrepareDefaults(params);
|
|
4142
4409
|
case 3:
|
|
4143
|
-
paramsWithDefaults =
|
|
4144
|
-
|
|
4410
|
+
paramsWithDefaults = _context39.sent;
|
|
4411
|
+
_context39.next = 6;
|
|
4145
4412
|
return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
|
|
4146
4413
|
case 6:
|
|
4147
|
-
_yield$this$getShared =
|
|
4414
|
+
_yield$this$getShared = _context39.sent;
|
|
4148
4415
|
prepareKey = _yield$this$getShared.prepareKey;
|
|
4149
4416
|
snapshot = _yield$this$getShared.snapshot;
|
|
4150
4417
|
contextId = this.createAvailabilityContextId();
|
|
@@ -4165,7 +4432,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4165
4432
|
refreshed: false,
|
|
4166
4433
|
reason: 'prepare'
|
|
4167
4434
|
};
|
|
4168
|
-
|
|
4435
|
+
_context39.next = 16;
|
|
4169
4436
|
return this.emitAvailabilityDiagnostic({
|
|
4170
4437
|
action: 'prepare',
|
|
4171
4438
|
contextId: contextId,
|
|
@@ -4176,17 +4443,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4176
4443
|
reason: 'prepare'
|
|
4177
4444
|
});
|
|
4178
4445
|
case 16:
|
|
4179
|
-
|
|
4446
|
+
_context39.next = 18;
|
|
4180
4447
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
|
|
4181
4448
|
case 18:
|
|
4182
|
-
return
|
|
4449
|
+
return _context39.abrupt("return", handle);
|
|
4183
4450
|
case 19:
|
|
4184
4451
|
case "end":
|
|
4185
|
-
return
|
|
4452
|
+
return _context39.stop();
|
|
4186
4453
|
}
|
|
4187
|
-
},
|
|
4454
|
+
}, _callee39, this);
|
|
4188
4455
|
}));
|
|
4189
|
-
function prepareAvailabilityProjection(
|
|
4456
|
+
function prepareAvailabilityProjection(_x30) {
|
|
4190
4457
|
return _prepareAvailabilityProjection.apply(this, arguments);
|
|
4191
4458
|
}
|
|
4192
4459
|
return prepareAvailabilityProjection;
|
|
@@ -4194,39 +4461,47 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4194
4461
|
}, {
|
|
4195
4462
|
key: "getProductTimeRanges",
|
|
4196
4463
|
value: (function () {
|
|
4197
|
-
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4198
|
-
var
|
|
4464
|
+
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(contextId) {
|
|
4465
|
+
var _this$otherParams$pla,
|
|
4466
|
+
_this$otherParams23,
|
|
4467
|
+
_this10 = this;
|
|
4199
4468
|
var request,
|
|
4200
4469
|
_yield$this$ensureAva,
|
|
4201
4470
|
context,
|
|
4202
4471
|
projectionEntry,
|
|
4203
4472
|
contextVersion,
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4473
|
+
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
4474
|
+
_args40 = arguments;
|
|
4475
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4476
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
4207
4477
|
case 0:
|
|
4208
|
-
request =
|
|
4209
|
-
|
|
4478
|
+
request = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {};
|
|
4479
|
+
_context40.next = 3;
|
|
4210
4480
|
return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
|
|
4211
4481
|
case 3:
|
|
4212
|
-
_yield$this$ensureAva =
|
|
4482
|
+
_yield$this$ensureAva = _context40.sent;
|
|
4213
4483
|
context = _yield$this$ensureAva.context;
|
|
4214
4484
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
4215
4485
|
contextVersion = context.activeVersion;
|
|
4216
|
-
|
|
4486
|
+
allowOutsideOperatingHoursForRequestedStartTimes = String((_this$otherParams$pla = (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase() === 'pos' && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
4487
|
+
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
4488
|
+
});
|
|
4489
|
+
return _context40.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
|
|
4490
|
+
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
4491
|
+
} : {})).map(function (group) {
|
|
4217
4492
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
4218
4493
|
ranges: group.ranges.map(function (candidate) {
|
|
4219
|
-
return
|
|
4494
|
+
return _this10.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
|
|
4220
4495
|
})
|
|
4221
4496
|
});
|
|
4222
4497
|
}));
|
|
4223
|
-
case
|
|
4498
|
+
case 9:
|
|
4224
4499
|
case "end":
|
|
4225
|
-
return
|
|
4500
|
+
return _context40.stop();
|
|
4226
4501
|
}
|
|
4227
|
-
},
|
|
4502
|
+
}, _callee40, this);
|
|
4228
4503
|
}));
|
|
4229
|
-
function getProductTimeRanges(
|
|
4504
|
+
function getProductTimeRanges(_x31) {
|
|
4230
4505
|
return _getProductTimeRanges.apply(this, arguments);
|
|
4231
4506
|
}
|
|
4232
4507
|
return getProductTimeRanges;
|
|
@@ -4234,15 +4509,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4234
4509
|
}, {
|
|
4235
4510
|
key: "queryBookingAvailability",
|
|
4236
4511
|
value: (function () {
|
|
4237
|
-
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4512
|
+
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(contextId, request) {
|
|
4238
4513
|
var _yield$this$ensureAva2, context, projectionEntry, refreshed, result, contextVersion, contextualResult;
|
|
4239
|
-
return _regeneratorRuntime().wrap(function
|
|
4240
|
-
while (1) switch (
|
|
4514
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4515
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
4241
4516
|
case 0:
|
|
4242
|
-
|
|
4517
|
+
_context41.next = 2;
|
|
4243
4518
|
return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
|
|
4244
4519
|
case 2:
|
|
4245
|
-
_yield$this$ensureAva2 =
|
|
4520
|
+
_yield$this$ensureAva2 = _context41.sent;
|
|
4246
4521
|
context = _yield$this$ensureAva2.context;
|
|
4247
4522
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
4248
4523
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
@@ -4274,18 +4549,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4274
4549
|
});
|
|
4275
4550
|
})
|
|
4276
4551
|
}) : result;
|
|
4277
|
-
return
|
|
4552
|
+
return _context41.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
|
|
4278
4553
|
contextId: context.contextId,
|
|
4279
4554
|
contextVersion: contextVersion,
|
|
4280
4555
|
refreshed: refreshed
|
|
4281
4556
|
}));
|
|
4282
4557
|
case 11:
|
|
4283
4558
|
case "end":
|
|
4284
|
-
return
|
|
4559
|
+
return _context41.stop();
|
|
4285
4560
|
}
|
|
4286
|
-
},
|
|
4561
|
+
}, _callee41, this);
|
|
4287
4562
|
}));
|
|
4288
|
-
function queryBookingAvailability(
|
|
4563
|
+
function queryBookingAvailability(_x32, _x33) {
|
|
4289
4564
|
return _queryBookingAvailability.apply(this, arguments);
|
|
4290
4565
|
}
|
|
4291
4566
|
return queryBookingAvailability;
|
|
@@ -4342,9 +4617,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4342
4617
|
}, {
|
|
4343
4618
|
key: "findLinkedBooking",
|
|
4344
4619
|
value: function findLinkedBooking(product) {
|
|
4345
|
-
var
|
|
4620
|
+
var _ref50, _product$booking_uid3, _product$metadata6, _this$getTempOrder3;
|
|
4346
4621
|
var productUid = getProductLineUid(product);
|
|
4347
|
-
var bookingUid = String((
|
|
4622
|
+
var bookingUid = String((_ref50 = (_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 && _ref50 !== void 0 ? _ref50 : '');
|
|
4348
4623
|
return (((_this$getTempOrder3 = this.getTempOrder()) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.bookings) || []).find(function (booking) {
|
|
4349
4624
|
var _booking$product_uid3;
|
|
4350
4625
|
return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
|
|
@@ -4355,27 +4630,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4355
4630
|
}, {
|
|
4356
4631
|
key: "commitAvailabilitySelection",
|
|
4357
4632
|
value: (function () {
|
|
4358
|
-
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4359
|
-
var normalizedContextId, _params$bookingCount,
|
|
4360
|
-
return _regeneratorRuntime().wrap(function
|
|
4361
|
-
while (1) switch (
|
|
4633
|
+
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(contextId, params) {
|
|
4634
|
+
var normalizedContextId, _params$bookingCount, _ref51, _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$pla2, _this$otherParams24, _ref52, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref53, _ref54, _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, _ref55, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _params$salesNotes, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
|
|
4635
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4636
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4362
4637
|
case 0:
|
|
4363
4638
|
normalizedContextId = String(contextId || '').trim();
|
|
4364
4639
|
if (normalizedContextId) {
|
|
4365
|
-
|
|
4640
|
+
_context42.next = 3;
|
|
4366
4641
|
break;
|
|
4367
4642
|
}
|
|
4368
4643
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
|
|
4369
4644
|
candidate: params.candidate
|
|
4370
4645
|
});
|
|
4371
4646
|
case 3:
|
|
4372
|
-
|
|
4647
|
+
_context42.next = 5;
|
|
4373
4648
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
4374
4649
|
case 5:
|
|
4375
|
-
|
|
4650
|
+
_context42.prev = 5;
|
|
4376
4651
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
4377
4652
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
4378
|
-
|
|
4653
|
+
_context42.next = 9;
|
|
4379
4654
|
break;
|
|
4380
4655
|
}
|
|
4381
4656
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
@@ -4383,16 +4658,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4383
4658
|
});
|
|
4384
4659
|
case 9:
|
|
4385
4660
|
if (!(params.mode === 'edit' && bookingCount !== 1)) {
|
|
4386
|
-
|
|
4661
|
+
_context42.next = 11;
|
|
4387
4662
|
break;
|
|
4388
4663
|
}
|
|
4389
4664
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
4390
4665
|
bookingCount: bookingCount
|
|
4391
4666
|
});
|
|
4392
4667
|
case 11:
|
|
4393
|
-
orderProductQuantity = (
|
|
4668
|
+
orderProductQuantity = (_ref51 = (_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 && _ref51 !== void 0 ? _ref51 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
|
|
4394
4669
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
4395
|
-
|
|
4670
|
+
_context42.next = 14;
|
|
4396
4671
|
break;
|
|
4397
4672
|
}
|
|
4398
4673
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
@@ -4402,22 +4677,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4402
4677
|
case 14:
|
|
4403
4678
|
partySize = Number(params.partySize);
|
|
4404
4679
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
4405
|
-
|
|
4680
|
+
_context42.next = 17;
|
|
4406
4681
|
break;
|
|
4407
4682
|
}
|
|
4408
4683
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
4409
4684
|
partySize: params.partySize
|
|
4410
4685
|
});
|
|
4411
4686
|
case 17:
|
|
4412
|
-
|
|
4687
|
+
_context42.next = 19;
|
|
4413
4688
|
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
4414
4689
|
case 19:
|
|
4415
|
-
_yield$this$ensureAva3 =
|
|
4690
|
+
_yield$this$ensureAva3 = _context42.sent;
|
|
4416
4691
|
context = _yield$this$ensureAva3.context;
|
|
4417
4692
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
4418
4693
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
4419
4694
|
if (!refreshed) {
|
|
4420
|
-
|
|
4695
|
+
_context42.next = 25;
|
|
4421
4696
|
break;
|
|
4422
4697
|
}
|
|
4423
4698
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -4428,11 +4703,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4428
4703
|
case 25:
|
|
4429
4704
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
4430
4705
|
if (!(params.mode === 'edit')) {
|
|
4431
|
-
|
|
4706
|
+
_context42.next = 31;
|
|
4432
4707
|
break;
|
|
4433
4708
|
}
|
|
4434
4709
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
4435
|
-
|
|
4710
|
+
_context42.next = 29;
|
|
4436
4711
|
break;
|
|
4437
4712
|
}
|
|
4438
4713
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -4441,11 +4716,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4441
4716
|
editingProductLineUids: boundEditingUids
|
|
4442
4717
|
});
|
|
4443
4718
|
case 29:
|
|
4444
|
-
|
|
4719
|
+
_context42.next = 33;
|
|
4445
4720
|
break;
|
|
4446
4721
|
case 31:
|
|
4447
4722
|
if (!(boundEditingUids.length > 0)) {
|
|
4448
|
-
|
|
4723
|
+
_context42.next = 33;
|
|
4449
4724
|
break;
|
|
4450
4725
|
}
|
|
4451
4726
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
@@ -4454,7 +4729,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4454
4729
|
});
|
|
4455
4730
|
case 33:
|
|
4456
4731
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
4457
|
-
|
|
4732
|
+
_context42.next = 35;
|
|
4458
4733
|
break;
|
|
4459
4734
|
}
|
|
4460
4735
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -4464,7 +4739,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4464
4739
|
});
|
|
4465
4740
|
case 35:
|
|
4466
4741
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
4467
|
-
|
|
4742
|
+
_context42.next = 37;
|
|
4468
4743
|
break;
|
|
4469
4744
|
}
|
|
4470
4745
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -4475,7 +4750,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4475
4750
|
});
|
|
4476
4751
|
case 37:
|
|
4477
4752
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
4478
|
-
|
|
4753
|
+
_context42.next = 39;
|
|
4479
4754
|
break;
|
|
4480
4755
|
}
|
|
4481
4756
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -4487,7 +4762,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4487
4762
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
4488
4763
|
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;
|
|
4489
4764
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
4490
|
-
|
|
4765
|
+
_context42.next = 43;
|
|
4491
4766
|
break;
|
|
4492
4767
|
}
|
|
4493
4768
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
@@ -4496,14 +4771,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4496
4771
|
});
|
|
4497
4772
|
case 43:
|
|
4498
4773
|
if (!(params.mode === 'edit' && !params.productLineUid)) {
|
|
4499
|
-
|
|
4774
|
+
_context42.next = 45;
|
|
4500
4775
|
break;
|
|
4501
4776
|
}
|
|
4502
4777
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
4503
4778
|
case 45:
|
|
4504
4779
|
editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
4505
4780
|
if (!(params.mode === 'edit' && !editingLine)) {
|
|
4506
|
-
|
|
4781
|
+
_context42.next = 48;
|
|
4507
4782
|
break;
|
|
4508
4783
|
}
|
|
4509
4784
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
@@ -4511,7 +4786,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4511
4786
|
});
|
|
4512
4787
|
case 48:
|
|
4513
4788
|
if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
4514
|
-
|
|
4789
|
+
_context42.next = 50;
|
|
4515
4790
|
break;
|
|
4516
4791
|
}
|
|
4517
4792
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -4521,7 +4796,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4521
4796
|
});
|
|
4522
4797
|
case 50:
|
|
4523
4798
|
if (Array.isArray(params.requirementSelections)) {
|
|
4524
|
-
|
|
4799
|
+
_context42.next = 52;
|
|
4525
4800
|
break;
|
|
4526
4801
|
}
|
|
4527
4802
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
@@ -4538,7 +4813,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4538
4813
|
};
|
|
4539
4814
|
prepareParams = baseProjection.meta.prepareParams;
|
|
4540
4815
|
if (prepareParams) {
|
|
4541
|
-
|
|
4816
|
+
_context42.next = 57;
|
|
4542
4817
|
break;
|
|
4543
4818
|
}
|
|
4544
4819
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
@@ -4550,7 +4825,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4550
4825
|
})),
|
|
4551
4826
|
includesInjectedRawOccupancies: true
|
|
4552
4827
|
};
|
|
4553
|
-
|
|
4828
|
+
_context42.next = 60;
|
|
4554
4829
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
4555
4830
|
editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
|
|
4556
4831
|
}), {
|
|
@@ -4559,13 +4834,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4559
4834
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
4560
4835
|
});
|
|
4561
4836
|
case 60:
|
|
4562
|
-
commitSnapshot =
|
|
4837
|
+
commitSnapshot = _context42.sent;
|
|
4563
4838
|
refreshedProjection = commitSnapshot.projection;
|
|
4564
4839
|
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 : ''))) {
|
|
4565
|
-
|
|
4840
|
+
_context42.next = 67;
|
|
4566
4841
|
break;
|
|
4567
4842
|
}
|
|
4568
|
-
|
|
4843
|
+
_context42.next = 65;
|
|
4569
4844
|
return this.refreshAvailabilityContextProjection({
|
|
4570
4845
|
contextId: normalizedContextId,
|
|
4571
4846
|
reason: 'commit_order_revision_changed',
|
|
@@ -4586,6 +4861,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4586
4861
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
4587
4862
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
4588
4863
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
4864
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla2 = (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
4589
4865
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
4590
4866
|
productIds: [params.candidate.productId],
|
|
4591
4867
|
dateRange: {
|
|
@@ -4594,16 +4870,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4594
4870
|
}
|
|
4595
4871
|
}, candidateDurationMinutes ? _objectSpread({
|
|
4596
4872
|
durationMinutesByProductId: _defineProperty({}, String(params.candidate.productId), candidateDurationMinutes)
|
|
4597
|
-
}, candidateStartTime ? {
|
|
4873
|
+
}, candidateStartTime ? _objectSpread({
|
|
4598
4874
|
durationStartTimesByProductId: _defineProperty({}, String(params.candidate.productId), [candidateStartTime])
|
|
4599
|
-
}
|
|
4875
|
+
}, allowPosAvailabilityOverride ? {
|
|
4876
|
+
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
4877
|
+
} : {}) : {}) : {})).flatMap(function (group) {
|
|
4600
4878
|
return group.ranges;
|
|
4601
4879
|
});
|
|
4602
4880
|
refreshedCandidateBase = refreshedRanges.find(function (candidate) {
|
|
4603
4881
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
4604
4882
|
});
|
|
4605
4883
|
if (refreshedCandidateBase) {
|
|
4606
|
-
|
|
4884
|
+
_context42.next = 75;
|
|
4607
4885
|
break;
|
|
4608
4886
|
}
|
|
4609
4887
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -4611,25 +4889,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4611
4889
|
candidate: params.candidate,
|
|
4612
4890
|
refreshedSnapshotId: refreshedProjection.meta.snapshotId
|
|
4613
4891
|
});
|
|
4614
|
-
case
|
|
4892
|
+
case 75:
|
|
4615
4893
|
product = refreshedProjection.products.find(function (item) {
|
|
4616
4894
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
4617
4895
|
});
|
|
4618
4896
|
if (product) {
|
|
4619
|
-
|
|
4897
|
+
_context42.next = 78;
|
|
4620
4898
|
break;
|
|
4621
4899
|
}
|
|
4622
4900
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
4623
4901
|
productId: refreshedCandidateBase.productId
|
|
4624
4902
|
});
|
|
4625
|
-
case
|
|
4903
|
+
case 78:
|
|
4626
4904
|
validation = validateAvailabilitySelection(refreshedProjection, {
|
|
4627
4905
|
candidate: refreshedCandidateBase,
|
|
4628
4906
|
requirementSelections: params.requirementSelections,
|
|
4629
4907
|
partySize: partySize,
|
|
4630
4908
|
bookingCount: bookingCount
|
|
4631
4909
|
});
|
|
4632
|
-
allowPosAvailabilityOverride = String((_this$otherParams$pla = (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase() === 'pos';
|
|
4633
4910
|
if (allowPosAvailabilityOverride && !validation.ok && validation.conflicts.every(function (conflict) {
|
|
4634
4911
|
return POS_OVERRIDABLE_AVAILABILITY_CONFLICT_CODES.has(conflict.code);
|
|
4635
4912
|
})) {
|
|
@@ -4651,7 +4928,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4651
4928
|
});
|
|
4652
4929
|
}
|
|
4653
4930
|
if (validation.ok) {
|
|
4654
|
-
|
|
4931
|
+
_context42.next = 83;
|
|
4655
4932
|
break;
|
|
4656
4933
|
}
|
|
4657
4934
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -4674,7 +4951,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4674
4951
|
incrementVersion: true
|
|
4675
4952
|
});
|
|
4676
4953
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
4677
|
-
|
|
4954
|
+
_context42.next = 87;
|
|
4678
4955
|
return this.emitAvailabilityDiagnostic({
|
|
4679
4956
|
action: 'refresh',
|
|
4680
4957
|
contextId: normalizedContextId,
|
|
@@ -4697,7 +4974,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4697
4974
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
4698
4975
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
4699
4976
|
if (!(params.mode === 'edit' && !existingBookingUid)) {
|
|
4700
|
-
|
|
4977
|
+
_context42.next = 93;
|
|
4701
4978
|
break;
|
|
4702
4979
|
}
|
|
4703
4980
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
@@ -4711,15 +4988,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4711
4988
|
product: product,
|
|
4712
4989
|
resources: refreshedProjection.resources,
|
|
4713
4990
|
bookingUid: existingBookingUid || undefined,
|
|
4714
|
-
holder: (
|
|
4715
|
-
holderIds: (
|
|
4991
|
+
holder: (_ref52 = (_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 && _ref52 !== void 0 ? _ref52 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
|
|
4992
|
+
holderIds: (_ref53 = (_ref54 = (_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 && _ref54 !== void 0 ? _ref54 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref53 !== void 0 ? _ref53 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
|
|
4716
4993
|
});
|
|
4717
4994
|
transformed = this.buildUnifiedOrderProduct(_objectSpread(_objectSpread({}, params.orderProduct), {}, {
|
|
4718
4995
|
num: bookingCount,
|
|
4719
4996
|
quantity: bookingCount
|
|
4720
4997
|
}), 'unified_booking_sales', product);
|
|
4721
4998
|
if (transformed) {
|
|
4722
|
-
|
|
4999
|
+
_context42.next = 98;
|
|
4723
5000
|
break;
|
|
4724
5001
|
}
|
|
4725
5002
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
@@ -4738,7 +5015,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4738
5015
|
productLineUids = [];
|
|
4739
5016
|
bookingUids = [];
|
|
4740
5017
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
4741
|
-
|
|
5018
|
+
_context42.next = 117;
|
|
4742
5019
|
break;
|
|
4743
5020
|
}
|
|
4744
5021
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -4748,10 +5025,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4748
5025
|
unique_identification_number: params.productLineUid,
|
|
4749
5026
|
booking_uid: existingBookingUid
|
|
4750
5027
|
});
|
|
4751
|
-
|
|
5028
|
+
_context42.next = 111;
|
|
4752
5029
|
return this.updateOrderProduct(_objectSpread(_objectSpread({
|
|
4753
5030
|
product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
|
|
4754
|
-
product_variant_id: (
|
|
5031
|
+
product_variant_id: (_ref55 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref55 !== void 0 ? _ref55 : 0,
|
|
4755
5032
|
unique_identification_number: params.productLineUid,
|
|
4756
5033
|
updates: transformed,
|
|
4757
5034
|
booking: booking
|
|
@@ -4765,7 +5042,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4765
5042
|
bookingUid = existingBookingUid;
|
|
4766
5043
|
productLineUids = [productLineUid];
|
|
4767
5044
|
bookingUids = [bookingUid];
|
|
4768
|
-
|
|
5045
|
+
_context42.next = 129;
|
|
4769
5046
|
break;
|
|
4770
5047
|
case 117:
|
|
4771
5048
|
beforeProductLineUids = new Set((((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || []).map(function (line) {
|
|
@@ -4774,10 +5051,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4774
5051
|
beforeBookingUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.bookings) || []).map(function (item) {
|
|
4775
5052
|
return getBookingUid(item);
|
|
4776
5053
|
}).filter(Boolean));
|
|
4777
|
-
|
|
4778
|
-
return this.addProductToOrder(transformed, booking)
|
|
5054
|
+
_context42.next = 121;
|
|
5055
|
+
return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length ? {
|
|
5056
|
+
salesNotes: params.salesNotes
|
|
5057
|
+
} : undefined);
|
|
4779
5058
|
case 121:
|
|
4780
|
-
products =
|
|
5059
|
+
products = _context42.sent;
|
|
4781
5060
|
addedLines = products.filter(function (line) {
|
|
4782
5061
|
var _line$product_id, _line$metadata;
|
|
4783
5062
|
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));
|
|
@@ -4794,8 +5073,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4794
5073
|
}).filter(Boolean);
|
|
4795
5074
|
if (bookingUids.length === 0) {
|
|
4796
5075
|
bookingUids = addedLines.map(function (line) {
|
|
4797
|
-
var
|
|
4798
|
-
return String((
|
|
5076
|
+
var _ref56, _line$booking_uid, _line$metadata2;
|
|
5077
|
+
return String((_ref56 = (_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 && _ref56 !== void 0 ? _ref56 : '');
|
|
4799
5078
|
}).filter(Boolean);
|
|
4800
5079
|
}
|
|
4801
5080
|
productLineUid = productLineUids[productLineUids.length - 1] || '';
|
|
@@ -4814,23 +5093,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4814
5093
|
productLineUids: productLineUids,
|
|
4815
5094
|
bookingUids: bookingUids
|
|
4816
5095
|
};
|
|
4817
|
-
|
|
5096
|
+
_context42.next = 134;
|
|
4818
5097
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
4819
5098
|
case 134:
|
|
4820
|
-
return
|
|
5099
|
+
return _context42.abrupt("return", result);
|
|
4821
5100
|
case 135:
|
|
4822
|
-
|
|
4823
|
-
|
|
5101
|
+
_context42.prev = 135;
|
|
5102
|
+
_context42.next = 138;
|
|
4824
5103
|
return this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
4825
5104
|
case 138:
|
|
4826
|
-
return
|
|
5105
|
+
return _context42.finish(135);
|
|
4827
5106
|
case 139:
|
|
4828
5107
|
case "end":
|
|
4829
|
-
return
|
|
5108
|
+
return _context42.stop();
|
|
4830
5109
|
}
|
|
4831
|
-
},
|
|
5110
|
+
}, _callee42, this, [[5,, 135, 139]]);
|
|
4832
5111
|
}));
|
|
4833
|
-
function commitAvailabilitySelection(
|
|
5112
|
+
function commitAvailabilitySelection(_x34, _x35) {
|
|
4834
5113
|
return _commitAvailabilitySelection.apply(this, arguments);
|
|
4835
5114
|
}
|
|
4836
5115
|
return commitAvailabilitySelection;
|