@pisell/pisellos 0.10.42 → 0.10.44
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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Order/index.d.ts +40 -8
- package/dist/modules/Order/index.js +1438 -878
- package/dist/modules/Order/salesNotes.d.ts +31 -0
- package/dist/modules/Order/salesNotes.js +492 -0
- package/dist/modules/Order/types.d.ts +105 -8
- package/dist/modules/Order/types.js +6 -1
- package/dist/modules/Order/utils.d.ts +3 -1
- package/dist/modules/Order/utils.js +191 -71
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +4 -5
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +17 -367
- 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/Rules/index.js +2 -1
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +45 -3
- package/dist/server/modules/order/index.js +6 -0
- package/dist/server/modules/order/types.d.ts +9 -0
- package/dist/server/utils/small-ticket.d.ts +1 -0
- package/dist/server/utils/small-ticket.js +142 -14
- package/dist/solution/BaseSales/index.d.ts +15 -1
- package/dist/solution/BaseSales/index.js +1240 -877
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -0
- package/dist/solution/BookingTicket/index.js +37 -16
- package/dist/solution/BookingTicket/types.d.ts +5 -1
- package/dist/solution/BookingTicket/utils/orderCustomer.js +3 -2
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +171 -96
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -1
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +12 -3
- 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 +777 -510
- 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/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Order/index.d.ts +40 -8
- package/lib/modules/Order/index.js +434 -61
- package/lib/modules/Order/salesNotes.d.ts +31 -0
- package/lib/modules/Order/salesNotes.js +382 -0
- package/lib/modules/Order/types.d.ts +105 -8
- package/lib/modules/Order/types.js +5 -1
- package/lib/modules/Order/utils.d.ts +3 -1
- package/lib/modules/Order/utils.js +114 -1
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +4 -5
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +9 -354
- 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/Rules/index.js +2 -1
- package/lib/server/index.d.ts +7 -0
- package/lib/server/index.js +39 -3
- package/lib/server/modules/order/index.js +6 -0
- package/lib/server/modules/order/types.d.ts +9 -0
- package/lib/server/utils/small-ticket.d.ts +1 -0
- package/lib/server/utils/small-ticket.js +136 -12
- package/lib/solution/BaseSales/index.d.ts +15 -1
- package/lib/solution/BaseSales/index.js +192 -22
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -0
- package/lib/solution/BookingTicket/index.js +23 -5
- package/lib/solution/BookingTicket/types.d.ts +5 -1
- package/lib/solution/BookingTicket/utils/orderCustomer.js +2 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +65 -18
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -1
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +5 -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 +125 -1
- 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
|
@@ -45,6 +45,7 @@ import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
|
|
|
45
45
|
import { BookingTicket } from "../BookingTicket";
|
|
46
46
|
import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
|
|
47
47
|
import { isCustomerUserPlatform } from "../../utils/platform";
|
|
48
|
+
import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
48
49
|
export * from "./types";
|
|
49
50
|
export { AvailabilityError } from "../../modules/ResourcePlanner";
|
|
50
51
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'basic', 'checkout', 'availability', 'documents'];
|
|
@@ -78,6 +79,29 @@ function getCandidateStartTime(candidate) {
|
|
|
78
79
|
return undefined;
|
|
79
80
|
}
|
|
80
81
|
}
|
|
82
|
+
function normalizePositiveIntegerList(value) {
|
|
83
|
+
if (!Array.isArray(value)) return [];
|
|
84
|
+
return Array.from(new Set(value.map(function (item) {
|
|
85
|
+
return normalizePositiveInteger(item);
|
|
86
|
+
}).filter(function (item) {
|
|
87
|
+
return item !== undefined;
|
|
88
|
+
})));
|
|
89
|
+
}
|
|
90
|
+
function toConfiguredBoolean(value) {
|
|
91
|
+
if (typeof value === 'boolean') return value;
|
|
92
|
+
if (typeof value === 'number') return value !== 0;
|
|
93
|
+
if (typeof value === 'string') {
|
|
94
|
+
return ['1', 'true', 'yes', 'y', 'on'].includes(value.trim().toLowerCase());
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
function normalizeItemRuleStrategyConfigs(value) {
|
|
99
|
+
if (!Array.isArray(value)) return [];
|
|
100
|
+
return value.filter(function (config) {
|
|
101
|
+
var _metadata;
|
|
102
|
+
return Boolean(config && _typeof(config) === 'object' && ((_metadata = config.metadata) === null || _metadata === void 0 ? void 0 : _metadata.type) === 'item_rule');
|
|
103
|
+
});
|
|
104
|
+
}
|
|
81
105
|
function isRecord(value) {
|
|
82
106
|
return !!value && _typeof(value) === 'object' && !Array.isArray(value);
|
|
83
107
|
}
|
|
@@ -1305,6 +1329,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1305
1329
|
_defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceQuerySequence", 0);
|
|
1306
1330
|
_defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceEpoch", 0);
|
|
1307
1331
|
_defineProperty(_assertThisInitialized(_this), "availabilityCommitLocks", new Set());
|
|
1332
|
+
_defineProperty(_assertThisInitialized(_this), "allergyItemRuleEvaluator", new ItemRuleEvaluator());
|
|
1333
|
+
_defineProperty(_assertThisInitialized(_this), "allergyItemRuleConfigs", []);
|
|
1334
|
+
_defineProperty(_assertThisInitialized(_this), "allergyItemRuleConfigsPromise", null);
|
|
1308
1335
|
return _this;
|
|
1309
1336
|
}
|
|
1310
1337
|
_createClass(UnifiedBookingSalesImpl, [{
|
|
@@ -1324,16 +1351,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1324
1351
|
this.openDataTarget = null;
|
|
1325
1352
|
this.availabilityRuntimeOffsetMinutes = captureRuntimeOffsetMinutes();
|
|
1326
1353
|
this.clearAvailabilityRemoteResourceState();
|
|
1327
|
-
|
|
1354
|
+
this.resetAllergyItemRuleState();
|
|
1355
|
+
_context.next = 8;
|
|
1328
1356
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "initialize", this).call(this, core, options);
|
|
1329
|
-
case
|
|
1357
|
+
case 8:
|
|
1330
1358
|
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();
|
|
1331
1359
|
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();
|
|
1332
1360
|
if ((_this$otherParams4 = this.otherParams) !== null && _this$otherParams4 !== void 0 && _this$otherParams4.openData && openDataBusinessCode && openDataChannel) {
|
|
1333
1361
|
this.openDataTarget = "".concat(openDataBusinessCode, "+").concat(openDataChannel);
|
|
1334
1362
|
}
|
|
1335
1363
|
this.captureAvailabilityScheduleCatalog();
|
|
1336
|
-
case
|
|
1364
|
+
case 12:
|
|
1337
1365
|
case "end":
|
|
1338
1366
|
return _context.stop();
|
|
1339
1367
|
}
|
|
@@ -1543,13 +1571,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1543
1571
|
key: "setOtherParams",
|
|
1544
1572
|
value: function () {
|
|
1545
1573
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
1574
|
+
var _this$otherParams11, _this$otherParams13;
|
|
1546
1575
|
var _ref32,
|
|
1547
1576
|
_ref32$cover,
|
|
1548
1577
|
cover,
|
|
1549
1578
|
previousScope,
|
|
1579
|
+
previousItemRuleConfig,
|
|
1550
1580
|
explicitlySetsOpenData,
|
|
1551
1581
|
nextScope,
|
|
1552
|
-
_this$
|
|
1582
|
+
_this$otherParams12,
|
|
1553
1583
|
shouldResetAvailabilityState,
|
|
1554
1584
|
_args3 = arguments;
|
|
1555
1585
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -1557,24 +1587,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1557
1587
|
case 0:
|
|
1558
1588
|
_ref32 = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {}, _ref32$cover = _ref32.cover, cover = _ref32$cover === void 0 ? false : _ref32$cover;
|
|
1559
1589
|
previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1590
|
+
previousItemRuleConfig = (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.itemRule;
|
|
1560
1591
|
explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
1561
|
-
_context3.next =
|
|
1592
|
+
_context3.next = 6;
|
|
1562
1593
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
1563
1594
|
cover: cover
|
|
1564
1595
|
});
|
|
1565
|
-
case
|
|
1596
|
+
case 6:
|
|
1566
1597
|
nextScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1567
1598
|
if (explicitlySetsOpenData) {
|
|
1568
|
-
this.openDataTarget = (_this$
|
|
1599
|
+
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;
|
|
1569
1600
|
}
|
|
1570
1601
|
shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone;
|
|
1571
1602
|
if (!shouldResetAvailabilityState) {
|
|
1572
|
-
_context3.next =
|
|
1603
|
+
_context3.next = 12;
|
|
1573
1604
|
break;
|
|
1574
1605
|
}
|
|
1575
|
-
_context3.next =
|
|
1606
|
+
_context3.next = 12;
|
|
1576
1607
|
return this.resetAvailabilityProjectionState('set_other_params_reset');
|
|
1577
|
-
case
|
|
1608
|
+
case 12:
|
|
1609
|
+
if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.itemRule)) {
|
|
1610
|
+
this.resetAllergyItemRuleState();
|
|
1611
|
+
}
|
|
1612
|
+
case 13:
|
|
1578
1613
|
case "end":
|
|
1579
1614
|
return _context3.stop();
|
|
1580
1615
|
}
|
|
@@ -1597,9 +1632,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1597
1632
|
_context4.next = 4;
|
|
1598
1633
|
return this.resetAvailabilityProjectionState('destroy');
|
|
1599
1634
|
case 4:
|
|
1600
|
-
|
|
1635
|
+
this.resetAllergyItemRuleState();
|
|
1636
|
+
_context4.next = 7;
|
|
1601
1637
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "destroy", this).call(this);
|
|
1602
|
-
case
|
|
1638
|
+
case 7:
|
|
1603
1639
|
case "end":
|
|
1604
1640
|
return _context4.stop();
|
|
1605
1641
|
}
|
|
@@ -1804,8 +1840,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1804
1840
|
}, {
|
|
1805
1841
|
key: "isSessionStoragePersistEnabled",
|
|
1806
1842
|
value: function isSessionStoragePersistEnabled() {
|
|
1807
|
-
var _this$
|
|
1808
|
-
return Boolean(this.cacheId && ((_this$
|
|
1843
|
+
var _this$otherParams14;
|
|
1844
|
+
return Boolean(this.cacheId && ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.enableSessionStoragePersist) === true);
|
|
1809
1845
|
}
|
|
1810
1846
|
}, {
|
|
1811
1847
|
key: "shouldUseSessionStorageForSubModule",
|
|
@@ -1874,10 +1910,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1874
1910
|
}, {
|
|
1875
1911
|
key: "shouldUseCheckoutSyncTask",
|
|
1876
1912
|
value: function shouldUseCheckoutSyncTask() {
|
|
1877
|
-
var _this$
|
|
1878
|
-
var configured = (_this$
|
|
1913
|
+
var _this$otherParams15, _this$otherParams$pla, _this$otherParams16;
|
|
1914
|
+
var configured = (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.checkoutSyncTaskEnabled;
|
|
1879
1915
|
if (configured === true) return true;
|
|
1880
|
-
var platform = String((_this$otherParams$pla = (_this$
|
|
1916
|
+
var platform = String((_this$otherParams$pla = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase();
|
|
1881
1917
|
return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
|
|
1882
1918
|
}
|
|
1883
1919
|
|
|
@@ -2032,8 +2068,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2032
2068
|
}, {
|
|
2033
2069
|
key: "isAuthenticatedCustomerUserPlatform",
|
|
2034
2070
|
value: function isAuthenticatedCustomerUserPlatform() {
|
|
2035
|
-
var _this$
|
|
2036
|
-
return isCustomerUserPlatform((_this$
|
|
2071
|
+
var _this$otherParams17;
|
|
2072
|
+
return isCustomerUserPlatform((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform);
|
|
2037
2073
|
}
|
|
2038
2074
|
}, {
|
|
2039
2075
|
key: "resolveDiscountOrderIdentity",
|
|
@@ -2223,13 +2259,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2223
2259
|
key: "getOpenData",
|
|
2224
2260
|
value: function () {
|
|
2225
2261
|
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
2226
|
-
var _this$
|
|
2262
|
+
var _this$otherParams18, _this$otherParams19;
|
|
2227
2263
|
var businessCode, channel;
|
|
2228
2264
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
2229
2265
|
while (1) switch (_context12.prev = _context12.next) {
|
|
2230
2266
|
case 0:
|
|
2231
|
-
businessCode = String(((_this$
|
|
2232
|
-
channel = String(((_this$
|
|
2267
|
+
businessCode = String(((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) || '').trim();
|
|
2268
|
+
channel = String(((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.channel) || '').trim();
|
|
2233
2269
|
if (!(!businessCode || !channel)) {
|
|
2234
2270
|
_context12.next = 4;
|
|
2235
2271
|
break;
|
|
@@ -2251,6 +2287,207 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2251
2287
|
}
|
|
2252
2288
|
return getOpenData;
|
|
2253
2289
|
}()
|
|
2290
|
+
}, {
|
|
2291
|
+
key: "resetAllergyItemRuleState",
|
|
2292
|
+
value: function resetAllergyItemRuleState() {
|
|
2293
|
+
this.allergyItemRuleConfigs = [];
|
|
2294
|
+
this.allergyItemRuleConfigsPromise = null;
|
|
2295
|
+
this.allergyItemRuleEvaluator.setStrategyConfigs([]);
|
|
2296
|
+
}
|
|
2297
|
+
}, {
|
|
2298
|
+
key: "fetchAllergyItemRuleConfigs",
|
|
2299
|
+
value: function () {
|
|
2300
|
+
var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(strategyModelIds) {
|
|
2301
|
+
var _response$data, response, list;
|
|
2302
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
2303
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
2304
|
+
case 0:
|
|
2305
|
+
if (strategyModelIds.length) {
|
|
2306
|
+
_context13.next = 2;
|
|
2307
|
+
break;
|
|
2308
|
+
}
|
|
2309
|
+
return _context13.abrupt("return", []);
|
|
2310
|
+
case 2:
|
|
2311
|
+
_context13.prev = 2;
|
|
2312
|
+
_context13.next = 5;
|
|
2313
|
+
return this.request.get('/promotion', {
|
|
2314
|
+
skip: 1,
|
|
2315
|
+
num: 99,
|
|
2316
|
+
status: 'active',
|
|
2317
|
+
ids: strategyModelIds
|
|
2318
|
+
});
|
|
2319
|
+
case 5:
|
|
2320
|
+
response = _context13.sent;
|
|
2321
|
+
if (!((response === null || response === void 0 ? void 0 : response.code) !== 200 || !Array.isArray(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list))) {
|
|
2322
|
+
_context13.next = 8;
|
|
2323
|
+
break;
|
|
2324
|
+
}
|
|
2325
|
+
throw new Error('[UnifiedBookingSales] 商品过敏策略加载失败');
|
|
2326
|
+
case 8:
|
|
2327
|
+
list = response.data.list;
|
|
2328
|
+
return _context13.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
|
|
2329
|
+
return item === null || item === void 0 ? void 0 : item.metadata;
|
|
2330
|
+
})));
|
|
2331
|
+
case 12:
|
|
2332
|
+
_context13.prev = 12;
|
|
2333
|
+
_context13.t0 = _context13["catch"](2);
|
|
2334
|
+
throw _context13.t0;
|
|
2335
|
+
case 15:
|
|
2336
|
+
case "end":
|
|
2337
|
+
return _context13.stop();
|
|
2338
|
+
}
|
|
2339
|
+
}, _callee13, this, [[2, 12]]);
|
|
2340
|
+
}));
|
|
2341
|
+
function fetchAllergyItemRuleConfigs(_x8) {
|
|
2342
|
+
return _fetchAllergyItemRuleConfigs.apply(this, arguments);
|
|
2343
|
+
}
|
|
2344
|
+
return fetchAllergyItemRuleConfigs;
|
|
2345
|
+
}()
|
|
2346
|
+
}, {
|
|
2347
|
+
key: "ensureAllergyItemRuleConfigsLoaded",
|
|
2348
|
+
value: function () {
|
|
2349
|
+
var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
2350
|
+
var _this3 = this;
|
|
2351
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
2352
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
2353
|
+
case 0:
|
|
2354
|
+
if (!(this.allergyItemRuleConfigs.length > 0)) {
|
|
2355
|
+
_context15.next = 2;
|
|
2356
|
+
break;
|
|
2357
|
+
}
|
|
2358
|
+
return _context15.abrupt("return", this.allergyItemRuleConfigs);
|
|
2359
|
+
case 2:
|
|
2360
|
+
if (!this.allergyItemRuleConfigsPromise) {
|
|
2361
|
+
_context15.next = 4;
|
|
2362
|
+
break;
|
|
2363
|
+
}
|
|
2364
|
+
return _context15.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
2365
|
+
case 4:
|
|
2366
|
+
this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
2367
|
+
var _this3$otherParams;
|
|
2368
|
+
var staticConfigs, openData, enabled, strategyModelIds, loaded;
|
|
2369
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
2370
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
2371
|
+
case 0:
|
|
2372
|
+
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);
|
|
2373
|
+
if (!(staticConfigs.length > 0)) {
|
|
2374
|
+
_context14.next = 5;
|
|
2375
|
+
break;
|
|
2376
|
+
}
|
|
2377
|
+
_this3.allergyItemRuleConfigs = staticConfigs;
|
|
2378
|
+
_this3.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2379
|
+
return _context14.abrupt("return", staticConfigs);
|
|
2380
|
+
case 5:
|
|
2381
|
+
_context14.next = 7;
|
|
2382
|
+
return _this3.getOpenData();
|
|
2383
|
+
case 7:
|
|
2384
|
+
openData = _context14.sent;
|
|
2385
|
+
enabled = toConfiguredBoolean(openData === null || openData === void 0 ? void 0 : openData['sale.enable_item_rules']);
|
|
2386
|
+
strategyModelIds = normalizePositiveIntegerList(openData === null || openData === void 0 ? void 0 : openData['sale.enabled_item_rules']);
|
|
2387
|
+
if (!(!enabled || !strategyModelIds.length)) {
|
|
2388
|
+
_context14.next = 13;
|
|
2389
|
+
break;
|
|
2390
|
+
}
|
|
2391
|
+
_this3.allergyItemRuleEvaluator.setStrategyConfigs([]);
|
|
2392
|
+
return _context14.abrupt("return", []);
|
|
2393
|
+
case 13:
|
|
2394
|
+
_context14.next = 15;
|
|
2395
|
+
return _this3.fetchAllergyItemRuleConfigs(strategyModelIds);
|
|
2396
|
+
case 15:
|
|
2397
|
+
loaded = _context14.sent;
|
|
2398
|
+
_this3.allergyItemRuleConfigs = loaded;
|
|
2399
|
+
_this3.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
|
|
2400
|
+
return _context14.abrupt("return", loaded);
|
|
2401
|
+
case 19:
|
|
2402
|
+
case "end":
|
|
2403
|
+
return _context14.stop();
|
|
2404
|
+
}
|
|
2405
|
+
}, _callee14);
|
|
2406
|
+
}))();
|
|
2407
|
+
return _context15.abrupt("return", this.allergyItemRuleConfigsPromise);
|
|
2408
|
+
case 6:
|
|
2409
|
+
case "end":
|
|
2410
|
+
return _context15.stop();
|
|
2411
|
+
}
|
|
2412
|
+
}, _callee15, this);
|
|
2413
|
+
}));
|
|
2414
|
+
function ensureAllergyItemRuleConfigsLoaded() {
|
|
2415
|
+
return _ensureAllergyItemRuleConfigsLoaded.apply(this, arguments);
|
|
2416
|
+
}
|
|
2417
|
+
return ensureAllergyItemRuleConfigsLoaded;
|
|
2418
|
+
}()
|
|
2419
|
+
/**
|
|
2420
|
+
* 评估当前渠道与商品是否命中 ALLERGY_CHECK。
|
|
2421
|
+
* 只返回优先级最高 Action 中当前商品 Target 的 dataSource,不跨商品或 Action 合并。
|
|
2422
|
+
*/
|
|
2423
|
+
}, {
|
|
2424
|
+
key: "resolveProductAllergyRequirement",
|
|
2425
|
+
value: (function () {
|
|
2426
|
+
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
2427
|
+
var _this$otherParams20, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref35, _runtimeConfig$servic, _this$otherParams21, _ref36, _ref37, _params$channel, _this$otherParams22, _this$otherParams23, _runtimeConfig$submis;
|
|
2428
|
+
var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
|
|
2429
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
2430
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
2431
|
+
case 0:
|
|
2432
|
+
productId = normalizePositiveInteger(params.productId);
|
|
2433
|
+
if (productId) {
|
|
2434
|
+
_context16.next = 3;
|
|
2435
|
+
break;
|
|
2436
|
+
}
|
|
2437
|
+
return _context16.abrupt("return", null);
|
|
2438
|
+
case 3:
|
|
2439
|
+
_context16.next = 5;
|
|
2440
|
+
return this.ensureAllergyItemRuleConfigsLoaded();
|
|
2441
|
+
case 5:
|
|
2442
|
+
strategyConfigs = _context16.sent;
|
|
2443
|
+
if (strategyConfigs.length) {
|
|
2444
|
+
_context16.next = 8;
|
|
2445
|
+
break;
|
|
2446
|
+
}
|
|
2447
|
+
return _context16.abrupt("return", null);
|
|
2448
|
+
case 8:
|
|
2449
|
+
productVariantId = normalizePositiveInteger(params.productVariantId);
|
|
2450
|
+
runtimeConfig = ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.itemRule) || {};
|
|
2451
|
+
runtimePax = runtimeConfig.pax || {};
|
|
2452
|
+
cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
|
|
2453
|
+
var _item$product_id, _item$product_variant, _ref34, _item$num;
|
|
2454
|
+
return {
|
|
2455
|
+
product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id),
|
|
2456
|
+
product_variant_id: Number((_item$product_variant = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0) || undefined,
|
|
2457
|
+
quantity: Number((_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)
|
|
2458
|
+
};
|
|
2459
|
+
}).filter(function (item) {
|
|
2460
|
+
return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
|
|
2461
|
+
});
|
|
2462
|
+
return _context16.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
|
|
2463
|
+
pax: {
|
|
2464
|
+
total: Number((_runtimePax$total = runtimePax.total) !== null && _runtimePax$total !== void 0 ? _runtimePax$total : 0) || 0,
|
|
2465
|
+
adult: Number((_runtimePax$adult = runtimePax.adult) !== null && _runtimePax$adult !== void 0 ? _runtimePax$adult : 0) || 0,
|
|
2466
|
+
child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
|
|
2467
|
+
},
|
|
2468
|
+
cartItems: cartItems,
|
|
2469
|
+
serviceType: String((_ref35 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.serviceType) !== null && _ref35 !== void 0 ? _ref35 : ''),
|
|
2470
|
+
channel: String((_ref36 = (_ref37 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.channel) !== null && _ref37 !== void 0 ? _ref37 : (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.platform) !== null && _ref36 !== void 0 ? _ref36 : ''),
|
|
2471
|
+
currentProduct: _objectSpread({
|
|
2472
|
+
product_id: productId
|
|
2473
|
+
}, productVariantId ? {
|
|
2474
|
+
product_variant_id: productVariantId
|
|
2475
|
+
} : {}),
|
|
2476
|
+
submissionIndex: Number((_runtimeConfig$submis = runtimeConfig.submissionIndex) !== null && _runtimeConfig$submis !== void 0 ? _runtimeConfig$submis : 0) || 0,
|
|
2477
|
+
strategyConfigs: strategyConfigs,
|
|
2478
|
+
custom: runtimeConfig.custom
|
|
2479
|
+
}));
|
|
2480
|
+
case 13:
|
|
2481
|
+
case "end":
|
|
2482
|
+
return _context16.stop();
|
|
2483
|
+
}
|
|
2484
|
+
}, _callee16, this);
|
|
2485
|
+
}));
|
|
2486
|
+
function resolveProductAllergyRequirement(_x9) {
|
|
2487
|
+
return _resolveProductAllergyRequirement.apply(this, arguments);
|
|
2488
|
+
}
|
|
2489
|
+
return resolveProductAllergyRequirement;
|
|
2490
|
+
}())
|
|
2254
2491
|
}, {
|
|
2255
2492
|
key: "clearOpenDataCache",
|
|
2256
2493
|
value: function clearOpenDataCache() {
|
|
@@ -2262,27 +2499,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2262
2499
|
}, {
|
|
2263
2500
|
key: "getInvoiceLayoutConfig",
|
|
2264
2501
|
value: function () {
|
|
2265
|
-
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2502
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
2266
2503
|
var openData;
|
|
2267
|
-
return _regeneratorRuntime().wrap(function
|
|
2268
|
-
while (1) switch (
|
|
2504
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
2505
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
2269
2506
|
case 0:
|
|
2270
|
-
|
|
2507
|
+
_context17.next = 2;
|
|
2271
2508
|
return this.getOpenData();
|
|
2272
2509
|
case 2:
|
|
2273
|
-
openData =
|
|
2510
|
+
openData = _context17.sent;
|
|
2274
2511
|
if (!(!openData || !this.store.openData)) {
|
|
2275
|
-
|
|
2512
|
+
_context17.next = 5;
|
|
2276
2513
|
break;
|
|
2277
2514
|
}
|
|
2278
|
-
return
|
|
2515
|
+
return _context17.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
2279
2516
|
case 5:
|
|
2280
|
-
return
|
|
2517
|
+
return _context17.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
2281
2518
|
case 6:
|
|
2282
2519
|
case "end":
|
|
2283
|
-
return
|
|
2520
|
+
return _context17.stop();
|
|
2284
2521
|
}
|
|
2285
|
-
},
|
|
2522
|
+
}, _callee17, this);
|
|
2286
2523
|
}));
|
|
2287
2524
|
function getInvoiceLayoutConfig() {
|
|
2288
2525
|
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
@@ -2292,27 +2529,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2292
2529
|
}, {
|
|
2293
2530
|
key: "getInvoiceTemplateSettings",
|
|
2294
2531
|
value: function () {
|
|
2295
|
-
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2532
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
2296
2533
|
var openData;
|
|
2297
|
-
return _regeneratorRuntime().wrap(function
|
|
2298
|
-
while (1) switch (
|
|
2534
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
2535
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2299
2536
|
case 0:
|
|
2300
|
-
|
|
2537
|
+
_context18.next = 2;
|
|
2301
2538
|
return this.getOpenData();
|
|
2302
2539
|
case 2:
|
|
2303
|
-
openData =
|
|
2540
|
+
openData = _context18.sent;
|
|
2304
2541
|
if (!(!openData || !this.store.openData)) {
|
|
2305
|
-
|
|
2542
|
+
_context18.next = 5;
|
|
2306
2543
|
break;
|
|
2307
2544
|
}
|
|
2308
|
-
return
|
|
2545
|
+
return _context18.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
2309
2546
|
case 5:
|
|
2310
|
-
return
|
|
2547
|
+
return _context18.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
2311
2548
|
case 6:
|
|
2312
2549
|
case "end":
|
|
2313
|
-
return
|
|
2550
|
+
return _context18.stop();
|
|
2314
2551
|
}
|
|
2315
|
-
},
|
|
2552
|
+
}, _callee18, this);
|
|
2316
2553
|
}));
|
|
2317
2554
|
function getInvoiceTemplateSettings() {
|
|
2318
2555
|
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
@@ -2322,9 +2559,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2322
2559
|
}, {
|
|
2323
2560
|
key: "isInvoiceOpenDataCacheCurrent",
|
|
2324
2561
|
value: function isInvoiceOpenDataCacheCurrent() {
|
|
2325
|
-
var _this$
|
|
2326
|
-
var businessCode = String(((_this$
|
|
2327
|
-
var channel = String(((_this$
|
|
2562
|
+
var _this$otherParams24, _this$otherParams25;
|
|
2563
|
+
var businessCode = String(((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.businessCode) || '').trim();
|
|
2564
|
+
var channel = String(((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.channel) || '').trim();
|
|
2328
2565
|
if (!businessCode || !channel) return false;
|
|
2329
2566
|
return this.openDataTarget === "".concat(businessCode, "+").concat(channel);
|
|
2330
2567
|
}
|
|
@@ -2335,14 +2572,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2335
2572
|
}, {
|
|
2336
2573
|
key: "getProtocol",
|
|
2337
2574
|
value: (function () {
|
|
2338
|
-
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2575
|
+
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(policyId) {
|
|
2339
2576
|
var normalizedPolicyId, policyUrl;
|
|
2340
|
-
return _regeneratorRuntime().wrap(function
|
|
2341
|
-
while (1) switch (
|
|
2577
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
2578
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2342
2579
|
case 0:
|
|
2343
2580
|
normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
|
|
2344
2581
|
if (normalizedPolicyId) {
|
|
2345
|
-
|
|
2582
|
+
_context19.next = 3;
|
|
2346
2583
|
break;
|
|
2347
2584
|
}
|
|
2348
2585
|
throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
|
|
@@ -2351,14 +2588,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2351
2588
|
if (this.otherParams.platform === 'kiosk' || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
|
|
2352
2589
|
policyUrl = 'policy';
|
|
2353
2590
|
}
|
|
2354
|
-
return
|
|
2591
|
+
return _context19.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
|
|
2355
2592
|
case 6:
|
|
2356
2593
|
case "end":
|
|
2357
|
-
return
|
|
2594
|
+
return _context19.stop();
|
|
2358
2595
|
}
|
|
2359
|
-
},
|
|
2596
|
+
}, _callee19, this);
|
|
2360
2597
|
}));
|
|
2361
|
-
function getProtocol(
|
|
2598
|
+
function getProtocol(_x10) {
|
|
2362
2599
|
return _getProtocol.apply(this, arguments);
|
|
2363
2600
|
}
|
|
2364
2601
|
return getProtocol;
|
|
@@ -2371,27 +2608,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2371
2608
|
}, {
|
|
2372
2609
|
key: "loadProducts",
|
|
2373
2610
|
value: (function () {
|
|
2374
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2611
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
2375
2612
|
var params,
|
|
2376
2613
|
options,
|
|
2377
2614
|
schedule_date,
|
|
2378
2615
|
schedule_datetime,
|
|
2379
2616
|
result,
|
|
2380
|
-
|
|
2381
|
-
return _regeneratorRuntime().wrap(function
|
|
2382
|
-
while (1) switch (
|
|
2617
|
+
_args20 = arguments;
|
|
2618
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2619
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2383
2620
|
case 0:
|
|
2384
|
-
params =
|
|
2385
|
-
options =
|
|
2621
|
+
params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
|
|
2622
|
+
options = _args20.length > 1 ? _args20[1] : undefined;
|
|
2386
2623
|
if (this.store.products) {
|
|
2387
|
-
|
|
2624
|
+
_context20.next = 4;
|
|
2388
2625
|
break;
|
|
2389
2626
|
}
|
|
2390
2627
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
2391
2628
|
case 4:
|
|
2392
2629
|
schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
2393
2630
|
schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
2394
|
-
|
|
2631
|
+
_context20.next = 8;
|
|
2395
2632
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
2396
2633
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
2397
2634
|
with_schedule: 1
|
|
@@ -2401,44 +2638,72 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2401
2638
|
cacheId: this.cacheId
|
|
2402
2639
|
}), options);
|
|
2403
2640
|
case 8:
|
|
2404
|
-
result =
|
|
2641
|
+
result = _context20.sent;
|
|
2405
2642
|
this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
2406
|
-
|
|
2643
|
+
_context20.next = 12;
|
|
2407
2644
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
|
|
2408
2645
|
case 12:
|
|
2409
|
-
return
|
|
2646
|
+
return _context20.abrupt("return", result);
|
|
2410
2647
|
case 13:
|
|
2411
2648
|
case "end":
|
|
2412
|
-
return
|
|
2649
|
+
return _context20.stop();
|
|
2413
2650
|
}
|
|
2414
|
-
},
|
|
2651
|
+
}, _callee20, this);
|
|
2415
2652
|
}));
|
|
2416
2653
|
function loadProducts() {
|
|
2417
2654
|
return _loadProducts.apply(this, arguments);
|
|
2418
2655
|
}
|
|
2419
2656
|
return loadProducts;
|
|
2420
|
-
}()
|
|
2657
|
+
}())
|
|
2658
|
+
}, {
|
|
2659
|
+
key: "queryProducts",
|
|
2660
|
+
value: function () {
|
|
2661
|
+
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
2662
|
+
var params,
|
|
2663
|
+
_args21 = arguments;
|
|
2664
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2665
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2666
|
+
case 0:
|
|
2667
|
+
params = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
|
|
2668
|
+
if (this.store.products) {
|
|
2669
|
+
_context21.next = 3;
|
|
2670
|
+
break;
|
|
2671
|
+
}
|
|
2672
|
+
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
2673
|
+
case 3:
|
|
2674
|
+
return _context21.abrupt("return", this.store.products.queryProducts(params));
|
|
2675
|
+
case 4:
|
|
2676
|
+
case "end":
|
|
2677
|
+
return _context21.stop();
|
|
2678
|
+
}
|
|
2679
|
+
}, _callee21, this);
|
|
2680
|
+
}));
|
|
2681
|
+
function queryProducts() {
|
|
2682
|
+
return _queryProducts.apply(this, arguments);
|
|
2683
|
+
}
|
|
2684
|
+
return queryProducts;
|
|
2685
|
+
}() /** Date-first entry point. It delegates protocol details and cache ownership to ScheduleModule. */
|
|
2421
2686
|
}, {
|
|
2422
2687
|
key: "loadScheduleAvailableDate",
|
|
2423
2688
|
value: (function () {
|
|
2424
|
-
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2425
|
-
return _regeneratorRuntime().wrap(function
|
|
2426
|
-
while (1) switch (
|
|
2689
|
+
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2690
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2691
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2427
2692
|
case 0:
|
|
2428
2693
|
if (this.store.schedule) {
|
|
2429
|
-
|
|
2694
|
+
_context22.next = 2;
|
|
2430
2695
|
break;
|
|
2431
2696
|
}
|
|
2432
2697
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
2433
2698
|
case 2:
|
|
2434
|
-
return
|
|
2699
|
+
return _context22.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
|
|
2435
2700
|
case 3:
|
|
2436
2701
|
case "end":
|
|
2437
|
-
return
|
|
2702
|
+
return _context22.stop();
|
|
2438
2703
|
}
|
|
2439
|
-
},
|
|
2704
|
+
}, _callee22, this);
|
|
2440
2705
|
}));
|
|
2441
|
-
function loadScheduleAvailableDate(
|
|
2706
|
+
function loadScheduleAvailableDate(_x11) {
|
|
2442
2707
|
return _loadScheduleAvailableDate.apply(this, arguments);
|
|
2443
2708
|
}
|
|
2444
2709
|
return loadScheduleAvailableDate;
|
|
@@ -2452,15 +2717,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2452
2717
|
}, {
|
|
2453
2718
|
key: "loadProductsByScheduleDate",
|
|
2454
2719
|
value: (function () {
|
|
2455
|
-
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2720
|
+
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
2456
2721
|
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;
|
|
2457
2722
|
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
|
|
2458
|
-
return _regeneratorRuntime().wrap(function
|
|
2459
|
-
while (1) switch (
|
|
2723
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2724
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2460
2725
|
case 0:
|
|
2461
2726
|
date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
|
|
2462
2727
|
if (this.store.schedule) {
|
|
2463
|
-
|
|
2728
|
+
_context23.next = 3;
|
|
2464
2729
|
break;
|
|
2465
2730
|
}
|
|
2466
2731
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
@@ -2471,10 +2736,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2471
2736
|
});
|
|
2472
2737
|
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;
|
|
2473
2738
|
if (!(!hasCachedDate && !hasOtherProducts)) {
|
|
2474
|
-
|
|
2739
|
+
_context23.next = 9;
|
|
2475
2740
|
break;
|
|
2476
2741
|
}
|
|
2477
|
-
|
|
2742
|
+
_context23.next = 9;
|
|
2478
2743
|
return this.loadScheduleAvailableDate({
|
|
2479
2744
|
startDate: date,
|
|
2480
2745
|
endDate: date,
|
|
@@ -2494,45 +2759,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2494
2759
|
return !productIdFilter || productIdFilter.has(String(id));
|
|
2495
2760
|
});
|
|
2496
2761
|
if (availableProductIds.length) {
|
|
2497
|
-
|
|
2762
|
+
_context23.next = 17;
|
|
2498
2763
|
break;
|
|
2499
2764
|
}
|
|
2500
2765
|
this.unifiedProductCatalog = [];
|
|
2501
|
-
|
|
2766
|
+
_context23.next = 16;
|
|
2502
2767
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
|
|
2503
2768
|
case 16:
|
|
2504
|
-
return
|
|
2769
|
+
return _context23.abrupt("return", []);
|
|
2505
2770
|
case 17:
|
|
2506
|
-
|
|
2771
|
+
_context23.next = 19;
|
|
2507
2772
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
2508
2773
|
product_ids: availableProductIds,
|
|
2509
2774
|
schedule_date: date
|
|
2510
2775
|
}));
|
|
2511
2776
|
case 19:
|
|
2512
|
-
products =
|
|
2777
|
+
products = _context23.sent;
|
|
2513
2778
|
if (!(products.length || availableProductIds.length <= 1)) {
|
|
2514
|
-
|
|
2779
|
+
_context23.next = 22;
|
|
2515
2780
|
break;
|
|
2516
2781
|
}
|
|
2517
|
-
return
|
|
2782
|
+
return _context23.abrupt("return", products);
|
|
2518
2783
|
case 22:
|
|
2519
2784
|
fallbackProducts = [];
|
|
2520
2785
|
_iterator = _createForOfIteratorHelper(availableProductIds);
|
|
2521
|
-
|
|
2786
|
+
_context23.prev = 24;
|
|
2522
2787
|
_iterator.s();
|
|
2523
2788
|
case 26:
|
|
2524
2789
|
if ((_step = _iterator.n()).done) {
|
|
2525
|
-
|
|
2790
|
+
_context23.next = 34;
|
|
2526
2791
|
break;
|
|
2527
2792
|
}
|
|
2528
2793
|
productId = _step.value;
|
|
2529
|
-
|
|
2794
|
+
_context23.next = 30;
|
|
2530
2795
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
2531
2796
|
product_ids: [productId],
|
|
2532
2797
|
schedule_date: date
|
|
2533
2798
|
}));
|
|
2534
2799
|
case 30:
|
|
2535
|
-
result =
|
|
2800
|
+
result = _context23.sent;
|
|
2536
2801
|
result.forEach(function (product) {
|
|
2537
2802
|
var _id;
|
|
2538
2803
|
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;
|
|
@@ -2544,32 +2809,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2544
2809
|
}
|
|
2545
2810
|
});
|
|
2546
2811
|
case 32:
|
|
2547
|
-
|
|
2812
|
+
_context23.next = 26;
|
|
2548
2813
|
break;
|
|
2549
2814
|
case 34:
|
|
2550
|
-
|
|
2815
|
+
_context23.next = 39;
|
|
2551
2816
|
break;
|
|
2552
2817
|
case 36:
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
_iterator.e(
|
|
2818
|
+
_context23.prev = 36;
|
|
2819
|
+
_context23.t0 = _context23["catch"](24);
|
|
2820
|
+
_iterator.e(_context23.t0);
|
|
2556
2821
|
case 39:
|
|
2557
|
-
|
|
2822
|
+
_context23.prev = 39;
|
|
2558
2823
|
_iterator.f();
|
|
2559
|
-
return
|
|
2824
|
+
return _context23.finish(39);
|
|
2560
2825
|
case 42:
|
|
2561
2826
|
this.unifiedProductCatalog = [].concat(fallbackProducts);
|
|
2562
|
-
|
|
2827
|
+
_context23.next = 45;
|
|
2563
2828
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
|
|
2564
2829
|
case 45:
|
|
2565
|
-
return
|
|
2830
|
+
return _context23.abrupt("return", fallbackProducts);
|
|
2566
2831
|
case 46:
|
|
2567
2832
|
case "end":
|
|
2568
|
-
return
|
|
2833
|
+
return _context23.stop();
|
|
2569
2834
|
}
|
|
2570
|
-
},
|
|
2835
|
+
}, _callee23, this, [[24, 36, 39, 42]]);
|
|
2571
2836
|
}));
|
|
2572
|
-
function loadProductsByScheduleDate(
|
|
2837
|
+
function loadProductsByScheduleDate(_x12) {
|
|
2573
2838
|
return _loadProductsByScheduleDate.apply(this, arguments);
|
|
2574
2839
|
}
|
|
2575
2840
|
return loadProductsByScheduleDate;
|
|
@@ -2622,7 +2887,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2622
2887
|
}, {
|
|
2623
2888
|
key: "applyPlannerDiscounts",
|
|
2624
2889
|
value: (function () {
|
|
2625
|
-
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2890
|
+
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2626
2891
|
var _params$customerId;
|
|
2627
2892
|
var params,
|
|
2628
2893
|
tempOrder,
|
|
@@ -2639,24 +2904,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2639
2904
|
discount,
|
|
2640
2905
|
discountId,
|
|
2641
2906
|
nextTempOrder,
|
|
2642
|
-
|
|
2643
|
-
return _regeneratorRuntime().wrap(function
|
|
2644
|
-
while (1) switch (
|
|
2907
|
+
_args24 = arguments;
|
|
2908
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2909
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2645
2910
|
case 0:
|
|
2646
|
-
params =
|
|
2911
|
+
params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
|
|
2647
2912
|
tempOrder = this.getTempOrder();
|
|
2648
2913
|
requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
2649
2914
|
parsedCustomerId = Number(requestedCustomerId);
|
|
2650
2915
|
customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
|
|
2651
|
-
|
|
2916
|
+
_context24.next = 7;
|
|
2652
2917
|
return this.getSummary();
|
|
2653
2918
|
case 7:
|
|
2654
|
-
summaryBefore =
|
|
2919
|
+
summaryBefore = _context24.sent;
|
|
2655
2920
|
if (customerId) {
|
|
2656
|
-
|
|
2921
|
+
_context24.next = 10;
|
|
2657
2922
|
break;
|
|
2658
2923
|
}
|
|
2659
|
-
return
|
|
2924
|
+
return _context24.abrupt("return", buildPlannerDiscountResult({
|
|
2660
2925
|
customerId: null,
|
|
2661
2926
|
discountList: this.getDiscountList(),
|
|
2662
2927
|
products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
|
|
@@ -2665,7 +2930,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2665
2930
|
status: 'no_customer'
|
|
2666
2931
|
}));
|
|
2667
2932
|
case 10:
|
|
2668
|
-
|
|
2933
|
+
_context24.next = 12;
|
|
2669
2934
|
return this.loadDiscountConfig({
|
|
2670
2935
|
customerId: customerId,
|
|
2671
2936
|
action: 'create'
|
|
@@ -2677,7 +2942,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2677
2942
|
return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
|
|
2678
2943
|
});
|
|
2679
2944
|
if (!preferredDiscount) {
|
|
2680
|
-
|
|
2945
|
+
_context24.next = 40;
|
|
2681
2946
|
break;
|
|
2682
2947
|
}
|
|
2683
2948
|
// A requested card is an explicit UI choice, not a best-effort preference. Clear prior
|
|
@@ -2689,98 +2954,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2689
2954
|
return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
|
|
2690
2955
|
});
|
|
2691
2956
|
_iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
|
|
2692
|
-
|
|
2957
|
+
_context24.prev = 18;
|
|
2693
2958
|
_iterator2.s();
|
|
2694
2959
|
case 20:
|
|
2695
2960
|
if ((_step2 = _iterator2.n()).done) {
|
|
2696
|
-
|
|
2961
|
+
_context24.next = 28;
|
|
2697
2962
|
break;
|
|
2698
2963
|
}
|
|
2699
2964
|
discount = _step2.value;
|
|
2700
2965
|
discountId = Number(resolvePlannerDiscountId(discount));
|
|
2701
2966
|
if (!Number.isFinite(discountId)) {
|
|
2702
|
-
|
|
2967
|
+
_context24.next = 26;
|
|
2703
2968
|
break;
|
|
2704
2969
|
}
|
|
2705
|
-
|
|
2970
|
+
_context24.next = 26;
|
|
2706
2971
|
return this.setDiscountSelected({
|
|
2707
2972
|
discountId: discountId,
|
|
2708
2973
|
isSelected: false
|
|
2709
2974
|
});
|
|
2710
2975
|
case 26:
|
|
2711
|
-
|
|
2976
|
+
_context24.next = 20;
|
|
2712
2977
|
break;
|
|
2713
2978
|
case 28:
|
|
2714
|
-
|
|
2979
|
+
_context24.next = 33;
|
|
2715
2980
|
break;
|
|
2716
2981
|
case 30:
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
_iterator2.e(
|
|
2982
|
+
_context24.prev = 30;
|
|
2983
|
+
_context24.t0 = _context24["catch"](18);
|
|
2984
|
+
_iterator2.e(_context24.t0);
|
|
2720
2985
|
case 33:
|
|
2721
|
-
|
|
2986
|
+
_context24.prev = 33;
|
|
2722
2987
|
_iterator2.f();
|
|
2723
|
-
return
|
|
2988
|
+
return _context24.finish(33);
|
|
2724
2989
|
case 36:
|
|
2725
|
-
|
|
2990
|
+
_context24.next = 38;
|
|
2726
2991
|
return this.setDiscountSelected({
|
|
2727
2992
|
discountId: Number(preferredId),
|
|
2728
2993
|
isSelected: true
|
|
2729
2994
|
});
|
|
2730
2995
|
case 38:
|
|
2731
|
-
|
|
2996
|
+
_context24.next = 49;
|
|
2732
2997
|
break;
|
|
2733
2998
|
case 40:
|
|
2734
2999
|
if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
|
|
2735
|
-
|
|
3000
|
+
_context24.next = 46;
|
|
2736
3001
|
break;
|
|
2737
3002
|
}
|
|
2738
3003
|
if (!(params.applyBestDiscount !== false)) {
|
|
2739
|
-
|
|
3004
|
+
_context24.next = 44;
|
|
2740
3005
|
break;
|
|
2741
3006
|
}
|
|
2742
|
-
|
|
3007
|
+
_context24.next = 44;
|
|
2743
3008
|
return this.bestDiscount();
|
|
2744
3009
|
case 44:
|
|
2745
|
-
|
|
3010
|
+
_context24.next = 49;
|
|
2746
3011
|
break;
|
|
2747
3012
|
case 46:
|
|
2748
3013
|
if (!(params.applyBestDiscount !== false)) {
|
|
2749
|
-
|
|
3014
|
+
_context24.next = 49;
|
|
2750
3015
|
break;
|
|
2751
3016
|
}
|
|
2752
|
-
|
|
3017
|
+
_context24.next = 49;
|
|
2753
3018
|
return this.bestDiscount();
|
|
2754
3019
|
case 49:
|
|
2755
3020
|
nextTempOrder = this.getTempOrder();
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
3021
|
+
_context24.t1 = buildPlannerDiscountResult;
|
|
3022
|
+
_context24.t2 = customerId;
|
|
3023
|
+
_context24.t3 = this.getDiscountList();
|
|
3024
|
+
_context24.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
|
|
3025
|
+
_context24.t5 = summaryBefore;
|
|
3026
|
+
_context24.next = 57;
|
|
2762
3027
|
return this.getSummary();
|
|
2763
3028
|
case 57:
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
customerId:
|
|
2770
|
-
discountList:
|
|
2771
|
-
products:
|
|
2772
|
-
summaryBefore:
|
|
2773
|
-
summaryAfter:
|
|
2774
|
-
status:
|
|
2775
|
-
preferredDiscountId:
|
|
2776
|
-
preferredDiscountFound:
|
|
3029
|
+
_context24.t6 = _context24.sent;
|
|
3030
|
+
_context24.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
|
|
3031
|
+
_context24.t8 = preferredDiscountId;
|
|
3032
|
+
_context24.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
|
|
3033
|
+
_context24.t10 = {
|
|
3034
|
+
customerId: _context24.t2,
|
|
3035
|
+
discountList: _context24.t3,
|
|
3036
|
+
products: _context24.t4,
|
|
3037
|
+
summaryBefore: _context24.t5,
|
|
3038
|
+
summaryAfter: _context24.t6,
|
|
3039
|
+
status: _context24.t7,
|
|
3040
|
+
preferredDiscountId: _context24.t8,
|
|
3041
|
+
preferredDiscountFound: _context24.t9
|
|
2777
3042
|
};
|
|
2778
|
-
return
|
|
3043
|
+
return _context24.abrupt("return", (0, _context24.t1)(_context24.t10));
|
|
2779
3044
|
case 63:
|
|
2780
3045
|
case "end":
|
|
2781
|
-
return
|
|
3046
|
+
return _context24.stop();
|
|
2782
3047
|
}
|
|
2783
|
-
},
|
|
3048
|
+
}, _callee24, this, [[18, 30, 33, 36]]);
|
|
2784
3049
|
}));
|
|
2785
3050
|
function applyPlannerDiscounts() {
|
|
2786
3051
|
return _applyPlannerDiscounts.apply(this, arguments);
|
|
@@ -2790,16 +3055,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2790
3055
|
}, {
|
|
2791
3056
|
key: "buildUnifiedOrderProduct",
|
|
2792
3057
|
value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
|
|
2793
|
-
var
|
|
3058
|
+
var _ref38, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref39, _sourceProduct$produc, _ref40, _ref41, _sourceProduct$quanti, _sourceProduct$price, _ref42, _ref43, _sourceProduct$sellin;
|
|
2794
3059
|
var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
|
|
2795
|
-
var quotationShelfId = (
|
|
3060
|
+
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;
|
|
2796
3061
|
var orderProduct = this.transformBaseProductToOrderProduct({
|
|
2797
3062
|
payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
|
|
2798
3063
|
id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
|
|
2799
|
-
product_id: (
|
|
2800
|
-
quantity: (
|
|
3064
|
+
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,
|
|
3065
|
+
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,
|
|
2801
3066
|
price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
|
|
2802
|
-
selling_price: (
|
|
3067
|
+
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,
|
|
2803
3068
|
metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
|
|
2804
3069
|
}),
|
|
2805
3070
|
sourceProduct: sourceProduct
|
|
@@ -2818,29 +3083,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2818
3083
|
}, {
|
|
2819
3084
|
key: "removeExistingStagedLines",
|
|
2820
3085
|
value: (function () {
|
|
2821
|
-
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3086
|
+
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(ownershipKey) {
|
|
2822
3087
|
var _this$getTempOrder;
|
|
2823
3088
|
var existingLines;
|
|
2824
|
-
return _regeneratorRuntime().wrap(function
|
|
2825
|
-
while (1) switch (
|
|
3089
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
3090
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2826
3091
|
case 0:
|
|
2827
3092
|
existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
|
|
2828
3093
|
var _product$metadata4;
|
|
2829
3094
|
return (product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4[ownershipKey]) === true;
|
|
2830
3095
|
});
|
|
2831
3096
|
if (!(existingLines.length > 0)) {
|
|
2832
|
-
|
|
3097
|
+
_context25.next = 4;
|
|
2833
3098
|
break;
|
|
2834
3099
|
}
|
|
2835
|
-
|
|
3100
|
+
_context25.next = 4;
|
|
2836
3101
|
return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
|
|
2837
3102
|
case 4:
|
|
2838
3103
|
case "end":
|
|
2839
|
-
return
|
|
3104
|
+
return _context25.stop();
|
|
2840
3105
|
}
|
|
2841
|
-
},
|
|
3106
|
+
}, _callee25, this);
|
|
2842
3107
|
}));
|
|
2843
|
-
function removeExistingStagedLines(
|
|
3108
|
+
function removeExistingStagedLines(_x13) {
|
|
2844
3109
|
return _removeExistingStagedLines.apply(this, arguments);
|
|
2845
3110
|
}
|
|
2846
3111
|
return removeExistingStagedLines;
|
|
@@ -2848,25 +3113,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2848
3113
|
}, {
|
|
2849
3114
|
key: "stageProducts",
|
|
2850
3115
|
value: function () {
|
|
2851
|
-
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3116
|
+
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params, ownershipKey) {
|
|
2852
3117
|
var _params$rawProducts;
|
|
2853
3118
|
var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
|
|
2854
|
-
return _regeneratorRuntime().wrap(function
|
|
2855
|
-
while (1) switch (
|
|
3119
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3120
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2856
3121
|
case 0:
|
|
2857
3122
|
productIds = params.productIds || [];
|
|
2858
3123
|
if (productIds.length) {
|
|
2859
|
-
|
|
3124
|
+
_context26.next = 3;
|
|
2860
3125
|
break;
|
|
2861
3126
|
}
|
|
2862
|
-
return
|
|
3127
|
+
return _context26.abrupt("return", this.getTempOrder());
|
|
2863
3128
|
case 3:
|
|
2864
3129
|
if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
|
|
2865
|
-
|
|
3130
|
+
_context26.next = 7;
|
|
2866
3131
|
break;
|
|
2867
3132
|
}
|
|
2868
3133
|
this.unifiedProductCatalog = params.rawProducts;
|
|
2869
|
-
|
|
3134
|
+
_context26.next = 12;
|
|
2870
3135
|
break;
|
|
2871
3136
|
case 7:
|
|
2872
3137
|
existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
|
|
@@ -2877,15 +3142,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2877
3142
|
return !existingIds.has(String(id));
|
|
2878
3143
|
});
|
|
2879
3144
|
if (!(missingIds.length || params.productLoadParams)) {
|
|
2880
|
-
|
|
3145
|
+
_context26.next = 12;
|
|
2881
3146
|
break;
|
|
2882
3147
|
}
|
|
2883
|
-
|
|
3148
|
+
_context26.next = 12;
|
|
2884
3149
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
2885
3150
|
product_ids: productIds.map(Number).filter(Number.isFinite)
|
|
2886
3151
|
}));
|
|
2887
3152
|
case 12:
|
|
2888
|
-
|
|
3153
|
+
_context26.next = 14;
|
|
2889
3154
|
return this.removeExistingStagedLines(ownershipKey);
|
|
2890
3155
|
case 14:
|
|
2891
3156
|
productIdSet = new Set(productIds.map(function (id) {
|
|
@@ -2898,30 +3163,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2898
3163
|
_i = 0, _arr = selectedProducts;
|
|
2899
3164
|
case 17:
|
|
2900
3165
|
if (!(_i < _arr.length)) {
|
|
2901
|
-
|
|
3166
|
+
_context26.next = 26;
|
|
2902
3167
|
break;
|
|
2903
3168
|
}
|
|
2904
3169
|
sourceProduct = _arr[_i];
|
|
2905
3170
|
productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
|
|
2906
3171
|
if (!productInput) {
|
|
2907
|
-
|
|
3172
|
+
_context26.next = 23;
|
|
2908
3173
|
break;
|
|
2909
3174
|
}
|
|
2910
|
-
|
|
3175
|
+
_context26.next = 23;
|
|
2911
3176
|
return this.addProductToOrder(productInput);
|
|
2912
3177
|
case 23:
|
|
2913
3178
|
_i++;
|
|
2914
|
-
|
|
3179
|
+
_context26.next = 17;
|
|
2915
3180
|
break;
|
|
2916
3181
|
case 26:
|
|
2917
|
-
return
|
|
3182
|
+
return _context26.abrupt("return", this.getTempOrder());
|
|
2918
3183
|
case 27:
|
|
2919
3184
|
case "end":
|
|
2920
|
-
return
|
|
3185
|
+
return _context26.stop();
|
|
2921
3186
|
}
|
|
2922
|
-
},
|
|
3187
|
+
}, _callee26, this);
|
|
2923
3188
|
}));
|
|
2924
|
-
function stageProducts(
|
|
3189
|
+
function stageProducts(_x14, _x15) {
|
|
2925
3190
|
return _stageProducts.apply(this, arguments);
|
|
2926
3191
|
}
|
|
2927
3192
|
return stageProducts;
|
|
@@ -2933,18 +3198,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2933
3198
|
}, {
|
|
2934
3199
|
key: "stageRetailProducts",
|
|
2935
3200
|
value: (function () {
|
|
2936
|
-
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2937
|
-
return _regeneratorRuntime().wrap(function
|
|
2938
|
-
while (1) switch (
|
|
3201
|
+
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
3202
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3203
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2939
3204
|
case 0:
|
|
2940
|
-
return
|
|
3205
|
+
return _context27.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
|
|
2941
3206
|
case 1:
|
|
2942
3207
|
case "end":
|
|
2943
|
-
return
|
|
3208
|
+
return _context27.stop();
|
|
2944
3209
|
}
|
|
2945
|
-
},
|
|
3210
|
+
}, _callee27, this);
|
|
2946
3211
|
}));
|
|
2947
|
-
function stageRetailProducts(
|
|
3212
|
+
function stageRetailProducts(_x16) {
|
|
2948
3213
|
return _stageRetailProducts.apply(this, arguments);
|
|
2949
3214
|
}
|
|
2950
3215
|
return stageRetailProducts;
|
|
@@ -2958,20 +3223,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2958
3223
|
}, {
|
|
2959
3224
|
key: "addRetailProduct",
|
|
2960
3225
|
value: (function () {
|
|
2961
|
-
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2962
|
-
var _params$quantity,
|
|
3226
|
+
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
3227
|
+
var _params$quantity, _ref44, _params$productId, _params$product, _params$product2;
|
|
2963
3228
|
var quantity, productId, sourceProduct, products, orderProduct;
|
|
2964
|
-
return _regeneratorRuntime().wrap(function
|
|
2965
|
-
while (1) switch (
|
|
3229
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3230
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2966
3231
|
case 0:
|
|
2967
3232
|
quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
|
|
2968
3233
|
if (!(!Number.isFinite(quantity) || quantity <= 0)) {
|
|
2969
|
-
|
|
3234
|
+
_context28.next = 3;
|
|
2970
3235
|
break;
|
|
2971
3236
|
}
|
|
2972
3237
|
throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
|
|
2973
3238
|
case 3:
|
|
2974
|
-
productId = (
|
|
3239
|
+
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;
|
|
2975
3240
|
sourceProduct = params.product;
|
|
2976
3241
|
if (!sourceProduct && productId !== undefined && productId !== null) {
|
|
2977
3242
|
sourceProduct = this.unifiedProductCatalog.find(function (product) {
|
|
@@ -2980,22 +3245,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2980
3245
|
});
|
|
2981
3246
|
}
|
|
2982
3247
|
if (!(!sourceProduct && productId !== undefined && productId !== null)) {
|
|
2983
|
-
|
|
3248
|
+
_context28.next = 11;
|
|
2984
3249
|
break;
|
|
2985
3250
|
}
|
|
2986
|
-
|
|
3251
|
+
_context28.next = 9;
|
|
2987
3252
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
2988
3253
|
product_ids: [Number(productId)].filter(Number.isFinite)
|
|
2989
3254
|
}));
|
|
2990
3255
|
case 9:
|
|
2991
|
-
products =
|
|
3256
|
+
products = _context28.sent;
|
|
2992
3257
|
sourceProduct = products.find(function (product) {
|
|
2993
3258
|
var _product$id4;
|
|
2994
3259
|
return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
|
|
2995
3260
|
});
|
|
2996
3261
|
case 11:
|
|
2997
3262
|
if (sourceProduct) {
|
|
2998
|
-
|
|
3263
|
+
_context28.next = 13;
|
|
2999
3264
|
break;
|
|
3000
3265
|
}
|
|
3001
3266
|
throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
|
|
@@ -3004,19 +3269,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3004
3269
|
quantity: quantity
|
|
3005
3270
|
}), 'unified_booking_sales_retail');
|
|
3006
3271
|
if (orderProduct) {
|
|
3007
|
-
|
|
3272
|
+
_context28.next = 16;
|
|
3008
3273
|
break;
|
|
3009
3274
|
}
|
|
3010
3275
|
throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
|
|
3011
3276
|
case 16:
|
|
3012
|
-
return
|
|
3277
|
+
return _context28.abrupt("return", this.addProductToOrder(orderProduct));
|
|
3013
3278
|
case 17:
|
|
3014
3279
|
case "end":
|
|
3015
|
-
return
|
|
3280
|
+
return _context28.stop();
|
|
3016
3281
|
}
|
|
3017
|
-
},
|
|
3282
|
+
}, _callee28, this);
|
|
3018
3283
|
}));
|
|
3019
|
-
function addRetailProduct(
|
|
3284
|
+
function addRetailProduct(_x17) {
|
|
3020
3285
|
return _addRetailProduct.apply(this, arguments);
|
|
3021
3286
|
}
|
|
3022
3287
|
return addRetailProduct;
|
|
@@ -3116,7 +3381,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3116
3381
|
}, {
|
|
3117
3382
|
key: "buildAvailabilityOperatingHoursSnapshot",
|
|
3118
3383
|
value: function buildAvailabilityOperatingHoursSnapshot(params) {
|
|
3119
|
-
var
|
|
3384
|
+
var _this4 = this;
|
|
3120
3385
|
var descriptor = params.prepare._availabilityOperatingHours || {
|
|
3121
3386
|
source: params.prepare.businessHours ? 'prepare_business_hours' : 'default_business_hours',
|
|
3122
3387
|
scheduleIds: []
|
|
@@ -3126,7 +3391,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3126
3391
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3127
3392
|
startAt: "".concat(date, "T").concat(params.businessHours.startTime, ":00"),
|
|
3128
3393
|
endAt: "".concat(date, "T").concat(params.businessHours.endTime, ":00"),
|
|
3129
|
-
fixedOffsetMinutes:
|
|
3394
|
+
fixedOffsetMinutes: _this4.getAvailabilityRuntimeOffsetMinutes(),
|
|
3130
3395
|
rollOverEnd: true
|
|
3131
3396
|
});
|
|
3132
3397
|
return range ? [{
|
|
@@ -3161,7 +3426,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3161
3426
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3162
3427
|
startAt: slot.start_at,
|
|
3163
3428
|
endAt: slot.end_at,
|
|
3164
|
-
fixedOffsetMinutes:
|
|
3429
|
+
fixedOffsetMinutes: _this4.getAvailabilityRuntimeOffsetMinutes(),
|
|
3165
3430
|
rollOverEnd: true
|
|
3166
3431
|
});
|
|
3167
3432
|
return range ? [{
|
|
@@ -3177,7 +3442,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3177
3442
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3178
3443
|
startAt: slot.start_at,
|
|
3179
3444
|
endAt: slot.end_at,
|
|
3180
|
-
fixedOffsetMinutes:
|
|
3445
|
+
fixedOffsetMinutes: _this4.getAvailabilityRuntimeOffsetMinutes(),
|
|
3181
3446
|
rollOverEnd: true
|
|
3182
3447
|
});
|
|
3183
3448
|
return range ? [{
|
|
@@ -3204,46 +3469,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3204
3469
|
}, {
|
|
3205
3470
|
key: "loadAvailabilityProducts",
|
|
3206
3471
|
value: function () {
|
|
3207
|
-
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3472
|
+
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
3208
3473
|
var _prepare$catalogScope,
|
|
3209
3474
|
_prepare$catalogScope2,
|
|
3210
|
-
|
|
3475
|
+
_this5 = this,
|
|
3211
3476
|
_prepare$resourceIds;
|
|
3212
3477
|
var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
|
|
3213
|
-
return _regeneratorRuntime().wrap(function
|
|
3214
|
-
while (1) switch (
|
|
3478
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3479
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3215
3480
|
case 0:
|
|
3216
3481
|
prepare = params.prepare, dateRange = params.dateRange;
|
|
3217
3482
|
explicitProductIds = prepare.productIds || [];
|
|
3218
3483
|
rawProducts = [];
|
|
3219
3484
|
if (!Array.isArray(prepare.rawProducts)) {
|
|
3220
|
-
|
|
3485
|
+
_context29.next = 8;
|
|
3221
3486
|
break;
|
|
3222
3487
|
}
|
|
3223
3488
|
rawProducts = prepare.rawProducts;
|
|
3224
3489
|
this.unifiedProductCatalog = _toConsumableArray(rawProducts);
|
|
3225
|
-
|
|
3490
|
+
_context29.next = 34;
|
|
3226
3491
|
break;
|
|
3227
3492
|
case 8:
|
|
3228
3493
|
if (!(explicitProductIds.length > 0)) {
|
|
3229
|
-
|
|
3494
|
+
_context29.next = 14;
|
|
3230
3495
|
break;
|
|
3231
3496
|
}
|
|
3232
|
-
|
|
3497
|
+
_context29.next = 11;
|
|
3233
3498
|
return this.loadProducts({
|
|
3234
3499
|
product_ids: explicitProductIds,
|
|
3235
3500
|
schedule_date: dateRange.startDate
|
|
3236
3501
|
});
|
|
3237
3502
|
case 11:
|
|
3238
|
-
rawProducts =
|
|
3239
|
-
|
|
3503
|
+
rawProducts = _context29.sent;
|
|
3504
|
+
_context29.next = 34;
|
|
3240
3505
|
break;
|
|
3241
3506
|
case 14:
|
|
3242
3507
|
if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
|
|
3243
|
-
|
|
3508
|
+
_context29.next = 30;
|
|
3244
3509
|
break;
|
|
3245
3510
|
}
|
|
3246
|
-
|
|
3511
|
+
_context29.next = 17;
|
|
3247
3512
|
return this.loadScheduleAvailableDate({
|
|
3248
3513
|
startDate: dateRange.startDate,
|
|
3249
3514
|
endDate: dateRange.endDate,
|
|
@@ -3259,44 +3524,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3259
3524
|
});
|
|
3260
3525
|
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)) || [])));
|
|
3261
3526
|
if (!(productIds.length > 0)) {
|
|
3262
|
-
|
|
3527
|
+
_context29.next = 27;
|
|
3263
3528
|
break;
|
|
3264
3529
|
}
|
|
3265
3530
|
assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
|
|
3266
|
-
|
|
3531
|
+
_context29.next = 24;
|
|
3267
3532
|
return this.loadProducts({
|
|
3268
3533
|
product_ids: productIds,
|
|
3269
3534
|
schedule_date: dateRange.startDate
|
|
3270
3535
|
});
|
|
3271
3536
|
case 24:
|
|
3272
|
-
rawProducts =
|
|
3273
|
-
|
|
3537
|
+
rawProducts = _context29.sent;
|
|
3538
|
+
_context29.next = 28;
|
|
3274
3539
|
break;
|
|
3275
3540
|
case 27:
|
|
3276
3541
|
this.unifiedProductCatalog = [];
|
|
3277
3542
|
case 28:
|
|
3278
|
-
|
|
3543
|
+
_context29.next = 34;
|
|
3279
3544
|
break;
|
|
3280
3545
|
case 30:
|
|
3281
3546
|
if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
|
|
3282
|
-
|
|
3547
|
+
_context29.next = 34;
|
|
3283
3548
|
break;
|
|
3284
3549
|
}
|
|
3285
|
-
|
|
3550
|
+
_context29.next = 33;
|
|
3286
3551
|
return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
|
|
3287
3552
|
schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
|
|
3288
3553
|
}));
|
|
3289
3554
|
case 33:
|
|
3290
|
-
rawProducts =
|
|
3555
|
+
rawProducts = _context29.sent;
|
|
3291
3556
|
case 34:
|
|
3292
3557
|
normalized = rawProducts.map(function (product) {
|
|
3293
|
-
return normalizeProductForAvailability(product, params.scheduleList,
|
|
3558
|
+
return normalizeProductForAvailability(product, params.scheduleList, _this5.getAvailabilityRuntimeOffsetMinutes());
|
|
3294
3559
|
});
|
|
3295
3560
|
if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
|
|
3296
|
-
|
|
3561
|
+
_context29.next = 37;
|
|
3297
3562
|
break;
|
|
3298
3563
|
}
|
|
3299
|
-
return
|
|
3564
|
+
return _context29.abrupt("return", normalized.filter(function (product) {
|
|
3300
3565
|
var _product$requirementG2;
|
|
3301
3566
|
return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
|
|
3302
3567
|
var _group$resourceIds3;
|
|
@@ -3309,16 +3574,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3309
3574
|
}));
|
|
3310
3575
|
case 37:
|
|
3311
3576
|
productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
|
|
3312
|
-
return
|
|
3577
|
+
return _context29.abrupt("return", productIdSet ? normalized.filter(function (product) {
|
|
3313
3578
|
return productIdSet.has(String(product.id));
|
|
3314
3579
|
}) : normalized);
|
|
3315
3580
|
case 39:
|
|
3316
3581
|
case "end":
|
|
3317
|
-
return
|
|
3582
|
+
return _context29.stop();
|
|
3318
3583
|
}
|
|
3319
|
-
},
|
|
3584
|
+
}, _callee29, this);
|
|
3320
3585
|
}));
|
|
3321
|
-
function loadAvailabilityProducts(
|
|
3586
|
+
function loadAvailabilityProducts(_x18) {
|
|
3322
3587
|
return _loadAvailabilityProducts.apply(this, arguments);
|
|
3323
3588
|
}
|
|
3324
3589
|
return loadAvailabilityProducts;
|
|
@@ -3331,12 +3596,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3331
3596
|
}, {
|
|
3332
3597
|
key: "fetchAvailabilityResourcesV2",
|
|
3333
3598
|
value: (function () {
|
|
3334
|
-
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3599
|
+
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
3335
3600
|
var response, data;
|
|
3336
|
-
return _regeneratorRuntime().wrap(function
|
|
3337
|
-
while (1) switch (
|
|
3601
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3602
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3338
3603
|
case 0:
|
|
3339
|
-
|
|
3604
|
+
_context30.next = 2;
|
|
3340
3605
|
return this.request.get('/schedule/resource/list/v2', {
|
|
3341
3606
|
start_date: params.dateRange.startDate,
|
|
3342
3607
|
end_date: params.dateRange.endDate,
|
|
@@ -3346,28 +3611,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3346
3611
|
useCache: false
|
|
3347
3612
|
});
|
|
3348
3613
|
case 2:
|
|
3349
|
-
response =
|
|
3614
|
+
response = _context30.sent;
|
|
3350
3615
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
3351
3616
|
if (!Array.isArray(data)) {
|
|
3352
|
-
|
|
3617
|
+
_context30.next = 6;
|
|
3353
3618
|
break;
|
|
3354
3619
|
}
|
|
3355
|
-
return
|
|
3620
|
+
return _context30.abrupt("return", data);
|
|
3356
3621
|
case 6:
|
|
3357
3622
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
|
|
3358
|
-
|
|
3623
|
+
_context30.next = 8;
|
|
3359
3624
|
break;
|
|
3360
3625
|
}
|
|
3361
|
-
return
|
|
3626
|
+
return _context30.abrupt("return", data.list);
|
|
3362
3627
|
case 8:
|
|
3363
|
-
return
|
|
3628
|
+
return _context30.abrupt("return", []);
|
|
3364
3629
|
case 9:
|
|
3365
3630
|
case "end":
|
|
3366
|
-
return
|
|
3631
|
+
return _context30.stop();
|
|
3367
3632
|
}
|
|
3368
|
-
},
|
|
3633
|
+
}, _callee30, this);
|
|
3369
3634
|
}));
|
|
3370
|
-
function fetchAvailabilityResourcesV2(
|
|
3635
|
+
function fetchAvailabilityResourcesV2(_x19) {
|
|
3371
3636
|
return _fetchAvailabilityResourcesV.apply(this, arguments);
|
|
3372
3637
|
}
|
|
3373
3638
|
return fetchAvailabilityResourcesV2;
|
|
@@ -3375,17 +3640,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3375
3640
|
}, {
|
|
3376
3641
|
key: "fetchAndPublishAvailabilityResourcesV2",
|
|
3377
3642
|
value: function () {
|
|
3378
|
-
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3643
|
+
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3379
3644
|
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
|
|
3380
|
-
return _regeneratorRuntime().wrap(function
|
|
3381
|
-
while (1) switch (
|
|
3645
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3646
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3382
3647
|
case 0:
|
|
3383
3648
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
3384
3649
|
if (!(normalizedResourceIds.length === 0)) {
|
|
3385
|
-
|
|
3650
|
+
_context31.next = 3;
|
|
3386
3651
|
break;
|
|
3387
3652
|
}
|
|
3388
|
-
return
|
|
3653
|
+
return _context31.abrupt("return", []);
|
|
3389
3654
|
case 3:
|
|
3390
3655
|
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
3391
3656
|
cacheParams = {
|
|
@@ -3395,7 +3660,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3395
3660
|
};
|
|
3396
3661
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
3397
3662
|
if (!cachedRawResources) {
|
|
3398
|
-
|
|
3663
|
+
_context31.next = 9;
|
|
3399
3664
|
break;
|
|
3400
3665
|
}
|
|
3401
3666
|
if (params.useCacheOnHit) {
|
|
@@ -3407,23 +3672,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3407
3672
|
console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
|
|
3408
3673
|
});
|
|
3409
3674
|
}
|
|
3410
|
-
return
|
|
3675
|
+
return _context31.abrupt("return", cachedRawResources);
|
|
3411
3676
|
case 9:
|
|
3412
|
-
|
|
3677
|
+
_context31.next = 11;
|
|
3413
3678
|
return this.refreshAvailabilityRemoteResourceQuery({
|
|
3414
3679
|
timezone: params.timezone,
|
|
3415
3680
|
dateRange: params.dateRange,
|
|
3416
3681
|
resourceIds: normalizedResourceIds
|
|
3417
3682
|
});
|
|
3418
3683
|
case 11:
|
|
3419
|
-
return
|
|
3684
|
+
return _context31.abrupt("return", _context31.sent);
|
|
3420
3685
|
case 12:
|
|
3421
3686
|
case "end":
|
|
3422
|
-
return
|
|
3687
|
+
return _context31.stop();
|
|
3423
3688
|
}
|
|
3424
|
-
},
|
|
3689
|
+
}, _callee31, this);
|
|
3425
3690
|
}));
|
|
3426
|
-
function fetchAndPublishAvailabilityResourcesV2(
|
|
3691
|
+
function fetchAndPublishAvailabilityResourcesV2(_x20) {
|
|
3427
3692
|
return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
|
|
3428
3693
|
}
|
|
3429
3694
|
return fetchAndPublishAvailabilityResourcesV2;
|
|
@@ -3431,17 +3696,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3431
3696
|
}, {
|
|
3432
3697
|
key: "refreshAvailabilityRemoteResourceQuery",
|
|
3433
3698
|
value: function () {
|
|
3434
|
-
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3699
|
+
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3435
3700
|
var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
|
|
3436
|
-
return _regeneratorRuntime().wrap(function
|
|
3437
|
-
while (1) switch (
|
|
3701
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3702
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3438
3703
|
case 0:
|
|
3439
3704
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
3440
3705
|
if (!(normalizedResourceIds.length === 0)) {
|
|
3441
|
-
|
|
3706
|
+
_context32.next = 3;
|
|
3442
3707
|
break;
|
|
3443
3708
|
}
|
|
3444
|
-
return
|
|
3709
|
+
return _context32.abrupt("return", []);
|
|
3445
3710
|
case 3:
|
|
3446
3711
|
queryKey = this.buildAvailabilityRemoteResourceQueryKey({
|
|
3447
3712
|
timezone: params.timezone,
|
|
@@ -3451,13 +3716,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3451
3716
|
epoch = this.availabilityRemoteResourceEpoch;
|
|
3452
3717
|
existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
3453
3718
|
if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
|
|
3454
|
-
|
|
3719
|
+
_context32.next = 10;
|
|
3455
3720
|
break;
|
|
3456
3721
|
}
|
|
3457
|
-
|
|
3722
|
+
_context32.next = 9;
|
|
3458
3723
|
return existing.promise;
|
|
3459
3724
|
case 9:
|
|
3460
|
-
return
|
|
3725
|
+
return _context32.abrupt("return", _context32.sent);
|
|
3461
3726
|
case 10:
|
|
3462
3727
|
this.availabilityRemoteResourceQuerySequence += 1;
|
|
3463
3728
|
writeVersion = this.availabilityRemoteResourceQuerySequence;
|
|
@@ -3469,11 +3734,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3469
3734
|
epoch: epoch,
|
|
3470
3735
|
promise: promise
|
|
3471
3736
|
});
|
|
3472
|
-
|
|
3473
|
-
|
|
3737
|
+
_context32.prev = 14;
|
|
3738
|
+
_context32.next = 17;
|
|
3474
3739
|
return promise;
|
|
3475
3740
|
case 17:
|
|
3476
|
-
rawResources =
|
|
3741
|
+
rawResources = _context32.sent;
|
|
3477
3742
|
if (epoch === this.availabilityRemoteResourceEpoch) {
|
|
3478
3743
|
this.availabilityRemoteOccupancyCache.publish({
|
|
3479
3744
|
scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
|
|
@@ -3484,21 +3749,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3484
3749
|
version: writeVersion
|
|
3485
3750
|
});
|
|
3486
3751
|
}
|
|
3487
|
-
return
|
|
3752
|
+
return _context32.abrupt("return", rawResources);
|
|
3488
3753
|
case 20:
|
|
3489
|
-
|
|
3754
|
+
_context32.prev = 20;
|
|
3490
3755
|
current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
3491
3756
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
3492
3757
|
this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
|
|
3493
3758
|
}
|
|
3494
|
-
return
|
|
3759
|
+
return _context32.finish(20);
|
|
3495
3760
|
case 24:
|
|
3496
3761
|
case "end":
|
|
3497
|
-
return
|
|
3762
|
+
return _context32.stop();
|
|
3498
3763
|
}
|
|
3499
|
-
},
|
|
3764
|
+
}, _callee32, this, [[14,, 20, 24]]);
|
|
3500
3765
|
}));
|
|
3501
|
-
function refreshAvailabilityRemoteResourceQuery(
|
|
3766
|
+
function refreshAvailabilityRemoteResourceQuery(_x21) {
|
|
3502
3767
|
return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
|
|
3503
3768
|
}
|
|
3504
3769
|
return refreshAvailabilityRemoteResourceQuery;
|
|
@@ -3506,26 +3771,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3506
3771
|
}, {
|
|
3507
3772
|
key: "loadAvailabilityResources",
|
|
3508
3773
|
value: function () {
|
|
3509
|
-
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3774
|
+
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
3510
3775
|
var resourceIds, cachedRawResources, rawResources;
|
|
3511
|
-
return _regeneratorRuntime().wrap(function
|
|
3512
|
-
while (1) switch (
|
|
3776
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3777
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3513
3778
|
case 0:
|
|
3514
3779
|
resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
|
|
3515
3780
|
if (!(resourceIds.length === 0)) {
|
|
3516
|
-
|
|
3781
|
+
_context33.next = 3;
|
|
3517
3782
|
break;
|
|
3518
3783
|
}
|
|
3519
|
-
return
|
|
3784
|
+
return _context33.abrupt("return", {
|
|
3520
3785
|
resources: [],
|
|
3521
3786
|
resourceOccupancies: []
|
|
3522
3787
|
});
|
|
3523
3788
|
case 3:
|
|
3524
3789
|
if (!Array.isArray(params.rawResources)) {
|
|
3525
|
-
|
|
3790
|
+
_context33.next = 5;
|
|
3526
3791
|
break;
|
|
3527
3792
|
}
|
|
3528
|
-
return
|
|
3793
|
+
return _context33.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
3529
3794
|
rawResources: params.rawResources,
|
|
3530
3795
|
scheduleList: params.scheduleList,
|
|
3531
3796
|
dateRange: params.dateRange,
|
|
@@ -3533,7 +3798,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3533
3798
|
}));
|
|
3534
3799
|
case 5:
|
|
3535
3800
|
if (!(params.fetchPolicy === 'cache_only')) {
|
|
3536
|
-
|
|
3801
|
+
_context33.next = 10;
|
|
3537
3802
|
break;
|
|
3538
3803
|
}
|
|
3539
3804
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read({
|
|
@@ -3542,22 +3807,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3542
3807
|
dateRange: params.dateRange
|
|
3543
3808
|
});
|
|
3544
3809
|
if (!cachedRawResources) {
|
|
3545
|
-
|
|
3810
|
+
_context33.next = 9;
|
|
3546
3811
|
break;
|
|
3547
3812
|
}
|
|
3548
|
-
return
|
|
3813
|
+
return _context33.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
3549
3814
|
rawResources: cachedRawResources,
|
|
3550
3815
|
scheduleList: params.scheduleList,
|
|
3551
3816
|
dateRange: params.dateRange,
|
|
3552
3817
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
3553
3818
|
}));
|
|
3554
3819
|
case 9:
|
|
3555
|
-
return
|
|
3820
|
+
return _context33.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
|
|
3556
3821
|
resources: [],
|
|
3557
3822
|
resourceOccupancies: []
|
|
3558
3823
|
});
|
|
3559
3824
|
case 10:
|
|
3560
|
-
|
|
3825
|
+
_context33.next = 12;
|
|
3561
3826
|
return this.fetchAndPublishAvailabilityResourcesV2({
|
|
3562
3827
|
timezone: params.timezone,
|
|
3563
3828
|
dateRange: params.dateRange,
|
|
@@ -3565,8 +3830,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3565
3830
|
useCacheOnHit: true
|
|
3566
3831
|
});
|
|
3567
3832
|
case 12:
|
|
3568
|
-
rawResources =
|
|
3569
|
-
return
|
|
3833
|
+
rawResources = _context33.sent;
|
|
3834
|
+
return _context33.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
3570
3835
|
rawResources: rawResources,
|
|
3571
3836
|
scheduleList: params.scheduleList,
|
|
3572
3837
|
dateRange: params.dateRange,
|
|
@@ -3574,11 +3839,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3574
3839
|
}));
|
|
3575
3840
|
case 14:
|
|
3576
3841
|
case "end":
|
|
3577
|
-
return
|
|
3842
|
+
return _context33.stop();
|
|
3578
3843
|
}
|
|
3579
|
-
},
|
|
3844
|
+
}, _callee33, this);
|
|
3580
3845
|
}));
|
|
3581
|
-
function loadAvailabilityResources(
|
|
3846
|
+
function loadAvailabilityResources(_x22) {
|
|
3582
3847
|
return _loadAvailabilityResources.apply(this, arguments);
|
|
3583
3848
|
}
|
|
3584
3849
|
return loadAvailabilityResources;
|
|
@@ -3598,7 +3863,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3598
3863
|
var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
|
|
3599
3864
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
3600
3865
|
productLineUids.forEach(function (requestedUid) {
|
|
3601
|
-
var
|
|
3866
|
+
var _ref45, _product$booking_uid2, _product$metadata5;
|
|
3602
3867
|
var product = products.find(function (line) {
|
|
3603
3868
|
return getProductLineUid(line) === String(requestedUid);
|
|
3604
3869
|
});
|
|
@@ -3608,7 +3873,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3608
3873
|
});
|
|
3609
3874
|
}
|
|
3610
3875
|
var productUid = getProductLineUid(product);
|
|
3611
|
-
var linkedBookingUid = String((
|
|
3876
|
+
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 : '');
|
|
3612
3877
|
var linkedBookings = bookings.filter(function (booking) {
|
|
3613
3878
|
var _booking$product_uid;
|
|
3614
3879
|
return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
|
|
@@ -3651,24 +3916,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3651
3916
|
}, {
|
|
3652
3917
|
key: "collectCartResourceOccupancies",
|
|
3653
3918
|
value: function collectCartResourceOccupancies(tempOrder, exclusions) {
|
|
3654
|
-
var
|
|
3919
|
+
var _this6 = this;
|
|
3655
3920
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
3656
3921
|
return bookings.flatMap(function (booking) {
|
|
3657
|
-
var
|
|
3922
|
+
var _ref46, _booking$product_uid2, _booking$metadata2;
|
|
3658
3923
|
var bookingUid = getBookingUid(booking);
|
|
3659
|
-
var productUid = String((
|
|
3924
|
+
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 : '');
|
|
3660
3925
|
var scheduleEventId = toNumberId(booking.schedule_event_id);
|
|
3661
3926
|
var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
|
|
3662
3927
|
var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
|
|
3663
3928
|
var resources = Array.isArray(booking.resources) ? booking.resources : [];
|
|
3664
3929
|
return resources.flatMap(function (resource) {
|
|
3665
|
-
var
|
|
3666
|
-
var resourceId = (
|
|
3930
|
+
var _ref47, _resource$resource_id, _ref48, _resource$capacity;
|
|
3931
|
+
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;
|
|
3667
3932
|
if (resourceId == null || !startAt || !endAt) return [];
|
|
3668
3933
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3669
3934
|
startAt: startAt,
|
|
3670
3935
|
endAt: endAt,
|
|
3671
|
-
fixedOffsetMinutes:
|
|
3936
|
+
fixedOffsetMinutes: _this6.getAvailabilityRuntimeOffsetMinutes(),
|
|
3672
3937
|
rollOverEnd: false
|
|
3673
3938
|
});
|
|
3674
3939
|
if (!range) return [];
|
|
@@ -3676,7 +3941,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3676
3941
|
resourceId: resourceId,
|
|
3677
3942
|
startAt: range.startAt,
|
|
3678
3943
|
endAt: range.endAt,
|
|
3679
|
-
pax: Math.max(1, Number((
|
|
3944
|
+
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),
|
|
3680
3945
|
source: 'cart',
|
|
3681
3946
|
scheduleEventId: scheduleEventId,
|
|
3682
3947
|
bookingUid: bookingUid || undefined,
|
|
@@ -3686,7 +3951,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3686
3951
|
resource: resource
|
|
3687
3952
|
}
|
|
3688
3953
|
};
|
|
3689
|
-
return
|
|
3954
|
+
return _this6.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
|
|
3690
3955
|
});
|
|
3691
3956
|
});
|
|
3692
3957
|
}
|
|
@@ -3753,16 +4018,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3753
4018
|
}, {
|
|
3754
4019
|
key: "assertContextualQueryFreshness",
|
|
3755
4020
|
value: function assertContextualQueryFreshness(context, request) {
|
|
3756
|
-
var
|
|
4021
|
+
var _this7 = this;
|
|
3757
4022
|
if (request.target === 'time') {
|
|
3758
4023
|
request.candidates.forEach(function (candidate) {
|
|
3759
|
-
|
|
4024
|
+
_this7.assertAvailabilityCandidateFreshness(context, candidate);
|
|
3760
4025
|
});
|
|
3761
4026
|
return;
|
|
3762
4027
|
}
|
|
3763
4028
|
if (request.target === 'resource') {
|
|
3764
4029
|
request.selectedRanges.forEach(function (candidate) {
|
|
3765
|
-
|
|
4030
|
+
_this7.assertAvailabilityCandidateFreshness(context, candidate);
|
|
3766
4031
|
});
|
|
3767
4032
|
}
|
|
3768
4033
|
}
|
|
@@ -3809,8 +4074,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3809
4074
|
}, {
|
|
3810
4075
|
key: "buildAvailabilityProjectionSnapshot",
|
|
3811
4076
|
value: function () {
|
|
3812
|
-
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3813
|
-
var
|
|
4077
|
+
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
4078
|
+
var _this8 = this;
|
|
3814
4079
|
var options,
|
|
3815
4080
|
normalizedPrepareParams,
|
|
3816
4081
|
timezoneLabel,
|
|
@@ -3831,11 +4096,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3831
4096
|
durationCandidateAnchorAt,
|
|
3832
4097
|
orderRevision,
|
|
3833
4098
|
projection,
|
|
3834
|
-
|
|
3835
|
-
return _regeneratorRuntime().wrap(function
|
|
3836
|
-
while (1) switch (
|
|
4099
|
+
_args34 = arguments;
|
|
4100
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
4101
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3837
4102
|
case 0:
|
|
3838
|
-
options =
|
|
4103
|
+
options = _args34.length > 1 && _args34[1] !== undefined ? _args34[1] : {};
|
|
3839
4104
|
normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
3840
4105
|
timezoneLabel = String(normalizedPrepareParams.timezone);
|
|
3841
4106
|
dateRange = normalizedPrepareParams.dateRange;
|
|
@@ -3849,15 +4114,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3849
4114
|
scheduleList: scheduleList,
|
|
3850
4115
|
businessHours: businessHours
|
|
3851
4116
|
});
|
|
3852
|
-
|
|
4117
|
+
_context34.next = 11;
|
|
3853
4118
|
return this.loadAvailabilityProducts({
|
|
3854
4119
|
prepare: normalizedPrepareParams,
|
|
3855
4120
|
dateRange: dateRange,
|
|
3856
4121
|
scheduleList: scheduleList
|
|
3857
4122
|
});
|
|
3858
4123
|
case 11:
|
|
3859
|
-
products =
|
|
3860
|
-
|
|
4124
|
+
products = _context34.sent;
|
|
4125
|
+
_context34.next = 14;
|
|
3861
4126
|
return this.loadAvailabilityResources({
|
|
3862
4127
|
timezone: timezoneLabel,
|
|
3863
4128
|
dateRange: dateRange,
|
|
@@ -3869,14 +4134,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3869
4134
|
fallbackResources: options.fallbackResources
|
|
3870
4135
|
});
|
|
3871
4136
|
case 14:
|
|
3872
|
-
loadedResources =
|
|
4137
|
+
loadedResources = _context34.sent;
|
|
3873
4138
|
tempOrder = this.getTempOrder();
|
|
3874
4139
|
exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
|
|
3875
4140
|
injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
|
|
3876
4141
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3877
4142
|
startAt: occupancy.startAt,
|
|
3878
4143
|
endAt: occupancy.endAt,
|
|
3879
|
-
fixedOffsetMinutes:
|
|
4144
|
+
fixedOffsetMinutes: _this8.getAvailabilityRuntimeOffsetMinutes(),
|
|
3880
4145
|
rollOverEnd: false
|
|
3881
4146
|
});
|
|
3882
4147
|
if (!range) return [];
|
|
@@ -3886,7 +4151,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3886
4151
|
})];
|
|
3887
4152
|
});
|
|
3888
4153
|
remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
|
|
3889
|
-
return !
|
|
4154
|
+
return !_this8.occupancyIsExcluded(occupancy, exclusions);
|
|
3890
4155
|
});
|
|
3891
4156
|
cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
|
|
3892
4157
|
preparedAt = this.getAvailabilityRuntimeDateTime();
|
|
@@ -3915,18 +4180,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3915
4180
|
prepareParams: normalizedPrepareParams,
|
|
3916
4181
|
durationCandidateAnchorAt: durationCandidateAnchorAt
|
|
3917
4182
|
});
|
|
3918
|
-
return
|
|
4183
|
+
return _context34.abrupt("return", {
|
|
3919
4184
|
projection: projection,
|
|
3920
4185
|
prepareParams: normalizedPrepareParams,
|
|
3921
4186
|
orderRevision: orderRevision
|
|
3922
4187
|
});
|
|
3923
4188
|
case 26:
|
|
3924
4189
|
case "end":
|
|
3925
|
-
return
|
|
4190
|
+
return _context34.stop();
|
|
3926
4191
|
}
|
|
3927
|
-
},
|
|
4192
|
+
}, _callee34, this);
|
|
3928
4193
|
}));
|
|
3929
|
-
function buildAvailabilityProjectionSnapshot(
|
|
4194
|
+
function buildAvailabilityProjectionSnapshot(_x23) {
|
|
3930
4195
|
return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
|
|
3931
4196
|
}
|
|
3932
4197
|
return buildAvailabilityProjectionSnapshot;
|
|
@@ -3934,10 +4199,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3934
4199
|
}, {
|
|
3935
4200
|
key: "getSharedPreparedAvailabilitySnapshot",
|
|
3936
4201
|
value: function () {
|
|
3937
|
-
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4202
|
+
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
3938
4203
|
var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
|
|
3939
|
-
return _regeneratorRuntime().wrap(function
|
|
3940
|
-
while (1) switch (
|
|
4204
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
4205
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3941
4206
|
case 0:
|
|
3942
4207
|
lifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
3943
4208
|
normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
@@ -3956,15 +4221,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3956
4221
|
}
|
|
3957
4222
|
})) : this.buildAvailabilityPrepareKey(normalizedParams);
|
|
3958
4223
|
if (!hasRawInputs) {
|
|
3959
|
-
|
|
4224
|
+
_context35.next = 11;
|
|
3960
4225
|
break;
|
|
3961
4226
|
}
|
|
3962
|
-
|
|
4227
|
+
_context35.next = 7;
|
|
3963
4228
|
return this.buildAvailabilityProjectionSnapshot(normalizedParams);
|
|
3964
4229
|
case 7:
|
|
3965
|
-
snapshot =
|
|
4230
|
+
snapshot = _context35.sent;
|
|
3966
4231
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
3967
|
-
|
|
4232
|
+
_context35.next = 10;
|
|
3968
4233
|
break;
|
|
3969
4234
|
}
|
|
3970
4235
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -3973,7 +4238,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3973
4238
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
3974
4239
|
});
|
|
3975
4240
|
case 10:
|
|
3976
|
-
return
|
|
4241
|
+
return _context35.abrupt("return", {
|
|
3977
4242
|
prepareKey: prepareKey,
|
|
3978
4243
|
snapshot: snapshot
|
|
3979
4244
|
});
|
|
@@ -3987,13 +4252,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3987
4252
|
promise: promise
|
|
3988
4253
|
});
|
|
3989
4254
|
}
|
|
3990
|
-
|
|
3991
|
-
|
|
4255
|
+
_context35.prev = 14;
|
|
4256
|
+
_context35.next = 17;
|
|
3992
4257
|
return promise;
|
|
3993
4258
|
case 17:
|
|
3994
|
-
_snapshot =
|
|
4259
|
+
_snapshot = _context35.sent;
|
|
3995
4260
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
3996
|
-
|
|
4261
|
+
_context35.next = 20;
|
|
3997
4262
|
break;
|
|
3998
4263
|
}
|
|
3999
4264
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -4002,24 +4267,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4002
4267
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
4003
4268
|
});
|
|
4004
4269
|
case 20:
|
|
4005
|
-
return
|
|
4270
|
+
return _context35.abrupt("return", {
|
|
4006
4271
|
prepareKey: prepareKey,
|
|
4007
4272
|
snapshot: _snapshot
|
|
4008
4273
|
});
|
|
4009
4274
|
case 21:
|
|
4010
|
-
|
|
4275
|
+
_context35.prev = 21;
|
|
4011
4276
|
current = this.availabilityPrepareInFlight.get(prepareKey);
|
|
4012
4277
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4013
4278
|
this.availabilityPrepareInFlight.delete(prepareKey);
|
|
4014
4279
|
}
|
|
4015
|
-
return
|
|
4280
|
+
return _context35.finish(21);
|
|
4016
4281
|
case 25:
|
|
4017
4282
|
case "end":
|
|
4018
|
-
return
|
|
4283
|
+
return _context35.stop();
|
|
4019
4284
|
}
|
|
4020
|
-
},
|
|
4285
|
+
}, _callee35, this, [[14,, 21, 25]]);
|
|
4021
4286
|
}));
|
|
4022
|
-
function getSharedPreparedAvailabilitySnapshot(
|
|
4287
|
+
function getSharedPreparedAvailabilitySnapshot(_x24) {
|
|
4023
4288
|
return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
|
|
4024
4289
|
}
|
|
4025
4290
|
return getSharedPreparedAvailabilitySnapshot;
|
|
@@ -4027,51 +4292,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4027
4292
|
}, {
|
|
4028
4293
|
key: "refreshAvailabilityContextProjection",
|
|
4029
4294
|
value: function () {
|
|
4030
|
-
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4031
|
-
var
|
|
4295
|
+
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
4296
|
+
var _this9 = this;
|
|
4032
4297
|
var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
|
|
4033
|
-
return _regeneratorRuntime().wrap(function
|
|
4034
|
-
while (1) switch (
|
|
4298
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
4299
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
4035
4300
|
case 0:
|
|
4036
4301
|
existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
4037
4302
|
if (!existingInFlight) {
|
|
4038
|
-
|
|
4303
|
+
_context37.next = 5;
|
|
4039
4304
|
break;
|
|
4040
4305
|
}
|
|
4041
|
-
|
|
4306
|
+
_context37.next = 4;
|
|
4042
4307
|
return existingInFlight;
|
|
4043
4308
|
case 4:
|
|
4044
|
-
return
|
|
4309
|
+
return _context37.abrupt("return", _context37.sent);
|
|
4045
4310
|
case 5:
|
|
4046
4311
|
context = this.getAvailabilityContextEntry(params.contextId);
|
|
4047
4312
|
expectedVersion = context.activeVersion;
|
|
4048
4313
|
expectedRefreshNonce = context.refreshNonce;
|
|
4049
4314
|
expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
4050
|
-
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4315
|
+
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
4051
4316
|
var snapshot, currentContext, projectionEntry;
|
|
4052
|
-
return _regeneratorRuntime().wrap(function
|
|
4053
|
-
while (1) switch (
|
|
4317
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
4318
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
4054
4319
|
case 0:
|
|
4055
|
-
|
|
4056
|
-
return
|
|
4320
|
+
_context36.next = 2;
|
|
4321
|
+
return _this9.buildAvailabilityProjectionSnapshot(_this9.cloneAvailabilityPrepareParams(context.prepareParams), {
|
|
4057
4322
|
durationCandidateAnchorAt: context.durationCandidateAnchorAt
|
|
4058
4323
|
});
|
|
4059
4324
|
case 2:
|
|
4060
|
-
snapshot =
|
|
4061
|
-
currentContext =
|
|
4325
|
+
snapshot = _context36.sent;
|
|
4326
|
+
currentContext = _this9.availabilityContextRegistry.get(params.contextId);
|
|
4062
4327
|
if (currentContext) {
|
|
4063
|
-
|
|
4328
|
+
_context36.next = 6;
|
|
4064
4329
|
break;
|
|
4065
4330
|
}
|
|
4066
|
-
return
|
|
4331
|
+
return _context36.abrupt("return", null);
|
|
4067
4332
|
case 6:
|
|
4068
|
-
if (!(expectedLifecycleGeneration !==
|
|
4069
|
-
|
|
4333
|
+
if (!(expectedLifecycleGeneration !== _this9.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
|
|
4334
|
+
_context36.next = 8;
|
|
4070
4335
|
break;
|
|
4071
4336
|
}
|
|
4072
|
-
return
|
|
4337
|
+
return _context36.abrupt("return", null);
|
|
4073
4338
|
case 8:
|
|
4074
|
-
projectionEntry =
|
|
4339
|
+
projectionEntry = _this9.storeAvailabilityProjectionEntry({
|
|
4075
4340
|
contextId: currentContext.contextId,
|
|
4076
4341
|
prepareParams: snapshot.prepareParams,
|
|
4077
4342
|
prepareKey: currentContext.prepareKey,
|
|
@@ -4079,8 +4344,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4079
4344
|
orderRevision: snapshot.orderRevision,
|
|
4080
4345
|
incrementVersion: true
|
|
4081
4346
|
});
|
|
4082
|
-
|
|
4083
|
-
return
|
|
4347
|
+
_context36.next = 11;
|
|
4348
|
+
return _this9.emitAvailabilityDiagnostic({
|
|
4084
4349
|
action: 'refresh',
|
|
4085
4350
|
contextId: currentContext.contextId,
|
|
4086
4351
|
contextVersion: projectionEntry.contextVersion,
|
|
@@ -4091,33 +4356,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4091
4356
|
reason: params.reason
|
|
4092
4357
|
});
|
|
4093
4358
|
case 11:
|
|
4094
|
-
return
|
|
4359
|
+
return _context36.abrupt("return", projectionEntry);
|
|
4095
4360
|
case 12:
|
|
4096
4361
|
case "end":
|
|
4097
|
-
return
|
|
4362
|
+
return _context36.stop();
|
|
4098
4363
|
}
|
|
4099
|
-
},
|
|
4364
|
+
}, _callee36);
|
|
4100
4365
|
}))();
|
|
4101
4366
|
this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
|
|
4102
|
-
|
|
4103
|
-
|
|
4367
|
+
_context37.prev = 11;
|
|
4368
|
+
_context37.next = 14;
|
|
4104
4369
|
return refreshPromise;
|
|
4105
4370
|
case 14:
|
|
4106
|
-
return
|
|
4371
|
+
return _context37.abrupt("return", _context37.sent);
|
|
4107
4372
|
case 15:
|
|
4108
|
-
|
|
4373
|
+
_context37.prev = 15;
|
|
4109
4374
|
current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
4110
4375
|
if (current === refreshPromise) {
|
|
4111
4376
|
this.availabilityProjectionRefreshInFlight.delete(params.contextId);
|
|
4112
4377
|
}
|
|
4113
|
-
return
|
|
4378
|
+
return _context37.finish(15);
|
|
4114
4379
|
case 19:
|
|
4115
4380
|
case "end":
|
|
4116
|
-
return
|
|
4381
|
+
return _context37.stop();
|
|
4117
4382
|
}
|
|
4118
|
-
},
|
|
4383
|
+
}, _callee37, this, [[11,, 15, 19]]);
|
|
4119
4384
|
}));
|
|
4120
|
-
function refreshAvailabilityContextProjection(
|
|
4385
|
+
function refreshAvailabilityContextProjection(_x25) {
|
|
4121
4386
|
return _refreshAvailabilityContextProjection.apply(this, arguments);
|
|
4122
4387
|
}
|
|
4123
4388
|
return refreshAvailabilityContextProjection;
|
|
@@ -4125,53 +4390,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4125
4390
|
}, {
|
|
4126
4391
|
key: "ensureAvailabilityContextProjection",
|
|
4127
4392
|
value: function () {
|
|
4128
|
-
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4393
|
+
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(contextId, reason) {
|
|
4129
4394
|
var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
|
|
4130
|
-
return _regeneratorRuntime().wrap(function
|
|
4131
|
-
while (1) switch (
|
|
4395
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
4396
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
4132
4397
|
case 0:
|
|
4133
4398
|
retries = 0;
|
|
4134
4399
|
case 1:
|
|
4135
4400
|
if (!(retries < 3)) {
|
|
4136
|
-
|
|
4401
|
+
_context38.next = 19;
|
|
4137
4402
|
break;
|
|
4138
4403
|
}
|
|
4139
4404
|
context = this.getAvailabilityContextEntry(contextId);
|
|
4140
4405
|
currentOrderRevision = this.getCurrentOrderRevision();
|
|
4141
4406
|
projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
|
|
4142
4407
|
if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
|
|
4143
|
-
|
|
4408
|
+
_context38.next = 7;
|
|
4144
4409
|
break;
|
|
4145
4410
|
}
|
|
4146
|
-
return
|
|
4411
|
+
return _context38.abrupt("return", {
|
|
4147
4412
|
context: context,
|
|
4148
4413
|
projectionEntry: projectionEntry,
|
|
4149
4414
|
refreshed: false
|
|
4150
4415
|
});
|
|
4151
4416
|
case 7:
|
|
4152
|
-
|
|
4417
|
+
_context38.next = 9;
|
|
4153
4418
|
return this.refreshAvailabilityContextProjection({
|
|
4154
4419
|
contextId: contextId,
|
|
4155
4420
|
reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
|
|
4156
4421
|
previousOrderRevision: context.lastKnownOrderRevision
|
|
4157
4422
|
});
|
|
4158
4423
|
case 9:
|
|
4159
|
-
refreshedProjectionEntry =
|
|
4424
|
+
refreshedProjectionEntry = _context38.sent;
|
|
4160
4425
|
if (refreshedProjectionEntry) {
|
|
4161
|
-
|
|
4426
|
+
_context38.next = 13;
|
|
4162
4427
|
break;
|
|
4163
4428
|
}
|
|
4164
4429
|
retries += 1;
|
|
4165
|
-
return
|
|
4430
|
+
return _context38.abrupt("continue", 1);
|
|
4166
4431
|
case 13:
|
|
4167
4432
|
if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
4168
|
-
|
|
4433
|
+
_context38.next = 16;
|
|
4169
4434
|
break;
|
|
4170
4435
|
}
|
|
4171
4436
|
retries += 1;
|
|
4172
|
-
return
|
|
4437
|
+
return _context38.abrupt("continue", 1);
|
|
4173
4438
|
case 16:
|
|
4174
|
-
return
|
|
4439
|
+
return _context38.abrupt("return", {
|
|
4175
4440
|
context: this.getAvailabilityContextEntry(contextId),
|
|
4176
4441
|
projectionEntry: refreshedProjectionEntry,
|
|
4177
4442
|
refreshed: true
|
|
@@ -4183,11 +4448,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4183
4448
|
});
|
|
4184
4449
|
case 20:
|
|
4185
4450
|
case "end":
|
|
4186
|
-
return
|
|
4451
|
+
return _context38.stop();
|
|
4187
4452
|
}
|
|
4188
|
-
},
|
|
4453
|
+
}, _callee38, this);
|
|
4189
4454
|
}));
|
|
4190
|
-
function ensureAvailabilityContextProjection(
|
|
4455
|
+
function ensureAvailabilityContextProjection(_x26, _x27) {
|
|
4191
4456
|
return _ensureAvailabilityContextProjection.apply(this, arguments);
|
|
4192
4457
|
}
|
|
4193
4458
|
return ensureAvailabilityContextProjection;
|
|
@@ -4195,18 +4460,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4195
4460
|
}, {
|
|
4196
4461
|
key: "tryAcquireAvailabilityCommitLock",
|
|
4197
4462
|
value: function () {
|
|
4198
|
-
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4463
|
+
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(contextId) {
|
|
4199
4464
|
var _currentContext$activ;
|
|
4200
4465
|
var _waitingContext$activ, waitingContext, currentContext;
|
|
4201
|
-
return _regeneratorRuntime().wrap(function
|
|
4202
|
-
while (1) switch (
|
|
4466
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4467
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
4203
4468
|
case 0:
|
|
4204
4469
|
if (!this.availabilityCommitLocks.has(contextId)) {
|
|
4205
|
-
|
|
4470
|
+
_context39.next = 5;
|
|
4206
4471
|
break;
|
|
4207
4472
|
}
|
|
4208
4473
|
waitingContext = this.availabilityContextRegistry.get(contextId);
|
|
4209
|
-
|
|
4474
|
+
_context39.next = 4;
|
|
4210
4475
|
return this.emitAvailabilityDiagnostic({
|
|
4211
4476
|
action: 'commit_lock_wait',
|
|
4212
4477
|
contextId: contextId,
|
|
@@ -4223,7 +4488,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4223
4488
|
case 5:
|
|
4224
4489
|
this.availabilityCommitLocks.add(contextId);
|
|
4225
4490
|
currentContext = this.availabilityContextRegistry.get(contextId);
|
|
4226
|
-
|
|
4491
|
+
_context39.next = 9;
|
|
4227
4492
|
return this.emitAvailabilityDiagnostic({
|
|
4228
4493
|
action: 'commit_lock_acquired',
|
|
4229
4494
|
contextId: contextId,
|
|
@@ -4235,11 +4500,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4235
4500
|
});
|
|
4236
4501
|
case 9:
|
|
4237
4502
|
case "end":
|
|
4238
|
-
return
|
|
4503
|
+
return _context39.stop();
|
|
4239
4504
|
}
|
|
4240
|
-
},
|
|
4505
|
+
}, _callee39, this);
|
|
4241
4506
|
}));
|
|
4242
|
-
function tryAcquireAvailabilityCommitLock(
|
|
4507
|
+
function tryAcquireAvailabilityCommitLock(_x28) {
|
|
4243
4508
|
return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
|
|
4244
4509
|
}
|
|
4245
4510
|
return tryAcquireAvailabilityCommitLock;
|
|
@@ -4247,15 +4512,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4247
4512
|
}, {
|
|
4248
4513
|
key: "releaseAvailabilityCommitLock",
|
|
4249
4514
|
value: function () {
|
|
4250
|
-
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4515
|
+
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(contextId) {
|
|
4251
4516
|
var _releasedContext$acti;
|
|
4252
4517
|
var releasedContext;
|
|
4253
|
-
return _regeneratorRuntime().wrap(function
|
|
4254
|
-
while (1) switch (
|
|
4518
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4519
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
4255
4520
|
case 0:
|
|
4256
4521
|
this.availabilityCommitLocks.delete(contextId);
|
|
4257
4522
|
releasedContext = this.availabilityContextRegistry.get(contextId);
|
|
4258
|
-
|
|
4523
|
+
_context40.next = 4;
|
|
4259
4524
|
return this.emitAvailabilityDiagnostic({
|
|
4260
4525
|
action: 'commit_lock_released',
|
|
4261
4526
|
contextId: contextId,
|
|
@@ -4267,11 +4532,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4267
4532
|
});
|
|
4268
4533
|
case 4:
|
|
4269
4534
|
case "end":
|
|
4270
|
-
return
|
|
4535
|
+
return _context40.stop();
|
|
4271
4536
|
}
|
|
4272
|
-
},
|
|
4537
|
+
}, _callee40, this);
|
|
4273
4538
|
}));
|
|
4274
|
-
function releaseAvailabilityCommitLock(
|
|
4539
|
+
function releaseAvailabilityCommitLock(_x29) {
|
|
4275
4540
|
return _releaseAvailabilityCommitLock.apply(this, arguments);
|
|
4276
4541
|
}
|
|
4277
4542
|
return releaseAvailabilityCommitLock;
|
|
@@ -4279,20 +4544,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4279
4544
|
}, {
|
|
4280
4545
|
key: "prepareAvailabilityProjection",
|
|
4281
4546
|
value: (function () {
|
|
4282
|
-
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4547
|
+
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
4283
4548
|
var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
|
|
4284
|
-
return _regeneratorRuntime().wrap(function
|
|
4285
|
-
while (1) switch (
|
|
4549
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4550
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
4286
4551
|
case 0:
|
|
4287
4552
|
this.assertAvailabilityPrepareParams(params);
|
|
4288
|
-
|
|
4553
|
+
_context41.next = 3;
|
|
4289
4554
|
return this.resolveAvailabilityPrepareDefaults(params);
|
|
4290
4555
|
case 3:
|
|
4291
|
-
paramsWithDefaults =
|
|
4292
|
-
|
|
4556
|
+
paramsWithDefaults = _context41.sent;
|
|
4557
|
+
_context41.next = 6;
|
|
4293
4558
|
return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
|
|
4294
4559
|
case 6:
|
|
4295
|
-
_yield$this$getShared =
|
|
4560
|
+
_yield$this$getShared = _context41.sent;
|
|
4296
4561
|
prepareKey = _yield$this$getShared.prepareKey;
|
|
4297
4562
|
snapshot = _yield$this$getShared.snapshot;
|
|
4298
4563
|
contextId = this.createAvailabilityContextId();
|
|
@@ -4313,7 +4578,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4313
4578
|
refreshed: false,
|
|
4314
4579
|
reason: 'prepare'
|
|
4315
4580
|
};
|
|
4316
|
-
|
|
4581
|
+
_context41.next = 16;
|
|
4317
4582
|
return this.emitAvailabilityDiagnostic({
|
|
4318
4583
|
action: 'prepare',
|
|
4319
4584
|
contextId: contextId,
|
|
@@ -4324,17 +4589,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4324
4589
|
reason: 'prepare'
|
|
4325
4590
|
});
|
|
4326
4591
|
case 16:
|
|
4327
|
-
|
|
4592
|
+
_context41.next = 18;
|
|
4328
4593
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
|
|
4329
4594
|
case 18:
|
|
4330
|
-
return
|
|
4595
|
+
return _context41.abrupt("return", handle);
|
|
4331
4596
|
case 19:
|
|
4332
4597
|
case "end":
|
|
4333
|
-
return
|
|
4598
|
+
return _context41.stop();
|
|
4334
4599
|
}
|
|
4335
|
-
},
|
|
4600
|
+
}, _callee41, this);
|
|
4336
4601
|
}));
|
|
4337
|
-
function prepareAvailabilityProjection(
|
|
4602
|
+
function prepareAvailabilityProjection(_x30) {
|
|
4338
4603
|
return _prepareAvailabilityProjection.apply(this, arguments);
|
|
4339
4604
|
}
|
|
4340
4605
|
return prepareAvailabilityProjection;
|
|
@@ -4342,10 +4607,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4342
4607
|
}, {
|
|
4343
4608
|
key: "getProductTimeRanges",
|
|
4344
4609
|
value: (function () {
|
|
4345
|
-
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4610
|
+
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(contextId) {
|
|
4346
4611
|
var _this$otherParams$pla2,
|
|
4347
|
-
_this$
|
|
4348
|
-
|
|
4612
|
+
_this$otherParams26,
|
|
4613
|
+
_this10 = this;
|
|
4349
4614
|
var request,
|
|
4350
4615
|
_yield$this$ensureAva,
|
|
4351
4616
|
context,
|
|
@@ -4353,23 +4618,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4353
4618
|
contextVersion,
|
|
4354
4619
|
isPosAvailabilityRequest,
|
|
4355
4620
|
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
4356
|
-
|
|
4357
|
-
return _regeneratorRuntime().wrap(function
|
|
4358
|
-
while (1) switch (
|
|
4621
|
+
_args42 = arguments;
|
|
4622
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4623
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4359
4624
|
case 0:
|
|
4360
|
-
request =
|
|
4361
|
-
|
|
4625
|
+
request = _args42.length > 1 && _args42[1] !== undefined ? _args42[1] : {};
|
|
4626
|
+
_context42.next = 3;
|
|
4362
4627
|
return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
|
|
4363
4628
|
case 3:
|
|
4364
|
-
_yield$this$ensureAva =
|
|
4629
|
+
_yield$this$ensureAva = _context42.sent;
|
|
4365
4630
|
context = _yield$this$ensureAva.context;
|
|
4366
4631
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
4367
4632
|
contextVersion = context.activeVersion;
|
|
4368
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$
|
|
4633
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
4369
4634
|
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
4370
4635
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
4371
4636
|
});
|
|
4372
|
-
return
|
|
4637
|
+
return _context42.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
|
|
4373
4638
|
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
4374
4639
|
} : {}), {
|
|
4375
4640
|
evaluatedAt: this.getAvailabilityRuntimeDateTime(),
|
|
@@ -4379,17 +4644,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4379
4644
|
}).map(function (group) {
|
|
4380
4645
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
4381
4646
|
ranges: group.ranges.map(function (candidate) {
|
|
4382
|
-
return
|
|
4647
|
+
return _this10.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
|
|
4383
4648
|
})
|
|
4384
4649
|
});
|
|
4385
4650
|
}));
|
|
4386
4651
|
case 10:
|
|
4387
4652
|
case "end":
|
|
4388
|
-
return
|
|
4653
|
+
return _context42.stop();
|
|
4389
4654
|
}
|
|
4390
|
-
},
|
|
4655
|
+
}, _callee42, this);
|
|
4391
4656
|
}));
|
|
4392
|
-
function getProductTimeRanges(
|
|
4657
|
+
function getProductTimeRanges(_x31) {
|
|
4393
4658
|
return _getProductTimeRanges.apply(this, arguments);
|
|
4394
4659
|
}
|
|
4395
4660
|
return getProductTimeRanges;
|
|
@@ -4397,21 +4662,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4397
4662
|
}, {
|
|
4398
4663
|
key: "queryBookingAvailability",
|
|
4399
4664
|
value: (function () {
|
|
4400
|
-
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4401
|
-
var _this$otherParams$pla3, _this$
|
|
4665
|
+
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(contextId, request) {
|
|
4666
|
+
var _this$otherParams$pla3, _this$otherParams27;
|
|
4402
4667
|
var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, result, contextVersion, contextualResult;
|
|
4403
|
-
return _regeneratorRuntime().wrap(function
|
|
4404
|
-
while (1) switch (
|
|
4668
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4669
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4405
4670
|
case 0:
|
|
4406
|
-
|
|
4671
|
+
_context43.next = 2;
|
|
4407
4672
|
return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
|
|
4408
4673
|
case 2:
|
|
4409
|
-
_yield$this$ensureAva2 =
|
|
4674
|
+
_yield$this$ensureAva2 = _context43.sent;
|
|
4410
4675
|
context = _yield$this$ensureAva2.context;
|
|
4411
4676
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
4412
4677
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
4413
4678
|
this.assertContextualQueryFreshness(context, request);
|
|
4414
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$
|
|
4679
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
|
|
4415
4680
|
result = queryAvailabilityProjection(projectionEntry.projection, request, {
|
|
4416
4681
|
useExactDurationCandidateMinute: isPosAvailabilityRequest,
|
|
4417
4682
|
allowExcludedScheduleDateOverride: isPosAvailabilityRequest
|
|
@@ -4442,18 +4707,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4442
4707
|
});
|
|
4443
4708
|
})
|
|
4444
4709
|
}) : result;
|
|
4445
|
-
return
|
|
4710
|
+
return _context43.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
|
|
4446
4711
|
contextId: context.contextId,
|
|
4447
4712
|
contextVersion: contextVersion,
|
|
4448
4713
|
refreshed: refreshed
|
|
4449
4714
|
}));
|
|
4450
4715
|
case 12:
|
|
4451
4716
|
case "end":
|
|
4452
|
-
return
|
|
4717
|
+
return _context43.stop();
|
|
4453
4718
|
}
|
|
4454
|
-
},
|
|
4719
|
+
}, _callee43, this);
|
|
4455
4720
|
}));
|
|
4456
|
-
function queryBookingAvailability(
|
|
4721
|
+
function queryBookingAvailability(_x32, _x33) {
|
|
4457
4722
|
return _queryBookingAvailability.apply(this, arguments);
|
|
4458
4723
|
}
|
|
4459
4724
|
return queryBookingAvailability;
|
|
@@ -4510,9 +4775,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4510
4775
|
}, {
|
|
4511
4776
|
key: "findLinkedBooking",
|
|
4512
4777
|
value: function findLinkedBooking(product) {
|
|
4513
|
-
var
|
|
4778
|
+
var _ref50, _product$booking_uid3, _product$metadata6, _this$getTempOrder3;
|
|
4514
4779
|
var productUid = getProductLineUid(product);
|
|
4515
|
-
var bookingUid = String((
|
|
4780
|
+
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 : '');
|
|
4516
4781
|
return (((_this$getTempOrder3 = this.getTempOrder()) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.bookings) || []).find(function (booking) {
|
|
4517
4782
|
var _booking$product_uid3;
|
|
4518
4783
|
return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
|
|
@@ -4523,27 +4788,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4523
4788
|
}, {
|
|
4524
4789
|
key: "commitAvailabilitySelection",
|
|
4525
4790
|
value: (function () {
|
|
4526
|
-
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4527
|
-
var normalizedContextId, _params$bookingCount,
|
|
4528
|
-
return _regeneratorRuntime().wrap(function
|
|
4529
|
-
while (1) switch (
|
|
4791
|
+
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(contextId, params) {
|
|
4792
|
+
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$pla4, _this$otherParams28, _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;
|
|
4793
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4794
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4530
4795
|
case 0:
|
|
4531
4796
|
normalizedContextId = String(contextId || '').trim();
|
|
4532
4797
|
if (normalizedContextId) {
|
|
4533
|
-
|
|
4798
|
+
_context44.next = 3;
|
|
4534
4799
|
break;
|
|
4535
4800
|
}
|
|
4536
4801
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
|
|
4537
4802
|
candidate: params.candidate
|
|
4538
4803
|
});
|
|
4539
4804
|
case 3:
|
|
4540
|
-
|
|
4805
|
+
_context44.next = 5;
|
|
4541
4806
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
4542
4807
|
case 5:
|
|
4543
|
-
|
|
4808
|
+
_context44.prev = 5;
|
|
4544
4809
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
4545
4810
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
4546
|
-
|
|
4811
|
+
_context44.next = 9;
|
|
4547
4812
|
break;
|
|
4548
4813
|
}
|
|
4549
4814
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
@@ -4551,16 +4816,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4551
4816
|
});
|
|
4552
4817
|
case 9:
|
|
4553
4818
|
if (!(params.mode === 'edit' && bookingCount !== 1)) {
|
|
4554
|
-
|
|
4819
|
+
_context44.next = 11;
|
|
4555
4820
|
break;
|
|
4556
4821
|
}
|
|
4557
4822
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
4558
4823
|
bookingCount: bookingCount
|
|
4559
4824
|
});
|
|
4560
4825
|
case 11:
|
|
4561
|
-
orderProductQuantity = (
|
|
4826
|
+
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;
|
|
4562
4827
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
4563
|
-
|
|
4828
|
+
_context44.next = 14;
|
|
4564
4829
|
break;
|
|
4565
4830
|
}
|
|
4566
4831
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
@@ -4570,22 +4835,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4570
4835
|
case 14:
|
|
4571
4836
|
partySize = Number(params.partySize);
|
|
4572
4837
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
4573
|
-
|
|
4838
|
+
_context44.next = 17;
|
|
4574
4839
|
break;
|
|
4575
4840
|
}
|
|
4576
4841
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
4577
4842
|
partySize: params.partySize
|
|
4578
4843
|
});
|
|
4579
4844
|
case 17:
|
|
4580
|
-
|
|
4845
|
+
_context44.next = 19;
|
|
4581
4846
|
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
4582
4847
|
case 19:
|
|
4583
|
-
_yield$this$ensureAva3 =
|
|
4848
|
+
_yield$this$ensureAva3 = _context44.sent;
|
|
4584
4849
|
context = _yield$this$ensureAva3.context;
|
|
4585
4850
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
4586
4851
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
4587
4852
|
if (!refreshed) {
|
|
4588
|
-
|
|
4853
|
+
_context44.next = 25;
|
|
4589
4854
|
break;
|
|
4590
4855
|
}
|
|
4591
4856
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -4596,11 +4861,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4596
4861
|
case 25:
|
|
4597
4862
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
4598
4863
|
if (!(params.mode === 'edit')) {
|
|
4599
|
-
|
|
4864
|
+
_context44.next = 31;
|
|
4600
4865
|
break;
|
|
4601
4866
|
}
|
|
4602
4867
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
4603
|
-
|
|
4868
|
+
_context44.next = 29;
|
|
4604
4869
|
break;
|
|
4605
4870
|
}
|
|
4606
4871
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -4609,11 +4874,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4609
4874
|
editingProductLineUids: boundEditingUids
|
|
4610
4875
|
});
|
|
4611
4876
|
case 29:
|
|
4612
|
-
|
|
4877
|
+
_context44.next = 33;
|
|
4613
4878
|
break;
|
|
4614
4879
|
case 31:
|
|
4615
4880
|
if (!(boundEditingUids.length > 0)) {
|
|
4616
|
-
|
|
4881
|
+
_context44.next = 33;
|
|
4617
4882
|
break;
|
|
4618
4883
|
}
|
|
4619
4884
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
@@ -4622,7 +4887,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4622
4887
|
});
|
|
4623
4888
|
case 33:
|
|
4624
4889
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
4625
|
-
|
|
4890
|
+
_context44.next = 35;
|
|
4626
4891
|
break;
|
|
4627
4892
|
}
|
|
4628
4893
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -4632,7 +4897,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4632
4897
|
});
|
|
4633
4898
|
case 35:
|
|
4634
4899
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
4635
|
-
|
|
4900
|
+
_context44.next = 37;
|
|
4636
4901
|
break;
|
|
4637
4902
|
}
|
|
4638
4903
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -4643,7 +4908,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4643
4908
|
});
|
|
4644
4909
|
case 37:
|
|
4645
4910
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
4646
|
-
|
|
4911
|
+
_context44.next = 39;
|
|
4647
4912
|
break;
|
|
4648
4913
|
}
|
|
4649
4914
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -4655,7 +4920,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4655
4920
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
4656
4921
|
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;
|
|
4657
4922
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
4658
|
-
|
|
4923
|
+
_context44.next = 43;
|
|
4659
4924
|
break;
|
|
4660
4925
|
}
|
|
4661
4926
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
@@ -4664,14 +4929,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4664
4929
|
});
|
|
4665
4930
|
case 43:
|
|
4666
4931
|
if (!(params.mode === 'edit' && !params.productLineUid)) {
|
|
4667
|
-
|
|
4932
|
+
_context44.next = 45;
|
|
4668
4933
|
break;
|
|
4669
4934
|
}
|
|
4670
4935
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
4671
4936
|
case 45:
|
|
4672
4937
|
editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
4673
4938
|
if (!(params.mode === 'edit' && !editingLine)) {
|
|
4674
|
-
|
|
4939
|
+
_context44.next = 48;
|
|
4675
4940
|
break;
|
|
4676
4941
|
}
|
|
4677
4942
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
@@ -4679,7 +4944,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4679
4944
|
});
|
|
4680
4945
|
case 48:
|
|
4681
4946
|
if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
4682
|
-
|
|
4947
|
+
_context44.next = 50;
|
|
4683
4948
|
break;
|
|
4684
4949
|
}
|
|
4685
4950
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -4689,7 +4954,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4689
4954
|
});
|
|
4690
4955
|
case 50:
|
|
4691
4956
|
if (Array.isArray(params.requirementSelections)) {
|
|
4692
|
-
|
|
4957
|
+
_context44.next = 52;
|
|
4693
4958
|
break;
|
|
4694
4959
|
}
|
|
4695
4960
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
@@ -4706,7 +4971,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4706
4971
|
};
|
|
4707
4972
|
prepareParams = baseProjection.meta.prepareParams;
|
|
4708
4973
|
if (prepareParams) {
|
|
4709
|
-
|
|
4974
|
+
_context44.next = 57;
|
|
4710
4975
|
break;
|
|
4711
4976
|
}
|
|
4712
4977
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
@@ -4718,7 +4983,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4718
4983
|
})),
|
|
4719
4984
|
includesInjectedRawOccupancies: true
|
|
4720
4985
|
};
|
|
4721
|
-
|
|
4986
|
+
_context44.next = 60;
|
|
4722
4987
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
4723
4988
|
editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
|
|
4724
4989
|
}), {
|
|
@@ -4727,13 +4992,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4727
4992
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
4728
4993
|
});
|
|
4729
4994
|
case 60:
|
|
4730
|
-
commitSnapshot =
|
|
4995
|
+
commitSnapshot = _context44.sent;
|
|
4731
4996
|
refreshedProjection = commitSnapshot.projection;
|
|
4732
4997
|
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 : ''))) {
|
|
4733
|
-
|
|
4998
|
+
_context44.next = 67;
|
|
4734
4999
|
break;
|
|
4735
5000
|
}
|
|
4736
|
-
|
|
5001
|
+
_context44.next = 65;
|
|
4737
5002
|
return this.refreshAvailabilityContextProjection({
|
|
4738
5003
|
contextId: normalizedContextId,
|
|
4739
5004
|
reason: 'commit_order_revision_changed',
|
|
@@ -4754,7 +5019,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4754
5019
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
4755
5020
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
4756
5021
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
4757
|
-
allowPosAvailabilityOverride = String((_this$otherParams$pla4 = (_this$
|
|
5022
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla4 = (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() === 'pos';
|
|
4758
5023
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
4759
5024
|
productIds: [params.candidate.productId],
|
|
4760
5025
|
dateRange: {
|
|
@@ -4778,7 +5043,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4778
5043
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
4779
5044
|
});
|
|
4780
5045
|
if (refreshedCandidateBase) {
|
|
4781
|
-
|
|
5046
|
+
_context44.next = 75;
|
|
4782
5047
|
break;
|
|
4783
5048
|
}
|
|
4784
5049
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -4791,7 +5056,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4791
5056
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
4792
5057
|
});
|
|
4793
5058
|
if (product) {
|
|
4794
|
-
|
|
5059
|
+
_context44.next = 78;
|
|
4795
5060
|
break;
|
|
4796
5061
|
}
|
|
4797
5062
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
@@ -4828,7 +5093,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4828
5093
|
});
|
|
4829
5094
|
}
|
|
4830
5095
|
if (validation.ok) {
|
|
4831
|
-
|
|
5096
|
+
_context44.next = 83;
|
|
4832
5097
|
break;
|
|
4833
5098
|
}
|
|
4834
5099
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -4851,7 +5116,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4851
5116
|
incrementVersion: true
|
|
4852
5117
|
});
|
|
4853
5118
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
4854
|
-
|
|
5119
|
+
_context44.next = 87;
|
|
4855
5120
|
return this.emitAvailabilityDiagnostic({
|
|
4856
5121
|
action: 'refresh',
|
|
4857
5122
|
contextId: normalizedContextId,
|
|
@@ -4874,7 +5139,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4874
5139
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
4875
5140
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
4876
5141
|
if (!(params.mode === 'edit' && !existingBookingUid)) {
|
|
4877
|
-
|
|
5142
|
+
_context44.next = 93;
|
|
4878
5143
|
break;
|
|
4879
5144
|
}
|
|
4880
5145
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
@@ -4888,15 +5153,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4888
5153
|
product: product,
|
|
4889
5154
|
resources: refreshedProjection.resources,
|
|
4890
5155
|
bookingUid: existingBookingUid || undefined,
|
|
4891
|
-
holder: (
|
|
4892
|
-
holderIds: (
|
|
5156
|
+
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,
|
|
5157
|
+
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
|
|
4893
5158
|
});
|
|
4894
5159
|
transformed = this.buildUnifiedOrderProduct(_objectSpread(_objectSpread({}, params.orderProduct), {}, {
|
|
4895
5160
|
num: bookingCount,
|
|
4896
5161
|
quantity: bookingCount
|
|
4897
5162
|
}), 'unified_booking_sales', product);
|
|
4898
5163
|
if (transformed) {
|
|
4899
|
-
|
|
5164
|
+
_context44.next = 98;
|
|
4900
5165
|
break;
|
|
4901
5166
|
}
|
|
4902
5167
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
@@ -4915,7 +5180,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4915
5180
|
productLineUids = [];
|
|
4916
5181
|
bookingUids = [];
|
|
4917
5182
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
4918
|
-
|
|
5183
|
+
_context44.next = 117;
|
|
4919
5184
|
break;
|
|
4920
5185
|
}
|
|
4921
5186
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -4925,10 +5190,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4925
5190
|
unique_identification_number: params.productLineUid,
|
|
4926
5191
|
booking_uid: existingBookingUid
|
|
4927
5192
|
});
|
|
4928
|
-
|
|
5193
|
+
_context44.next = 111;
|
|
4929
5194
|
return this.updateOrderProduct(_objectSpread(_objectSpread({
|
|
4930
5195
|
product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
|
|
4931
|
-
product_variant_id: (
|
|
5196
|
+
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,
|
|
4932
5197
|
unique_identification_number: params.productLineUid,
|
|
4933
5198
|
updates: transformed,
|
|
4934
5199
|
booking: booking
|
|
@@ -4942,7 +5207,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4942
5207
|
bookingUid = existingBookingUid;
|
|
4943
5208
|
productLineUids = [productLineUid];
|
|
4944
5209
|
bookingUids = [bookingUid];
|
|
4945
|
-
|
|
5210
|
+
_context44.next = 129;
|
|
4946
5211
|
break;
|
|
4947
5212
|
case 117:
|
|
4948
5213
|
beforeProductLineUids = new Set((((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || []).map(function (line) {
|
|
@@ -4951,10 +5216,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4951
5216
|
beforeBookingUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.bookings) || []).map(function (item) {
|
|
4952
5217
|
return getBookingUid(item);
|
|
4953
5218
|
}).filter(Boolean));
|
|
4954
|
-
|
|
4955
|
-
return this.addProductToOrder(transformed, booking)
|
|
5219
|
+
_context44.next = 121;
|
|
5220
|
+
return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length ? {
|
|
5221
|
+
salesNotes: params.salesNotes
|
|
5222
|
+
} : undefined);
|
|
4956
5223
|
case 121:
|
|
4957
|
-
products =
|
|
5224
|
+
products = _context44.sent;
|
|
4958
5225
|
addedLines = products.filter(function (line) {
|
|
4959
5226
|
var _line$product_id, _line$metadata;
|
|
4960
5227
|
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));
|
|
@@ -4971,8 +5238,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4971
5238
|
}).filter(Boolean);
|
|
4972
5239
|
if (bookingUids.length === 0) {
|
|
4973
5240
|
bookingUids = addedLines.map(function (line) {
|
|
4974
|
-
var
|
|
4975
|
-
return String((
|
|
5241
|
+
var _ref56, _line$booking_uid, _line$metadata2;
|
|
5242
|
+
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 : '');
|
|
4976
5243
|
}).filter(Boolean);
|
|
4977
5244
|
}
|
|
4978
5245
|
productLineUid = productLineUids[productLineUids.length - 1] || '';
|
|
@@ -4991,23 +5258,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4991
5258
|
productLineUids: productLineUids,
|
|
4992
5259
|
bookingUids: bookingUids
|
|
4993
5260
|
};
|
|
4994
|
-
|
|
5261
|
+
_context44.next = 134;
|
|
4995
5262
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
4996
5263
|
case 134:
|
|
4997
|
-
return
|
|
5264
|
+
return _context44.abrupt("return", result);
|
|
4998
5265
|
case 135:
|
|
4999
|
-
|
|
5000
|
-
|
|
5266
|
+
_context44.prev = 135;
|
|
5267
|
+
_context44.next = 138;
|
|
5001
5268
|
return this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
5002
5269
|
case 138:
|
|
5003
|
-
return
|
|
5270
|
+
return _context44.finish(135);
|
|
5004
5271
|
case 139:
|
|
5005
5272
|
case "end":
|
|
5006
|
-
return
|
|
5273
|
+
return _context44.stop();
|
|
5007
5274
|
}
|
|
5008
|
-
},
|
|
5275
|
+
}, _callee44, this, [[5,, 135, 139]]);
|
|
5009
5276
|
}));
|
|
5010
|
-
function commitAvailabilitySelection(
|
|
5277
|
+
function commitAvailabilitySelection(_x34, _x35) {
|
|
5011
5278
|
return _commitAvailabilitySelection.apply(this, arguments);
|
|
5012
5279
|
}
|
|
5013
5280
|
return commitAvailabilitySelection;
|