@pisell/pisellos 0.10.58 → 0.10.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory/index.d.ts +92 -0
- package/dist/inventory/index.js +500 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Order/index.d.ts +19 -2
- package/dist/modules/Order/index.js +1369 -1021
- package/dist/modules/Order/types.d.ts +5 -0
- package/dist/modules/ProductList/index.d.ts +1 -3
- package/dist/modules/ProductList/index.js +120 -192
- package/dist/modules/ProductList/types.d.ts +0 -8
- package/dist/modules/ProductList/types.js +0 -2
- package/dist/solution/BaseSales/index.d.ts +8 -0
- package/dist/solution/BaseSales/index.js +1382 -1207
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +1 -7
- package/dist/solution/UnifiedBookingSales/index.js +446 -586
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/inventory/index.d.ts +92 -0
- package/lib/inventory/index.js +280 -0
- package/lib/modules/Order/index.d.ts +19 -2
- package/lib/modules/Order/index.js +111 -19
- package/lib/modules/Order/types.d.ts +5 -0
- package/lib/modules/ProductList/index.d.ts +1 -3
- package/lib/modules/ProductList/index.js +22 -31
- package/lib/modules/ProductList/types.d.ts +0 -8
- package/lib/modules/ProductList/types.js +0 -1
- package/lib/solution/BaseSales/index.d.ts +8 -0
- package/lib/solution/BaseSales/index.js +82 -7
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +1 -7
- package/lib/solution/UnifiedBookingSales/index.js +12 -80
- package/package.json +1 -1
|
@@ -34,7 +34,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
34
34
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
35
35
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
36
36
|
import dayjs from 'dayjs';
|
|
37
|
-
import { cloneDeep
|
|
37
|
+
import { cloneDeep } from 'lodash-es';
|
|
38
38
|
import { OpenDataModule } from "../../modules";
|
|
39
39
|
import { isProductFlexibleDuration } from "../../modules/BookingContext/utils";
|
|
40
40
|
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings } from "../../modules/OpenData";
|
|
@@ -1655,16 +1655,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1655
1655
|
key: "setOtherParams",
|
|
1656
1656
|
value: function () {
|
|
1657
1657
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
1658
|
-
var _this$otherParams9, _this$otherParams11;
|
|
1658
|
+
var _this$otherParams9, _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams14;
|
|
1659
1659
|
var _ref31,
|
|
1660
1660
|
_ref31$cover,
|
|
1661
1661
|
cover,
|
|
1662
1662
|
previousScope,
|
|
1663
|
+
previousCatalogScope,
|
|
1663
1664
|
previousItemRuleConfig,
|
|
1664
1665
|
explicitlySetsOpenData,
|
|
1665
1666
|
nextParams,
|
|
1666
1667
|
nextScope,
|
|
1667
|
-
_this$
|
|
1668
|
+
_this$otherParams13,
|
|
1668
1669
|
shouldResetAvailabilityState,
|
|
1669
1670
|
_args3 = arguments;
|
|
1670
1671
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -1672,33 +1673,42 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1672
1673
|
case 0:
|
|
1673
1674
|
_ref31 = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {}, _ref31$cover = _ref31.cover, cover = _ref31$cover === void 0 ? false : _ref31$cover;
|
|
1674
1675
|
previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1675
|
-
|
|
1676
|
+
previousCatalogScope = (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.catalogScopeKey;
|
|
1677
|
+
previousItemRuleConfig = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.itemRule;
|
|
1676
1678
|
explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
1677
1679
|
nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
1678
1680
|
if (explicitlySetsOpenData || this.getRuntimeOpenDataScope() !== this.getRuntimeOpenDataScope(nextParams)) {
|
|
1679
1681
|
this.clearOpenDataCache();
|
|
1680
1682
|
}
|
|
1681
|
-
_context3.next =
|
|
1683
|
+
_context3.next = 9;
|
|
1682
1684
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
1683
1685
|
cover: cover
|
|
1684
1686
|
});
|
|
1685
|
-
case
|
|
1687
|
+
case 9:
|
|
1688
|
+
if (!(previousCatalogScope !== ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.catalogScopeKey) && (previousCatalogScope || (_this$otherParams12 = this.otherParams) !== null && _this$otherParams12 !== void 0 && _this$otherParams12.catalogScopeKey))) {
|
|
1689
|
+
_context3.next = 13;
|
|
1690
|
+
break;
|
|
1691
|
+
}
|
|
1692
|
+
this.unifiedProductCatalog = [];
|
|
1693
|
+
_context3.next = 13;
|
|
1694
|
+
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
|
|
1695
|
+
case 13:
|
|
1686
1696
|
nextScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1687
1697
|
if (explicitlySetsOpenData) {
|
|
1688
|
-
this.openDataTarget = (_this$
|
|
1698
|
+
this.openDataTarget = (_this$otherParams13 = this.otherParams) !== null && _this$otherParams13 !== void 0 && _this$otherParams13.openData && nextScope.businessCode && nextScope.channel ? "".concat(nextScope.businessCode, "+").concat(nextScope.channel) : null;
|
|
1689
1699
|
}
|
|
1690
1700
|
shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone;
|
|
1691
1701
|
if (!shouldResetAvailabilityState) {
|
|
1692
|
-
_context3.next =
|
|
1702
|
+
_context3.next = 19;
|
|
1693
1703
|
break;
|
|
1694
1704
|
}
|
|
1695
|
-
_context3.next =
|
|
1705
|
+
_context3.next = 19;
|
|
1696
1706
|
return this.resetAvailabilityProjectionState('set_other_params_reset');
|
|
1697
|
-
case
|
|
1698
|
-
if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$
|
|
1707
|
+
case 19:
|
|
1708
|
+
if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.itemRule)) {
|
|
1699
1709
|
this.resetAllergyItemRuleState();
|
|
1700
1710
|
}
|
|
1701
|
-
case
|
|
1711
|
+
case 20:
|
|
1702
1712
|
case "end":
|
|
1703
1713
|
return _context3.stop();
|
|
1704
1714
|
}
|
|
@@ -1931,8 +1941,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1931
1941
|
}, {
|
|
1932
1942
|
key: "isSessionStoragePersistEnabled",
|
|
1933
1943
|
value: function isSessionStoragePersistEnabled() {
|
|
1934
|
-
var _this$
|
|
1935
|
-
return Boolean(this.cacheId && ((_this$
|
|
1944
|
+
var _this$otherParams15;
|
|
1945
|
+
return Boolean(this.cacheId && ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.enableSessionStoragePersist) === true);
|
|
1936
1946
|
}
|
|
1937
1947
|
}, {
|
|
1938
1948
|
key: "shouldUseSessionStorageForSubModule",
|
|
@@ -2001,10 +2011,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2001
2011
|
}, {
|
|
2002
2012
|
key: "shouldUseCheckoutSyncTask",
|
|
2003
2013
|
value: function shouldUseCheckoutSyncTask() {
|
|
2004
|
-
var _this$
|
|
2005
|
-
var configured = (_this$
|
|
2014
|
+
var _this$otherParams16, _this$otherParams17;
|
|
2015
|
+
var configured = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.checkoutSyncTaskEnabled;
|
|
2006
2016
|
if (configured === true) return true;
|
|
2007
|
-
var platform = normalizeRuntimePlatform((_this$
|
|
2017
|
+
var platform = normalizeRuntimePlatform((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform);
|
|
2008
2018
|
return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
|
|
2009
2019
|
}
|
|
2010
2020
|
|
|
@@ -2159,8 +2169,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2159
2169
|
}, {
|
|
2160
2170
|
key: "isAuthenticatedCustomerUserPlatform",
|
|
2161
2171
|
value: function isAuthenticatedCustomerUserPlatform() {
|
|
2162
|
-
var _this$
|
|
2163
|
-
return isCustomerUserPlatform((_this$
|
|
2172
|
+
var _this$otherParams18;
|
|
2173
|
+
return isCustomerUserPlatform((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform);
|
|
2164
2174
|
}
|
|
2165
2175
|
}, {
|
|
2166
2176
|
key: "resolveDiscountOrderIdentity",
|
|
@@ -2500,13 +2510,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2500
2510
|
key: "loadPickupTimingOpenData",
|
|
2501
2511
|
value: function () {
|
|
2502
2512
|
var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_force) {
|
|
2503
|
-
var _ref34, _this$otherParams$bus2, _this$
|
|
2513
|
+
var _ref34, _this$otherParams$bus2, _this$otherParams19, _this$otherParams20;
|
|
2504
2514
|
var scope, businessCode, config;
|
|
2505
2515
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
2506
2516
|
while (1) switch (_context16.prev = _context16.next) {
|
|
2507
2517
|
case 0:
|
|
2508
2518
|
scope = this.getPickupTimingScope();
|
|
2509
|
-
businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$
|
|
2519
|
+
businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.business_code) !== null && _ref34 !== void 0 ? _ref34 : '').trim();
|
|
2510
2520
|
_context16.next = 4;
|
|
2511
2521
|
return this.loadOpenData({
|
|
2512
2522
|
businessCode: businessCode,
|
|
@@ -2669,7 +2679,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2669
2679
|
key: "resolveProductAllergyRequirement",
|
|
2670
2680
|
value: (function () {
|
|
2671
2681
|
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
2672
|
-
var _this$
|
|
2682
|
+
var _this$otherParams21, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref37, _runtimeConfig$servic, _this$otherParams22, _ref38, _ref39, _params$channel, _this$otherParams23, _this$otherParams24, _runtimeConfig$submis;
|
|
2673
2683
|
var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
|
|
2674
2684
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2675
2685
|
while (1) switch (_context20.prev = _context20.next) {
|
|
@@ -2692,7 +2702,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2692
2702
|
return _context20.abrupt("return", null);
|
|
2693
2703
|
case 8:
|
|
2694
2704
|
productVariantId = normalizePositiveInteger(params.productVariantId);
|
|
2695
|
-
runtimeConfig = ((_this$
|
|
2705
|
+
runtimeConfig = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.itemRule) || {};
|
|
2696
2706
|
runtimePax = runtimeConfig.pax || {};
|
|
2697
2707
|
cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
|
|
2698
2708
|
var _item$product_id, _item$product_variant, _ref36, _item$num;
|
|
@@ -2711,8 +2721,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2711
2721
|
child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
|
|
2712
2722
|
},
|
|
2713
2723
|
cartItems: cartItems,
|
|
2714
|
-
serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$
|
|
2715
|
-
channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$
|
|
2724
|
+
serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.serviceType) !== null && _ref37 !== void 0 ? _ref37 : ''),
|
|
2725
|
+
channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.channel) !== null && _ref39 !== void 0 ? _ref39 : (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.platform) !== null && _ref38 !== void 0 ? _ref38 : ''),
|
|
2716
2726
|
currentProduct: _objectSpread({
|
|
2717
2727
|
product_id: productId
|
|
2718
2728
|
}, productVariantId ? {
|
|
@@ -2802,9 +2812,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2802
2812
|
}, {
|
|
2803
2813
|
key: "isInvoiceOpenDataCacheCurrent",
|
|
2804
2814
|
value: function isInvoiceOpenDataCacheCurrent() {
|
|
2805
|
-
var _this$
|
|
2806
|
-
var businessCode = String(((_this$
|
|
2807
|
-
var channel = String(((_this$
|
|
2815
|
+
var _this$otherParams25, _this$otherParams26;
|
|
2816
|
+
var businessCode = String(((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.businessCode) || '').trim();
|
|
2817
|
+
var channel = String(((_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.channel) || '').trim();
|
|
2808
2818
|
if (!businessCode || !channel) return false;
|
|
2809
2819
|
return this.openDataTarget === "".concat(businessCode, "+").concat(channel) && this.runtimeOpenDataScope === this.getRuntimeOpenDataScope();
|
|
2810
2820
|
}
|
|
@@ -2852,9 +2862,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2852
2862
|
key: "loadProducts",
|
|
2853
2863
|
value: (function () {
|
|
2854
2864
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2855
|
-
var _this7 = this;
|
|
2856
2865
|
var params,
|
|
2857
2866
|
options,
|
|
2867
|
+
catalogScope,
|
|
2858
2868
|
schedule_date,
|
|
2859
2869
|
schedule_datetime,
|
|
2860
2870
|
result,
|
|
@@ -2870,9 +2880,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2870
2880
|
}
|
|
2871
2881
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
2872
2882
|
case 4:
|
|
2883
|
+
catalogScope = this.otherParams.catalogScopeKey;
|
|
2873
2884
|
schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
2874
2885
|
schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
2875
|
-
_context24.next =
|
|
2886
|
+
_context24.next = 9;
|
|
2876
2887
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
2877
2888
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
2878
2889
|
with_schedule: 1
|
|
@@ -2880,25 +2891,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2880
2891
|
schedule_date: schedule_date,
|
|
2881
2892
|
schedule_datetime: schedule_datetime,
|
|
2882
2893
|
cacheId: this.cacheId
|
|
2883
|
-
}), options
|
|
2884
|
-
|
|
2885
|
-
var _response$data2, _options$callback;
|
|
2886
|
-
var updates = response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.list;
|
|
2887
|
-
if (Array.isArray(updates)) {
|
|
2888
|
-
// Subscription responses are the current query's complete visible list.
|
|
2889
|
-
_this7.unifiedProductCatalog = _toConsumableArray(updates);
|
|
2890
|
-
}
|
|
2891
|
-
(_options$callback = options.callback) === null || _options$callback === void 0 || _options$callback.call(options, response);
|
|
2892
|
-
}
|
|
2893
|
-
}) : options);
|
|
2894
|
-
case 8:
|
|
2894
|
+
}), options);
|
|
2895
|
+
case 9:
|
|
2895
2896
|
result = _context24.sent;
|
|
2897
|
+
if (!(catalogScope !== this.otherParams.catalogScopeKey)) {
|
|
2898
|
+
_context24.next = 12;
|
|
2899
|
+
break;
|
|
2900
|
+
}
|
|
2901
|
+
throw Object.assign(new Error('Product scope changed'), {
|
|
2902
|
+
name: 'AbortError'
|
|
2903
|
+
});
|
|
2904
|
+
case 12:
|
|
2896
2905
|
this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
2897
|
-
_context24.next =
|
|
2906
|
+
_context24.next = 15;
|
|
2898
2907
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
|
|
2899
|
-
case
|
|
2908
|
+
case 15:
|
|
2900
2909
|
return _context24.abrupt("return", result);
|
|
2901
|
-
case
|
|
2910
|
+
case 16:
|
|
2902
2911
|
case "end":
|
|
2903
2912
|
return _context24.stop();
|
|
2904
2913
|
}
|
|
@@ -3101,155 +3110,6 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3101
3110
|
};
|
|
3102
3111
|
}
|
|
3103
3112
|
|
|
3104
|
-
/** Detail reads share the catalog adapter, including when basic detail is cached. */
|
|
3105
|
-
}, {
|
|
3106
|
-
key: "enrichProducts",
|
|
3107
|
-
value: (function () {
|
|
3108
|
-
var _enrichProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(products, context) {
|
|
3109
|
-
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3110
|
-
while (1) switch (_context28.prev = _context28.next) {
|
|
3111
|
-
case 0:
|
|
3112
|
-
if (this.store.products) {
|
|
3113
|
-
_context28.next = 2;
|
|
3114
|
-
break;
|
|
3115
|
-
}
|
|
3116
|
-
throw new Error('Products module is not ready');
|
|
3117
|
-
case 2:
|
|
3118
|
-
return _context28.abrupt("return", this.store.products.enrichProducts(products, context));
|
|
3119
|
-
case 3:
|
|
3120
|
-
case "end":
|
|
3121
|
-
return _context28.stop();
|
|
3122
|
-
}
|
|
3123
|
-
}, _callee28, this);
|
|
3124
|
-
}));
|
|
3125
|
-
function enrichProducts(_x15, _x16) {
|
|
3126
|
-
return _enrichProducts.apply(this, arguments);
|
|
3127
|
-
}
|
|
3128
|
-
return enrichProducts;
|
|
3129
|
-
}() /** Apply only enrichment changes, never the cart's selection/price snapshot. */)
|
|
3130
|
-
}, {
|
|
3131
|
-
key: "applyProductEnrichment",
|
|
3132
|
-
value: (function () {
|
|
3133
|
-
var _applyProductEnrichment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(before, after) {
|
|
3134
|
-
var _before$id, _after$id, _this$store$products, _context$signal;
|
|
3135
|
-
var context,
|
|
3136
|
-
id,
|
|
3137
|
-
patch,
|
|
3138
|
-
cached,
|
|
3139
|
-
applyPatch,
|
|
3140
|
-
catalogUpdates,
|
|
3141
|
-
updates,
|
|
3142
|
-
_this$store$products2,
|
|
3143
|
-
_context$signal2,
|
|
3144
|
-
_args29 = arguments;
|
|
3145
|
-
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3146
|
-
while (1) switch (_context29.prev = _context29.next) {
|
|
3147
|
-
case 0:
|
|
3148
|
-
context = _args29.length > 2 && _args29[2] !== undefined ? _args29[2] : {};
|
|
3149
|
-
id = String((_before$id = before.id) !== null && _before$id !== void 0 ? _before$id : before.product_id);
|
|
3150
|
-
if (!(id !== String((_after$id = after.id) !== null && _after$id !== void 0 ? _after$id : after.product_id))) {
|
|
3151
|
-
_context29.next = 4;
|
|
3152
|
-
break;
|
|
3153
|
-
}
|
|
3154
|
-
throw new Error('Product enrichment changed product identity');
|
|
3155
|
-
case 4:
|
|
3156
|
-
patch = {};
|
|
3157
|
-
Object.keys(after).forEach(function (key) {
|
|
3158
|
-
if (['id', 'product_id', '_extend'].includes(key)) return;
|
|
3159
|
-
if (!isEqual(before[key], after[key])) patch[key] = cloneDeep(after[key]);
|
|
3160
|
-
});
|
|
3161
|
-
if (Object.keys(patch).length) {
|
|
3162
|
-
_context29.next = 8;
|
|
3163
|
-
break;
|
|
3164
|
-
}
|
|
3165
|
-
return _context29.abrupt("return");
|
|
3166
|
-
case 8:
|
|
3167
|
-
_context29.next = 10;
|
|
3168
|
-
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.queryProducts({
|
|
3169
|
-
includeIds: [id]
|
|
3170
|
-
});
|
|
3171
|
-
case 10:
|
|
3172
|
-
_context29.t0 = _context29.sent;
|
|
3173
|
-
if (_context29.t0) {
|
|
3174
|
-
_context29.next = 13;
|
|
3175
|
-
break;
|
|
3176
|
-
}
|
|
3177
|
-
_context29.t0 = [];
|
|
3178
|
-
case 13:
|
|
3179
|
-
cached = _context29.t0;
|
|
3180
|
-
if (!((_context$signal = context.signal) !== null && _context$signal !== void 0 && _context$signal.aborted)) {
|
|
3181
|
-
_context29.next = 16;
|
|
3182
|
-
break;
|
|
3183
|
-
}
|
|
3184
|
-
return _context29.abrupt("return");
|
|
3185
|
-
case 16:
|
|
3186
|
-
applyPatch = function applyPatch(product) {
|
|
3187
|
-
var next = _objectSpread(_objectSpread({}, product), patch);
|
|
3188
|
-
// A detail can contain only the selected variants; keep the catalog's other SKUs
|
|
3189
|
-
// and update only fields that the adapter actually changed.
|
|
3190
|
-
if (Array.isArray(patch.variant) && Array.isArray(product.variant)) {
|
|
3191
|
-
var variantId = function variantId(variant) {
|
|
3192
|
-
var _variant$id;
|
|
3193
|
-
var value = (_variant$id = variant === null || variant === void 0 ? void 0 : variant.id) !== null && _variant$id !== void 0 ? _variant$id : variant === null || variant === void 0 ? void 0 : variant.product_variant_id;
|
|
3194
|
-
return value == null ? null : String(value);
|
|
3195
|
-
};
|
|
3196
|
-
next.variant = product.variant.map(function (variant) {
|
|
3197
|
-
var _before$variant, _after$variant;
|
|
3198
|
-
if (variantId(variant) === null) return variant;
|
|
3199
|
-
var previous = (_before$variant = before.variant) === null || _before$variant === void 0 ? void 0 : _before$variant.find(function (item) {
|
|
3200
|
-
return variantId(item) === variantId(variant);
|
|
3201
|
-
});
|
|
3202
|
-
var enriched = (_after$variant = after.variant) === null || _after$variant === void 0 ? void 0 : _after$variant.find(function (item) {
|
|
3203
|
-
return variantId(item) === variantId(variant);
|
|
3204
|
-
});
|
|
3205
|
-
if (!previous || !enriched) return variant;
|
|
3206
|
-
var variantPatch = {};
|
|
3207
|
-
Object.keys(enriched).forEach(function (key) {
|
|
3208
|
-
if (key !== 'id' && key !== 'product_variant_id' && !isEqual(previous[key], enriched[key])) {
|
|
3209
|
-
variantPatch[key] = cloneDeep(enriched[key]);
|
|
3210
|
-
}
|
|
3211
|
-
});
|
|
3212
|
-
return _objectSpread(_objectSpread({}, variant), variantPatch);
|
|
3213
|
-
});
|
|
3214
|
-
}
|
|
3215
|
-
return next;
|
|
3216
|
-
};
|
|
3217
|
-
catalogUpdates = [];
|
|
3218
|
-
this.unifiedProductCatalog = this.unifiedProductCatalog.map(function (product) {
|
|
3219
|
-
var _product$id;
|
|
3220
|
-
if (String((_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id) !== id) return product;
|
|
3221
|
-
var next = applyPatch(product);
|
|
3222
|
-
catalogUpdates.push(next);
|
|
3223
|
-
return next;
|
|
3224
|
-
});
|
|
3225
|
-
// A cart product may no longer be in the visible menu but still have a shared cache entry.
|
|
3226
|
-
updates = cached.length ? cached.map(applyPatch) : catalogUpdates;
|
|
3227
|
-
if (!updates.length) {
|
|
3228
|
-
_context29.next = 27;
|
|
3229
|
-
break;
|
|
3230
|
-
}
|
|
3231
|
-
_context29.next = 23;
|
|
3232
|
-
return (_this$store$products2 = this.store.products) === null || _this$store$products2 === void 0 ? void 0 : _this$store$products2.addProduct(updates);
|
|
3233
|
-
case 23:
|
|
3234
|
-
if (!((_context$signal2 = context.signal) !== null && _context$signal2 !== void 0 && _context$signal2.aborted)) {
|
|
3235
|
-
_context29.next = 25;
|
|
3236
|
-
break;
|
|
3237
|
-
}
|
|
3238
|
-
return _context29.abrupt("return");
|
|
3239
|
-
case 25:
|
|
3240
|
-
_context29.next = 27;
|
|
3241
|
-
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), this.getProductCatalog().products);
|
|
3242
|
-
case 27:
|
|
3243
|
-
case "end":
|
|
3244
|
-
return _context29.stop();
|
|
3245
|
-
}
|
|
3246
|
-
}, _callee29, this);
|
|
3247
|
-
}));
|
|
3248
|
-
function applyProductEnrichment(_x17, _x18) {
|
|
3249
|
-
return _applyProductEnrichment.apply(this, arguments);
|
|
3250
|
-
}
|
|
3251
|
-
return applyProductEnrichment;
|
|
3252
|
-
}()
|
|
3253
3113
|
/**
|
|
3254
3114
|
* Read-only compatibility view for salesSdk skins. It reconnects a booking to its product but
|
|
3255
3115
|
* must not be used to mutate tempOrder; all writes go through BaseSales / planner APIs.
|
|
@@ -3281,16 +3141,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3281
3141
|
// }),
|
|
3282
3142
|
// };
|
|
3283
3143
|
// }
|
|
3144
|
+
|
|
3284
3145
|
/**
|
|
3285
3146
|
* Loads the current customer's product coupons and discount cards after planner lines exist,
|
|
3286
3147
|
* then optionally lets the existing Rules engine select the best valid combination. This is a
|
|
3287
3148
|
* diagnostic boundary for new booking skins: no pricing logic is duplicated in the planner.
|
|
3288
3149
|
*/
|
|
3289
|
-
)
|
|
3290
3150
|
}, {
|
|
3291
3151
|
key: "applyPlannerDiscounts",
|
|
3292
3152
|
value: (function () {
|
|
3293
|
-
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3153
|
+
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
3294
3154
|
var _params$customerId;
|
|
3295
3155
|
var params,
|
|
3296
3156
|
tempOrder,
|
|
@@ -3307,24 +3167,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3307
3167
|
discount,
|
|
3308
3168
|
discountId,
|
|
3309
3169
|
nextTempOrder,
|
|
3310
|
-
|
|
3311
|
-
return _regeneratorRuntime().wrap(function
|
|
3312
|
-
while (1) switch (
|
|
3170
|
+
_args28 = arguments;
|
|
3171
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3172
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3313
3173
|
case 0:
|
|
3314
|
-
params =
|
|
3174
|
+
params = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {};
|
|
3315
3175
|
tempOrder = this.getTempOrder();
|
|
3316
3176
|
requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
3317
3177
|
parsedCustomerId = Number(requestedCustomerId);
|
|
3318
3178
|
customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
|
|
3319
|
-
|
|
3179
|
+
_context28.next = 7;
|
|
3320
3180
|
return this.getSummary();
|
|
3321
3181
|
case 7:
|
|
3322
|
-
summaryBefore =
|
|
3182
|
+
summaryBefore = _context28.sent;
|
|
3323
3183
|
if (customerId) {
|
|
3324
|
-
|
|
3184
|
+
_context28.next = 10;
|
|
3325
3185
|
break;
|
|
3326
3186
|
}
|
|
3327
|
-
return
|
|
3187
|
+
return _context28.abrupt("return", buildPlannerDiscountResult({
|
|
3328
3188
|
customerId: null,
|
|
3329
3189
|
discountList: this.getDiscountList(),
|
|
3330
3190
|
products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
|
|
@@ -3333,7 +3193,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3333
3193
|
status: 'no_customer'
|
|
3334
3194
|
}));
|
|
3335
3195
|
case 10:
|
|
3336
|
-
|
|
3196
|
+
_context28.next = 12;
|
|
3337
3197
|
return this.loadDiscountConfig({
|
|
3338
3198
|
customerId: customerId,
|
|
3339
3199
|
action: 'create'
|
|
@@ -3345,7 +3205,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3345
3205
|
return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
|
|
3346
3206
|
});
|
|
3347
3207
|
if (!preferredDiscount) {
|
|
3348
|
-
|
|
3208
|
+
_context28.next = 40;
|
|
3349
3209
|
break;
|
|
3350
3210
|
}
|
|
3351
3211
|
// A requested card is an explicit UI choice, not a best-effort preference. Clear prior
|
|
@@ -3357,98 +3217,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3357
3217
|
return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
|
|
3358
3218
|
});
|
|
3359
3219
|
_iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
|
|
3360
|
-
|
|
3220
|
+
_context28.prev = 18;
|
|
3361
3221
|
_iterator2.s();
|
|
3362
3222
|
case 20:
|
|
3363
3223
|
if ((_step2 = _iterator2.n()).done) {
|
|
3364
|
-
|
|
3224
|
+
_context28.next = 28;
|
|
3365
3225
|
break;
|
|
3366
3226
|
}
|
|
3367
3227
|
discount = _step2.value;
|
|
3368
3228
|
discountId = Number(resolvePlannerDiscountId(discount));
|
|
3369
3229
|
if (!Number.isFinite(discountId)) {
|
|
3370
|
-
|
|
3230
|
+
_context28.next = 26;
|
|
3371
3231
|
break;
|
|
3372
3232
|
}
|
|
3373
|
-
|
|
3233
|
+
_context28.next = 26;
|
|
3374
3234
|
return this.setDiscountSelected({
|
|
3375
3235
|
discountId: discountId,
|
|
3376
3236
|
isSelected: false
|
|
3377
3237
|
});
|
|
3378
3238
|
case 26:
|
|
3379
|
-
|
|
3239
|
+
_context28.next = 20;
|
|
3380
3240
|
break;
|
|
3381
3241
|
case 28:
|
|
3382
|
-
|
|
3242
|
+
_context28.next = 33;
|
|
3383
3243
|
break;
|
|
3384
3244
|
case 30:
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
_iterator2.e(
|
|
3245
|
+
_context28.prev = 30;
|
|
3246
|
+
_context28.t0 = _context28["catch"](18);
|
|
3247
|
+
_iterator2.e(_context28.t0);
|
|
3388
3248
|
case 33:
|
|
3389
|
-
|
|
3249
|
+
_context28.prev = 33;
|
|
3390
3250
|
_iterator2.f();
|
|
3391
|
-
return
|
|
3251
|
+
return _context28.finish(33);
|
|
3392
3252
|
case 36:
|
|
3393
|
-
|
|
3253
|
+
_context28.next = 38;
|
|
3394
3254
|
return this.setDiscountSelected({
|
|
3395
3255
|
discountId: Number(preferredId),
|
|
3396
3256
|
isSelected: true
|
|
3397
3257
|
});
|
|
3398
3258
|
case 38:
|
|
3399
|
-
|
|
3259
|
+
_context28.next = 49;
|
|
3400
3260
|
break;
|
|
3401
3261
|
case 40:
|
|
3402
3262
|
if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
|
|
3403
|
-
|
|
3263
|
+
_context28.next = 46;
|
|
3404
3264
|
break;
|
|
3405
3265
|
}
|
|
3406
3266
|
if (!(params.applyBestDiscount !== false)) {
|
|
3407
|
-
|
|
3267
|
+
_context28.next = 44;
|
|
3408
3268
|
break;
|
|
3409
3269
|
}
|
|
3410
|
-
|
|
3270
|
+
_context28.next = 44;
|
|
3411
3271
|
return this.bestDiscount();
|
|
3412
3272
|
case 44:
|
|
3413
|
-
|
|
3273
|
+
_context28.next = 49;
|
|
3414
3274
|
break;
|
|
3415
3275
|
case 46:
|
|
3416
3276
|
if (!(params.applyBestDiscount !== false)) {
|
|
3417
|
-
|
|
3277
|
+
_context28.next = 49;
|
|
3418
3278
|
break;
|
|
3419
3279
|
}
|
|
3420
|
-
|
|
3280
|
+
_context28.next = 49;
|
|
3421
3281
|
return this.bestDiscount();
|
|
3422
3282
|
case 49:
|
|
3423
3283
|
nextTempOrder = this.getTempOrder();
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3284
|
+
_context28.t1 = buildPlannerDiscountResult;
|
|
3285
|
+
_context28.t2 = customerId;
|
|
3286
|
+
_context28.t3 = this.getDiscountList();
|
|
3287
|
+
_context28.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
|
|
3288
|
+
_context28.t5 = summaryBefore;
|
|
3289
|
+
_context28.next = 57;
|
|
3430
3290
|
return this.getSummary();
|
|
3431
3291
|
case 57:
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
customerId:
|
|
3438
|
-
discountList:
|
|
3439
|
-
products:
|
|
3440
|
-
summaryBefore:
|
|
3441
|
-
summaryAfter:
|
|
3442
|
-
status:
|
|
3443
|
-
preferredDiscountId:
|
|
3444
|
-
preferredDiscountFound:
|
|
3292
|
+
_context28.t6 = _context28.sent;
|
|
3293
|
+
_context28.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
|
|
3294
|
+
_context28.t8 = preferredDiscountId;
|
|
3295
|
+
_context28.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
|
|
3296
|
+
_context28.t10 = {
|
|
3297
|
+
customerId: _context28.t2,
|
|
3298
|
+
discountList: _context28.t3,
|
|
3299
|
+
products: _context28.t4,
|
|
3300
|
+
summaryBefore: _context28.t5,
|
|
3301
|
+
summaryAfter: _context28.t6,
|
|
3302
|
+
status: _context28.t7,
|
|
3303
|
+
preferredDiscountId: _context28.t8,
|
|
3304
|
+
preferredDiscountFound: _context28.t9
|
|
3445
3305
|
};
|
|
3446
|
-
return
|
|
3306
|
+
return _context28.abrupt("return", (0, _context28.t1)(_context28.t10));
|
|
3447
3307
|
case 63:
|
|
3448
3308
|
case "end":
|
|
3449
|
-
return
|
|
3309
|
+
return _context28.stop();
|
|
3450
3310
|
}
|
|
3451
|
-
},
|
|
3311
|
+
}, _callee28, this, [[18, 30, 33, 36]]);
|
|
3452
3312
|
}));
|
|
3453
3313
|
function applyPlannerDiscounts() {
|
|
3454
3314
|
return _applyPlannerDiscounts.apply(this, arguments);
|
|
@@ -3486,29 +3346,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3486
3346
|
}, {
|
|
3487
3347
|
key: "removeExistingStagedLines",
|
|
3488
3348
|
value: (function () {
|
|
3489
|
-
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3349
|
+
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(ownershipKey) {
|
|
3490
3350
|
var _this$getTempOrder;
|
|
3491
3351
|
var existingLines;
|
|
3492
|
-
return _regeneratorRuntime().wrap(function
|
|
3493
|
-
while (1) switch (
|
|
3352
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3353
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3494
3354
|
case 0:
|
|
3495
3355
|
existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
|
|
3496
3356
|
var _product$metadata4;
|
|
3497
3357
|
return (product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4[ownershipKey]) === true;
|
|
3498
3358
|
});
|
|
3499
3359
|
if (!(existingLines.length > 0)) {
|
|
3500
|
-
|
|
3360
|
+
_context29.next = 4;
|
|
3501
3361
|
break;
|
|
3502
3362
|
}
|
|
3503
|
-
|
|
3363
|
+
_context29.next = 4;
|
|
3504
3364
|
return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
|
|
3505
3365
|
case 4:
|
|
3506
3366
|
case "end":
|
|
3507
|
-
return
|
|
3367
|
+
return _context29.stop();
|
|
3508
3368
|
}
|
|
3509
|
-
},
|
|
3369
|
+
}, _callee29, this);
|
|
3510
3370
|
}));
|
|
3511
|
-
function removeExistingStagedLines(
|
|
3371
|
+
function removeExistingStagedLines(_x15) {
|
|
3512
3372
|
return _removeExistingStagedLines.apply(this, arguments);
|
|
3513
3373
|
}
|
|
3514
3374
|
return removeExistingStagedLines;
|
|
@@ -3516,80 +3376,80 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3516
3376
|
}, {
|
|
3517
3377
|
key: "stageProducts",
|
|
3518
3378
|
value: function () {
|
|
3519
|
-
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3379
|
+
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params, ownershipKey) {
|
|
3520
3380
|
var _params$rawProducts;
|
|
3521
3381
|
var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
|
|
3522
|
-
return _regeneratorRuntime().wrap(function
|
|
3523
|
-
while (1) switch (
|
|
3382
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3383
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3524
3384
|
case 0:
|
|
3525
3385
|
productIds = params.productIds || [];
|
|
3526
3386
|
if (productIds.length) {
|
|
3527
|
-
|
|
3387
|
+
_context30.next = 3;
|
|
3528
3388
|
break;
|
|
3529
3389
|
}
|
|
3530
|
-
return
|
|
3390
|
+
return _context30.abrupt("return", this.getTempOrder());
|
|
3531
3391
|
case 3:
|
|
3532
3392
|
if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
|
|
3533
|
-
|
|
3393
|
+
_context30.next = 7;
|
|
3534
3394
|
break;
|
|
3535
3395
|
}
|
|
3536
3396
|
this.unifiedProductCatalog = params.rawProducts;
|
|
3537
|
-
|
|
3397
|
+
_context30.next = 12;
|
|
3538
3398
|
break;
|
|
3539
3399
|
case 7:
|
|
3540
3400
|
existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
|
|
3541
|
-
var _product$
|
|
3542
|
-
return String((_product$
|
|
3401
|
+
var _product$id;
|
|
3402
|
+
return String((_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id);
|
|
3543
3403
|
}));
|
|
3544
3404
|
missingIds = productIds.filter(function (id) {
|
|
3545
3405
|
return !existingIds.has(String(id));
|
|
3546
3406
|
});
|
|
3547
3407
|
if (!(missingIds.length || params.productLoadParams)) {
|
|
3548
|
-
|
|
3408
|
+
_context30.next = 12;
|
|
3549
3409
|
break;
|
|
3550
3410
|
}
|
|
3551
|
-
|
|
3411
|
+
_context30.next = 12;
|
|
3552
3412
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
3553
3413
|
product_ids: productIds.map(Number).filter(Number.isFinite)
|
|
3554
3414
|
}));
|
|
3555
3415
|
case 12:
|
|
3556
|
-
|
|
3416
|
+
_context30.next = 14;
|
|
3557
3417
|
return this.removeExistingStagedLines(ownershipKey);
|
|
3558
3418
|
case 14:
|
|
3559
3419
|
productIdSet = new Set(productIds.map(function (id) {
|
|
3560
3420
|
return String(id);
|
|
3561
3421
|
}));
|
|
3562
3422
|
selectedProducts = (this.unifiedProductCatalog || []).filter(function (product) {
|
|
3563
|
-
var _product$
|
|
3564
|
-
return productIdSet.has(String((_product$
|
|
3423
|
+
var _product$id2;
|
|
3424
|
+
return productIdSet.has(String((_product$id2 = product.id) !== null && _product$id2 !== void 0 ? _product$id2 : product.product_id));
|
|
3565
3425
|
});
|
|
3566
3426
|
_i = 0, _arr = selectedProducts;
|
|
3567
3427
|
case 17:
|
|
3568
3428
|
if (!(_i < _arr.length)) {
|
|
3569
|
-
|
|
3429
|
+
_context30.next = 26;
|
|
3570
3430
|
break;
|
|
3571
3431
|
}
|
|
3572
3432
|
sourceProduct = _arr[_i];
|
|
3573
3433
|
productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
|
|
3574
3434
|
if (!productInput) {
|
|
3575
|
-
|
|
3435
|
+
_context30.next = 23;
|
|
3576
3436
|
break;
|
|
3577
3437
|
}
|
|
3578
|
-
|
|
3438
|
+
_context30.next = 23;
|
|
3579
3439
|
return this.addProductToOrder(productInput);
|
|
3580
3440
|
case 23:
|
|
3581
3441
|
_i++;
|
|
3582
|
-
|
|
3442
|
+
_context30.next = 17;
|
|
3583
3443
|
break;
|
|
3584
3444
|
case 26:
|
|
3585
|
-
return
|
|
3445
|
+
return _context30.abrupt("return", this.getTempOrder());
|
|
3586
3446
|
case 27:
|
|
3587
3447
|
case "end":
|
|
3588
|
-
return
|
|
3448
|
+
return _context30.stop();
|
|
3589
3449
|
}
|
|
3590
|
-
},
|
|
3450
|
+
}, _callee30, this);
|
|
3591
3451
|
}));
|
|
3592
|
-
function stageProducts(
|
|
3452
|
+
function stageProducts(_x16, _x17) {
|
|
3593
3453
|
return _stageProducts.apply(this, arguments);
|
|
3594
3454
|
}
|
|
3595
3455
|
return stageProducts;
|
|
@@ -3601,18 +3461,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3601
3461
|
}, {
|
|
3602
3462
|
key: "stageRetailProducts",
|
|
3603
3463
|
value: (function () {
|
|
3604
|
-
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3605
|
-
return _regeneratorRuntime().wrap(function
|
|
3606
|
-
while (1) switch (
|
|
3464
|
+
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3465
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3466
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3607
3467
|
case 0:
|
|
3608
|
-
return
|
|
3468
|
+
return _context31.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
|
|
3609
3469
|
case 1:
|
|
3610
3470
|
case "end":
|
|
3611
|
-
return
|
|
3471
|
+
return _context31.stop();
|
|
3612
3472
|
}
|
|
3613
|
-
},
|
|
3473
|
+
}, _callee31, this);
|
|
3614
3474
|
}));
|
|
3615
|
-
function stageRetailProducts(
|
|
3475
|
+
function stageRetailProducts(_x18) {
|
|
3616
3476
|
return _stageRetailProducts.apply(this, arguments);
|
|
3617
3477
|
}
|
|
3618
3478
|
return stageRetailProducts;
|
|
@@ -3626,15 +3486,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3626
3486
|
}, {
|
|
3627
3487
|
key: "addRetailProduct",
|
|
3628
3488
|
value: (function () {
|
|
3629
|
-
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3489
|
+
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3630
3490
|
var _params$quantity, _ref46, _params$productId, _params$product, _params$product2;
|
|
3631
3491
|
var quantity, productId, sourceProduct, products, orderProduct;
|
|
3632
|
-
return _regeneratorRuntime().wrap(function
|
|
3633
|
-
while (1) switch (
|
|
3492
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3493
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3634
3494
|
case 0:
|
|
3635
3495
|
quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
|
|
3636
3496
|
if (!(!Number.isFinite(quantity) || quantity <= 0)) {
|
|
3637
|
-
|
|
3497
|
+
_context32.next = 3;
|
|
3638
3498
|
break;
|
|
3639
3499
|
}
|
|
3640
3500
|
throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
|
|
@@ -3643,27 +3503,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3643
3503
|
sourceProduct = params.product;
|
|
3644
3504
|
if (!sourceProduct && productId !== undefined && productId !== null) {
|
|
3645
3505
|
sourceProduct = this.unifiedProductCatalog.find(function (product) {
|
|
3646
|
-
var _product$
|
|
3647
|
-
return String((_product$
|
|
3506
|
+
var _product$id3;
|
|
3507
|
+
return String((_product$id3 = product.id) !== null && _product$id3 !== void 0 ? _product$id3 : product.product_id) === String(productId);
|
|
3648
3508
|
});
|
|
3649
3509
|
}
|
|
3650
3510
|
if (!(!sourceProduct && productId !== undefined && productId !== null)) {
|
|
3651
|
-
|
|
3511
|
+
_context32.next = 11;
|
|
3652
3512
|
break;
|
|
3653
3513
|
}
|
|
3654
|
-
|
|
3514
|
+
_context32.next = 9;
|
|
3655
3515
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
3656
3516
|
product_ids: [Number(productId)].filter(Number.isFinite)
|
|
3657
3517
|
}));
|
|
3658
3518
|
case 9:
|
|
3659
|
-
products =
|
|
3519
|
+
products = _context32.sent;
|
|
3660
3520
|
sourceProduct = products.find(function (product) {
|
|
3661
|
-
var _product$
|
|
3662
|
-
return String((_product$
|
|
3521
|
+
var _product$id4;
|
|
3522
|
+
return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
|
|
3663
3523
|
});
|
|
3664
3524
|
case 11:
|
|
3665
3525
|
if (sourceProduct) {
|
|
3666
|
-
|
|
3526
|
+
_context32.next = 13;
|
|
3667
3527
|
break;
|
|
3668
3528
|
}
|
|
3669
3529
|
throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
|
|
@@ -3672,19 +3532,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3672
3532
|
quantity: quantity
|
|
3673
3533
|
}), 'unified_booking_sales_retail');
|
|
3674
3534
|
if (orderProduct) {
|
|
3675
|
-
|
|
3535
|
+
_context32.next = 16;
|
|
3676
3536
|
break;
|
|
3677
3537
|
}
|
|
3678
3538
|
throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
|
|
3679
3539
|
case 16:
|
|
3680
|
-
return
|
|
3540
|
+
return _context32.abrupt("return", this.addProductToOrder(orderProduct));
|
|
3681
3541
|
case 17:
|
|
3682
3542
|
case "end":
|
|
3683
|
-
return
|
|
3543
|
+
return _context32.stop();
|
|
3684
3544
|
}
|
|
3685
|
-
},
|
|
3545
|
+
}, _callee32, this);
|
|
3686
3546
|
}));
|
|
3687
|
-
function addRetailProduct(
|
|
3547
|
+
function addRetailProduct(_x19) {
|
|
3688
3548
|
return _addRetailProduct.apply(this, arguments);
|
|
3689
3549
|
}
|
|
3690
3550
|
return addRetailProduct;
|
|
@@ -3784,7 +3644,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3784
3644
|
}, {
|
|
3785
3645
|
key: "buildAvailabilityOperatingHoursSnapshot",
|
|
3786
3646
|
value: function buildAvailabilityOperatingHoursSnapshot(params) {
|
|
3787
|
-
var
|
|
3647
|
+
var _this7 = this;
|
|
3788
3648
|
var descriptor = params.prepare._availabilityOperatingHours || {
|
|
3789
3649
|
source: params.prepare.businessHours ? 'prepare_business_hours' : 'default_business_hours',
|
|
3790
3650
|
scheduleIds: []
|
|
@@ -3794,7 +3654,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3794
3654
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3795
3655
|
startAt: "".concat(date, "T").concat(params.businessHours.startTime, ":00"),
|
|
3796
3656
|
endAt: "".concat(date, "T").concat(params.businessHours.endTime, ":00"),
|
|
3797
|
-
fixedOffsetMinutes:
|
|
3657
|
+
fixedOffsetMinutes: _this7.getAvailabilityRuntimeOffsetMinutes(),
|
|
3798
3658
|
rollOverEnd: true
|
|
3799
3659
|
});
|
|
3800
3660
|
return range ? [{
|
|
@@ -3829,7 +3689,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3829
3689
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3830
3690
|
startAt: slot.start_at,
|
|
3831
3691
|
endAt: slot.end_at,
|
|
3832
|
-
fixedOffsetMinutes:
|
|
3692
|
+
fixedOffsetMinutes: _this7.getAvailabilityRuntimeOffsetMinutes(),
|
|
3833
3693
|
rollOverEnd: true
|
|
3834
3694
|
});
|
|
3835
3695
|
return range ? [{
|
|
@@ -3845,7 +3705,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3845
3705
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
3846
3706
|
startAt: slot.start_at,
|
|
3847
3707
|
endAt: slot.end_at,
|
|
3848
|
-
fixedOffsetMinutes:
|
|
3708
|
+
fixedOffsetMinutes: _this7.getAvailabilityRuntimeOffsetMinutes(),
|
|
3849
3709
|
rollOverEnd: true
|
|
3850
3710
|
});
|
|
3851
3711
|
return range ? [{
|
|
@@ -3872,46 +3732,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3872
3732
|
}, {
|
|
3873
3733
|
key: "loadAvailabilityProducts",
|
|
3874
3734
|
value: function () {
|
|
3875
|
-
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3735
|
+
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
3876
3736
|
var _prepare$catalogScope,
|
|
3877
3737
|
_prepare$catalogScope2,
|
|
3878
|
-
|
|
3738
|
+
_this8 = this,
|
|
3879
3739
|
_prepare$resourceIds;
|
|
3880
3740
|
var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
|
|
3881
|
-
return _regeneratorRuntime().wrap(function
|
|
3882
|
-
while (1) switch (
|
|
3741
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3742
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3883
3743
|
case 0:
|
|
3884
3744
|
prepare = params.prepare, dateRange = params.dateRange;
|
|
3885
3745
|
explicitProductIds = prepare.productIds || [];
|
|
3886
3746
|
rawProducts = [];
|
|
3887
3747
|
if (!Array.isArray(prepare.rawProducts)) {
|
|
3888
|
-
|
|
3748
|
+
_context33.next = 8;
|
|
3889
3749
|
break;
|
|
3890
3750
|
}
|
|
3891
3751
|
rawProducts = prepare.rawProducts;
|
|
3892
3752
|
this.unifiedProductCatalog = _toConsumableArray(rawProducts);
|
|
3893
|
-
|
|
3753
|
+
_context33.next = 34;
|
|
3894
3754
|
break;
|
|
3895
3755
|
case 8:
|
|
3896
3756
|
if (!(explicitProductIds.length > 0)) {
|
|
3897
|
-
|
|
3757
|
+
_context33.next = 14;
|
|
3898
3758
|
break;
|
|
3899
3759
|
}
|
|
3900
|
-
|
|
3760
|
+
_context33.next = 11;
|
|
3901
3761
|
return this.loadProducts({
|
|
3902
3762
|
product_ids: explicitProductIds,
|
|
3903
3763
|
schedule_date: dateRange.startDate
|
|
3904
3764
|
});
|
|
3905
3765
|
case 11:
|
|
3906
|
-
rawProducts =
|
|
3907
|
-
|
|
3766
|
+
rawProducts = _context33.sent;
|
|
3767
|
+
_context33.next = 34;
|
|
3908
3768
|
break;
|
|
3909
3769
|
case 14:
|
|
3910
3770
|
if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
|
|
3911
|
-
|
|
3771
|
+
_context33.next = 30;
|
|
3912
3772
|
break;
|
|
3913
3773
|
}
|
|
3914
|
-
|
|
3774
|
+
_context33.next = 17;
|
|
3915
3775
|
return this.loadScheduleAvailableDate({
|
|
3916
3776
|
startDate: dateRange.startDate,
|
|
3917
3777
|
endDate: dateRange.endDate,
|
|
@@ -3927,44 +3787,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3927
3787
|
});
|
|
3928
3788
|
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)) || [])));
|
|
3929
3789
|
if (!(productIds.length > 0)) {
|
|
3930
|
-
|
|
3790
|
+
_context33.next = 27;
|
|
3931
3791
|
break;
|
|
3932
3792
|
}
|
|
3933
3793
|
assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
|
|
3934
|
-
|
|
3794
|
+
_context33.next = 24;
|
|
3935
3795
|
return this.loadProducts({
|
|
3936
3796
|
product_ids: productIds,
|
|
3937
3797
|
schedule_date: dateRange.startDate
|
|
3938
3798
|
});
|
|
3939
3799
|
case 24:
|
|
3940
|
-
rawProducts =
|
|
3941
|
-
|
|
3800
|
+
rawProducts = _context33.sent;
|
|
3801
|
+
_context33.next = 28;
|
|
3942
3802
|
break;
|
|
3943
3803
|
case 27:
|
|
3944
3804
|
this.unifiedProductCatalog = [];
|
|
3945
3805
|
case 28:
|
|
3946
|
-
|
|
3806
|
+
_context33.next = 34;
|
|
3947
3807
|
break;
|
|
3948
3808
|
case 30:
|
|
3949
3809
|
if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
|
|
3950
|
-
|
|
3810
|
+
_context33.next = 34;
|
|
3951
3811
|
break;
|
|
3952
3812
|
}
|
|
3953
|
-
|
|
3813
|
+
_context33.next = 33;
|
|
3954
3814
|
return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
|
|
3955
3815
|
schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
|
|
3956
3816
|
}));
|
|
3957
3817
|
case 33:
|
|
3958
|
-
rawProducts =
|
|
3818
|
+
rawProducts = _context33.sent;
|
|
3959
3819
|
case 34:
|
|
3960
3820
|
normalized = rawProducts.map(function (product) {
|
|
3961
|
-
return normalizeProductForAvailability(product, params.scheduleList,
|
|
3821
|
+
return normalizeProductForAvailability(product, params.scheduleList, _this8.getAvailabilityRuntimeOffsetMinutes());
|
|
3962
3822
|
});
|
|
3963
3823
|
if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
|
|
3964
|
-
|
|
3824
|
+
_context33.next = 37;
|
|
3965
3825
|
break;
|
|
3966
3826
|
}
|
|
3967
|
-
return
|
|
3827
|
+
return _context33.abrupt("return", normalized.filter(function (product) {
|
|
3968
3828
|
var _product$requirementG2;
|
|
3969
3829
|
return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
|
|
3970
3830
|
var _group$resourceIds3;
|
|
@@ -3977,16 +3837,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3977
3837
|
}));
|
|
3978
3838
|
case 37:
|
|
3979
3839
|
productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
|
|
3980
|
-
return
|
|
3840
|
+
return _context33.abrupt("return", productIdSet ? normalized.filter(function (product) {
|
|
3981
3841
|
return productIdSet.has(String(product.id));
|
|
3982
3842
|
}) : normalized);
|
|
3983
3843
|
case 39:
|
|
3984
3844
|
case "end":
|
|
3985
|
-
return
|
|
3845
|
+
return _context33.stop();
|
|
3986
3846
|
}
|
|
3987
|
-
},
|
|
3847
|
+
}, _callee33, this);
|
|
3988
3848
|
}));
|
|
3989
|
-
function loadAvailabilityProducts(
|
|
3849
|
+
function loadAvailabilityProducts(_x20) {
|
|
3990
3850
|
return _loadAvailabilityProducts.apply(this, arguments);
|
|
3991
3851
|
}
|
|
3992
3852
|
return loadAvailabilityProducts;
|
|
@@ -3999,12 +3859,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3999
3859
|
}, {
|
|
4000
3860
|
key: "fetchAvailabilityResourcesV2",
|
|
4001
3861
|
value: (function () {
|
|
4002
|
-
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3862
|
+
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
4003
3863
|
var response, data;
|
|
4004
|
-
return _regeneratorRuntime().wrap(function
|
|
4005
|
-
while (1) switch (
|
|
3864
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3865
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
4006
3866
|
case 0:
|
|
4007
|
-
|
|
3867
|
+
_context34.next = 2;
|
|
4008
3868
|
return this.request.get('/schedule/resource/list/v2', {
|
|
4009
3869
|
start_date: params.dateRange.startDate,
|
|
4010
3870
|
end_date: params.dateRange.endDate,
|
|
@@ -4014,28 +3874,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4014
3874
|
useCache: false
|
|
4015
3875
|
});
|
|
4016
3876
|
case 2:
|
|
4017
|
-
response =
|
|
3877
|
+
response = _context34.sent;
|
|
4018
3878
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
4019
3879
|
if (!Array.isArray(data)) {
|
|
4020
|
-
|
|
3880
|
+
_context34.next = 6;
|
|
4021
3881
|
break;
|
|
4022
3882
|
}
|
|
4023
|
-
return
|
|
3883
|
+
return _context34.abrupt("return", data);
|
|
4024
3884
|
case 6:
|
|
4025
3885
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
|
|
4026
|
-
|
|
3886
|
+
_context34.next = 8;
|
|
4027
3887
|
break;
|
|
4028
3888
|
}
|
|
4029
|
-
return
|
|
3889
|
+
return _context34.abrupt("return", data.list);
|
|
4030
3890
|
case 8:
|
|
4031
|
-
return
|
|
3891
|
+
return _context34.abrupt("return", []);
|
|
4032
3892
|
case 9:
|
|
4033
3893
|
case "end":
|
|
4034
|
-
return
|
|
3894
|
+
return _context34.stop();
|
|
4035
3895
|
}
|
|
4036
|
-
},
|
|
3896
|
+
}, _callee34, this);
|
|
4037
3897
|
}));
|
|
4038
|
-
function fetchAvailabilityResourcesV2(
|
|
3898
|
+
function fetchAvailabilityResourcesV2(_x21) {
|
|
4039
3899
|
return _fetchAvailabilityResourcesV.apply(this, arguments);
|
|
4040
3900
|
}
|
|
4041
3901
|
return fetchAvailabilityResourcesV2;
|
|
@@ -4043,17 +3903,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4043
3903
|
}, {
|
|
4044
3904
|
key: "fetchAndPublishAvailabilityResourcesV2",
|
|
4045
3905
|
value: function () {
|
|
4046
|
-
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3906
|
+
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
4047
3907
|
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
|
|
4048
|
-
return _regeneratorRuntime().wrap(function
|
|
4049
|
-
while (1) switch (
|
|
3908
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3909
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
4050
3910
|
case 0:
|
|
4051
3911
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4052
3912
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4053
|
-
|
|
3913
|
+
_context35.next = 3;
|
|
4054
3914
|
break;
|
|
4055
3915
|
}
|
|
4056
|
-
return
|
|
3916
|
+
return _context35.abrupt("return", []);
|
|
4057
3917
|
case 3:
|
|
4058
3918
|
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
4059
3919
|
cacheParams = {
|
|
@@ -4063,7 +3923,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4063
3923
|
};
|
|
4064
3924
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
4065
3925
|
if (!cachedRawResources) {
|
|
4066
|
-
|
|
3926
|
+
_context35.next = 9;
|
|
4067
3927
|
break;
|
|
4068
3928
|
}
|
|
4069
3929
|
if (params.useCacheOnHit) {
|
|
@@ -4075,23 +3935,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4075
3935
|
console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
|
|
4076
3936
|
});
|
|
4077
3937
|
}
|
|
4078
|
-
return
|
|
3938
|
+
return _context35.abrupt("return", cachedRawResources);
|
|
4079
3939
|
case 9:
|
|
4080
|
-
|
|
3940
|
+
_context35.next = 11;
|
|
4081
3941
|
return this.refreshAvailabilityRemoteResourceQuery({
|
|
4082
3942
|
timezone: params.timezone,
|
|
4083
3943
|
dateRange: params.dateRange,
|
|
4084
3944
|
resourceIds: normalizedResourceIds
|
|
4085
3945
|
});
|
|
4086
3946
|
case 11:
|
|
4087
|
-
return
|
|
3947
|
+
return _context35.abrupt("return", _context35.sent);
|
|
4088
3948
|
case 12:
|
|
4089
3949
|
case "end":
|
|
4090
|
-
return
|
|
3950
|
+
return _context35.stop();
|
|
4091
3951
|
}
|
|
4092
|
-
},
|
|
3952
|
+
}, _callee35, this);
|
|
4093
3953
|
}));
|
|
4094
|
-
function fetchAndPublishAvailabilityResourcesV2(
|
|
3954
|
+
function fetchAndPublishAvailabilityResourcesV2(_x22) {
|
|
4095
3955
|
return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
|
|
4096
3956
|
}
|
|
4097
3957
|
return fetchAndPublishAvailabilityResourcesV2;
|
|
@@ -4099,17 +3959,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4099
3959
|
}, {
|
|
4100
3960
|
key: "refreshAvailabilityRemoteResourceQuery",
|
|
4101
3961
|
value: function () {
|
|
4102
|
-
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3962
|
+
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
4103
3963
|
var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
|
|
4104
|
-
return _regeneratorRuntime().wrap(function
|
|
4105
|
-
while (1) switch (
|
|
3964
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3965
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
4106
3966
|
case 0:
|
|
4107
3967
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4108
3968
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4109
|
-
|
|
3969
|
+
_context36.next = 3;
|
|
4110
3970
|
break;
|
|
4111
3971
|
}
|
|
4112
|
-
return
|
|
3972
|
+
return _context36.abrupt("return", []);
|
|
4113
3973
|
case 3:
|
|
4114
3974
|
queryKey = this.buildAvailabilityRemoteResourceQueryKey({
|
|
4115
3975
|
timezone: params.timezone,
|
|
@@ -4119,13 +3979,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4119
3979
|
epoch = this.availabilityRemoteResourceEpoch;
|
|
4120
3980
|
existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4121
3981
|
if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
|
|
4122
|
-
|
|
3982
|
+
_context36.next = 10;
|
|
4123
3983
|
break;
|
|
4124
3984
|
}
|
|
4125
|
-
|
|
3985
|
+
_context36.next = 9;
|
|
4126
3986
|
return existing.promise;
|
|
4127
3987
|
case 9:
|
|
4128
|
-
return
|
|
3988
|
+
return _context36.abrupt("return", _context36.sent);
|
|
4129
3989
|
case 10:
|
|
4130
3990
|
this.availabilityRemoteResourceQuerySequence += 1;
|
|
4131
3991
|
writeVersion = this.availabilityRemoteResourceQuerySequence;
|
|
@@ -4137,11 +3997,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4137
3997
|
epoch: epoch,
|
|
4138
3998
|
promise: promise
|
|
4139
3999
|
});
|
|
4140
|
-
|
|
4141
|
-
|
|
4000
|
+
_context36.prev = 14;
|
|
4001
|
+
_context36.next = 17;
|
|
4142
4002
|
return promise;
|
|
4143
4003
|
case 17:
|
|
4144
|
-
rawResources =
|
|
4004
|
+
rawResources = _context36.sent;
|
|
4145
4005
|
if (epoch === this.availabilityRemoteResourceEpoch) {
|
|
4146
4006
|
this.availabilityRemoteOccupancyCache.publish({
|
|
4147
4007
|
scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
|
|
@@ -4152,21 +4012,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4152
4012
|
version: writeVersion
|
|
4153
4013
|
});
|
|
4154
4014
|
}
|
|
4155
|
-
return
|
|
4015
|
+
return _context36.abrupt("return", rawResources);
|
|
4156
4016
|
case 20:
|
|
4157
|
-
|
|
4017
|
+
_context36.prev = 20;
|
|
4158
4018
|
current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4159
4019
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4160
4020
|
this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
|
|
4161
4021
|
}
|
|
4162
|
-
return
|
|
4022
|
+
return _context36.finish(20);
|
|
4163
4023
|
case 24:
|
|
4164
4024
|
case "end":
|
|
4165
|
-
return
|
|
4025
|
+
return _context36.stop();
|
|
4166
4026
|
}
|
|
4167
|
-
},
|
|
4027
|
+
}, _callee36, this, [[14,, 20, 24]]);
|
|
4168
4028
|
}));
|
|
4169
|
-
function refreshAvailabilityRemoteResourceQuery(
|
|
4029
|
+
function refreshAvailabilityRemoteResourceQuery(_x23) {
|
|
4170
4030
|
return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
|
|
4171
4031
|
}
|
|
4172
4032
|
return refreshAvailabilityRemoteResourceQuery;
|
|
@@ -4174,26 +4034,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4174
4034
|
}, {
|
|
4175
4035
|
key: "loadAvailabilityResources",
|
|
4176
4036
|
value: function () {
|
|
4177
|
-
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4037
|
+
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
4178
4038
|
var resourceIds, cachedRawResources, rawResources;
|
|
4179
|
-
return _regeneratorRuntime().wrap(function
|
|
4180
|
-
while (1) switch (
|
|
4039
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
4040
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
4181
4041
|
case 0:
|
|
4182
4042
|
resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
|
|
4183
4043
|
if (!(resourceIds.length === 0)) {
|
|
4184
|
-
|
|
4044
|
+
_context37.next = 3;
|
|
4185
4045
|
break;
|
|
4186
4046
|
}
|
|
4187
|
-
return
|
|
4047
|
+
return _context37.abrupt("return", {
|
|
4188
4048
|
resources: [],
|
|
4189
4049
|
resourceOccupancies: []
|
|
4190
4050
|
});
|
|
4191
4051
|
case 3:
|
|
4192
4052
|
if (!Array.isArray(params.rawResources)) {
|
|
4193
|
-
|
|
4053
|
+
_context37.next = 5;
|
|
4194
4054
|
break;
|
|
4195
4055
|
}
|
|
4196
|
-
return
|
|
4056
|
+
return _context37.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4197
4057
|
rawResources: params.rawResources,
|
|
4198
4058
|
scheduleList: params.scheduleList,
|
|
4199
4059
|
dateRange: params.dateRange,
|
|
@@ -4201,7 +4061,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4201
4061
|
}));
|
|
4202
4062
|
case 5:
|
|
4203
4063
|
if (!(params.fetchPolicy === 'cache_only')) {
|
|
4204
|
-
|
|
4064
|
+
_context37.next = 10;
|
|
4205
4065
|
break;
|
|
4206
4066
|
}
|
|
4207
4067
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read({
|
|
@@ -4210,22 +4070,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4210
4070
|
dateRange: params.dateRange
|
|
4211
4071
|
});
|
|
4212
4072
|
if (!cachedRawResources) {
|
|
4213
|
-
|
|
4073
|
+
_context37.next = 9;
|
|
4214
4074
|
break;
|
|
4215
4075
|
}
|
|
4216
|
-
return
|
|
4076
|
+
return _context37.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4217
4077
|
rawResources: cachedRawResources,
|
|
4218
4078
|
scheduleList: params.scheduleList,
|
|
4219
4079
|
dateRange: params.dateRange,
|
|
4220
4080
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4221
4081
|
}));
|
|
4222
4082
|
case 9:
|
|
4223
|
-
return
|
|
4083
|
+
return _context37.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
|
|
4224
4084
|
resources: [],
|
|
4225
4085
|
resourceOccupancies: []
|
|
4226
4086
|
});
|
|
4227
4087
|
case 10:
|
|
4228
|
-
|
|
4088
|
+
_context37.next = 12;
|
|
4229
4089
|
return this.fetchAndPublishAvailabilityResourcesV2({
|
|
4230
4090
|
timezone: params.timezone,
|
|
4231
4091
|
dateRange: params.dateRange,
|
|
@@ -4233,8 +4093,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4233
4093
|
useCacheOnHit: true
|
|
4234
4094
|
});
|
|
4235
4095
|
case 12:
|
|
4236
|
-
rawResources =
|
|
4237
|
-
return
|
|
4096
|
+
rawResources = _context37.sent;
|
|
4097
|
+
return _context37.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4238
4098
|
rawResources: rawResources,
|
|
4239
4099
|
scheduleList: params.scheduleList,
|
|
4240
4100
|
dateRange: params.dateRange,
|
|
@@ -4242,11 +4102,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4242
4102
|
}));
|
|
4243
4103
|
case 14:
|
|
4244
4104
|
case "end":
|
|
4245
|
-
return
|
|
4105
|
+
return _context37.stop();
|
|
4246
4106
|
}
|
|
4247
|
-
},
|
|
4107
|
+
}, _callee37, this);
|
|
4248
4108
|
}));
|
|
4249
|
-
function loadAvailabilityResources(
|
|
4109
|
+
function loadAvailabilityResources(_x24) {
|
|
4250
4110
|
return _loadAvailabilityResources.apply(this, arguments);
|
|
4251
4111
|
}
|
|
4252
4112
|
return loadAvailabilityResources;
|
|
@@ -4319,7 +4179,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4319
4179
|
}, {
|
|
4320
4180
|
key: "collectCartResourceOccupancies",
|
|
4321
4181
|
value: function collectCartResourceOccupancies(tempOrder, exclusions) {
|
|
4322
|
-
var
|
|
4182
|
+
var _this9 = this;
|
|
4323
4183
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
4324
4184
|
return bookings.flatMap(function (booking) {
|
|
4325
4185
|
var _ref48, _booking$product_uid2, _booking$metadata2;
|
|
@@ -4336,7 +4196,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4336
4196
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4337
4197
|
startAt: startAt,
|
|
4338
4198
|
endAt: endAt,
|
|
4339
|
-
fixedOffsetMinutes:
|
|
4199
|
+
fixedOffsetMinutes: _this9.getAvailabilityRuntimeOffsetMinutes(),
|
|
4340
4200
|
rollOverEnd: false
|
|
4341
4201
|
});
|
|
4342
4202
|
if (!range) return [];
|
|
@@ -4354,7 +4214,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4354
4214
|
resource: resource
|
|
4355
4215
|
}
|
|
4356
4216
|
};
|
|
4357
|
-
return
|
|
4217
|
+
return _this9.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
|
|
4358
4218
|
});
|
|
4359
4219
|
});
|
|
4360
4220
|
}
|
|
@@ -4421,16 +4281,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4421
4281
|
}, {
|
|
4422
4282
|
key: "assertContextualQueryFreshness",
|
|
4423
4283
|
value: function assertContextualQueryFreshness(context, request) {
|
|
4424
|
-
var
|
|
4284
|
+
var _this10 = this;
|
|
4425
4285
|
if (request.target === 'time') {
|
|
4426
4286
|
request.candidates.forEach(function (candidate) {
|
|
4427
|
-
|
|
4287
|
+
_this10.assertAvailabilityCandidateFreshness(context, candidate);
|
|
4428
4288
|
});
|
|
4429
4289
|
return;
|
|
4430
4290
|
}
|
|
4431
4291
|
if (request.target === 'resource') {
|
|
4432
4292
|
request.selectedRanges.forEach(function (candidate) {
|
|
4433
|
-
|
|
4293
|
+
_this10.assertAvailabilityCandidateFreshness(context, candidate);
|
|
4434
4294
|
});
|
|
4435
4295
|
}
|
|
4436
4296
|
}
|
|
@@ -4477,8 +4337,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4477
4337
|
}, {
|
|
4478
4338
|
key: "buildAvailabilityProjectionSnapshot",
|
|
4479
4339
|
value: function () {
|
|
4480
|
-
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4481
|
-
var
|
|
4340
|
+
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
4341
|
+
var _this11 = this;
|
|
4482
4342
|
var options,
|
|
4483
4343
|
normalizedPrepareParams,
|
|
4484
4344
|
timezoneLabel,
|
|
@@ -4499,11 +4359,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4499
4359
|
durationCandidateAnchorAt,
|
|
4500
4360
|
orderRevision,
|
|
4501
4361
|
projection,
|
|
4502
|
-
|
|
4503
|
-
return _regeneratorRuntime().wrap(function
|
|
4504
|
-
while (1) switch (
|
|
4362
|
+
_args38 = arguments;
|
|
4363
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
4364
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
4505
4365
|
case 0:
|
|
4506
|
-
options =
|
|
4366
|
+
options = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : {};
|
|
4507
4367
|
normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
4508
4368
|
timezoneLabel = String(normalizedPrepareParams.timezone);
|
|
4509
4369
|
dateRange = normalizedPrepareParams.dateRange;
|
|
@@ -4517,15 +4377,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4517
4377
|
scheduleList: scheduleList,
|
|
4518
4378
|
businessHours: businessHours
|
|
4519
4379
|
});
|
|
4520
|
-
|
|
4380
|
+
_context38.next = 11;
|
|
4521
4381
|
return this.loadAvailabilityProducts({
|
|
4522
4382
|
prepare: normalizedPrepareParams,
|
|
4523
4383
|
dateRange: dateRange,
|
|
4524
4384
|
scheduleList: scheduleList
|
|
4525
4385
|
});
|
|
4526
4386
|
case 11:
|
|
4527
|
-
products =
|
|
4528
|
-
|
|
4387
|
+
products = _context38.sent;
|
|
4388
|
+
_context38.next = 14;
|
|
4529
4389
|
return this.loadAvailabilityResources({
|
|
4530
4390
|
timezone: timezoneLabel,
|
|
4531
4391
|
dateRange: dateRange,
|
|
@@ -4537,14 +4397,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4537
4397
|
fallbackResources: options.fallbackResources
|
|
4538
4398
|
});
|
|
4539
4399
|
case 14:
|
|
4540
|
-
loadedResources =
|
|
4400
|
+
loadedResources = _context38.sent;
|
|
4541
4401
|
tempOrder = this.getTempOrder();
|
|
4542
4402
|
exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
|
|
4543
4403
|
injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
|
|
4544
4404
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4545
4405
|
startAt: occupancy.startAt,
|
|
4546
4406
|
endAt: occupancy.endAt,
|
|
4547
|
-
fixedOffsetMinutes:
|
|
4407
|
+
fixedOffsetMinutes: _this11.getAvailabilityRuntimeOffsetMinutes(),
|
|
4548
4408
|
rollOverEnd: false
|
|
4549
4409
|
});
|
|
4550
4410
|
if (!range) return [];
|
|
@@ -4554,7 +4414,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4554
4414
|
})];
|
|
4555
4415
|
});
|
|
4556
4416
|
remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
|
|
4557
|
-
return !
|
|
4417
|
+
return !_this11.occupancyIsExcluded(occupancy, exclusions);
|
|
4558
4418
|
});
|
|
4559
4419
|
cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
|
|
4560
4420
|
preparedAt = this.getAvailabilityRuntimeDateTime();
|
|
@@ -4583,18 +4443,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4583
4443
|
prepareParams: normalizedPrepareParams,
|
|
4584
4444
|
durationCandidateAnchorAt: durationCandidateAnchorAt
|
|
4585
4445
|
});
|
|
4586
|
-
return
|
|
4446
|
+
return _context38.abrupt("return", {
|
|
4587
4447
|
projection: projection,
|
|
4588
4448
|
prepareParams: normalizedPrepareParams,
|
|
4589
4449
|
orderRevision: orderRevision
|
|
4590
4450
|
});
|
|
4591
4451
|
case 26:
|
|
4592
4452
|
case "end":
|
|
4593
|
-
return
|
|
4453
|
+
return _context38.stop();
|
|
4594
4454
|
}
|
|
4595
|
-
},
|
|
4455
|
+
}, _callee38, this);
|
|
4596
4456
|
}));
|
|
4597
|
-
function buildAvailabilityProjectionSnapshot(
|
|
4457
|
+
function buildAvailabilityProjectionSnapshot(_x25) {
|
|
4598
4458
|
return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
|
|
4599
4459
|
}
|
|
4600
4460
|
return buildAvailabilityProjectionSnapshot;
|
|
@@ -4602,10 +4462,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4602
4462
|
}, {
|
|
4603
4463
|
key: "getSharedPreparedAvailabilitySnapshot",
|
|
4604
4464
|
value: function () {
|
|
4605
|
-
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4465
|
+
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
4606
4466
|
var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
|
|
4607
|
-
return _regeneratorRuntime().wrap(function
|
|
4608
|
-
while (1) switch (
|
|
4467
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4468
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
4609
4469
|
case 0:
|
|
4610
4470
|
lifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
4611
4471
|
normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
@@ -4624,15 +4484,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4624
4484
|
}
|
|
4625
4485
|
})) : this.buildAvailabilityPrepareKey(normalizedParams);
|
|
4626
4486
|
if (!hasRawInputs) {
|
|
4627
|
-
|
|
4487
|
+
_context39.next = 11;
|
|
4628
4488
|
break;
|
|
4629
4489
|
}
|
|
4630
|
-
|
|
4490
|
+
_context39.next = 7;
|
|
4631
4491
|
return this.buildAvailabilityProjectionSnapshot(normalizedParams);
|
|
4632
4492
|
case 7:
|
|
4633
|
-
snapshot =
|
|
4493
|
+
snapshot = _context39.sent;
|
|
4634
4494
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
4635
|
-
|
|
4495
|
+
_context39.next = 10;
|
|
4636
4496
|
break;
|
|
4637
4497
|
}
|
|
4638
4498
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -4641,7 +4501,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4641
4501
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
4642
4502
|
});
|
|
4643
4503
|
case 10:
|
|
4644
|
-
return
|
|
4504
|
+
return _context39.abrupt("return", {
|
|
4645
4505
|
prepareKey: prepareKey,
|
|
4646
4506
|
snapshot: snapshot
|
|
4647
4507
|
});
|
|
@@ -4655,13 +4515,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4655
4515
|
promise: promise
|
|
4656
4516
|
});
|
|
4657
4517
|
}
|
|
4658
|
-
|
|
4659
|
-
|
|
4518
|
+
_context39.prev = 14;
|
|
4519
|
+
_context39.next = 17;
|
|
4660
4520
|
return promise;
|
|
4661
4521
|
case 17:
|
|
4662
|
-
_snapshot =
|
|
4522
|
+
_snapshot = _context39.sent;
|
|
4663
4523
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
4664
|
-
|
|
4524
|
+
_context39.next = 20;
|
|
4665
4525
|
break;
|
|
4666
4526
|
}
|
|
4667
4527
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -4670,24 +4530,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4670
4530
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
4671
4531
|
});
|
|
4672
4532
|
case 20:
|
|
4673
|
-
return
|
|
4533
|
+
return _context39.abrupt("return", {
|
|
4674
4534
|
prepareKey: prepareKey,
|
|
4675
4535
|
snapshot: _snapshot
|
|
4676
4536
|
});
|
|
4677
4537
|
case 21:
|
|
4678
|
-
|
|
4538
|
+
_context39.prev = 21;
|
|
4679
4539
|
current = this.availabilityPrepareInFlight.get(prepareKey);
|
|
4680
4540
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4681
4541
|
this.availabilityPrepareInFlight.delete(prepareKey);
|
|
4682
4542
|
}
|
|
4683
|
-
return
|
|
4543
|
+
return _context39.finish(21);
|
|
4684
4544
|
case 25:
|
|
4685
4545
|
case "end":
|
|
4686
|
-
return
|
|
4546
|
+
return _context39.stop();
|
|
4687
4547
|
}
|
|
4688
|
-
},
|
|
4548
|
+
}, _callee39, this, [[14,, 21, 25]]);
|
|
4689
4549
|
}));
|
|
4690
|
-
function getSharedPreparedAvailabilitySnapshot(
|
|
4550
|
+
function getSharedPreparedAvailabilitySnapshot(_x26) {
|
|
4691
4551
|
return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
|
|
4692
4552
|
}
|
|
4693
4553
|
return getSharedPreparedAvailabilitySnapshot;
|
|
@@ -4695,51 +4555,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4695
4555
|
}, {
|
|
4696
4556
|
key: "refreshAvailabilityContextProjection",
|
|
4697
4557
|
value: function () {
|
|
4698
|
-
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4699
|
-
var
|
|
4558
|
+
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
4559
|
+
var _this12 = this;
|
|
4700
4560
|
var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
|
|
4701
|
-
return _regeneratorRuntime().wrap(function
|
|
4702
|
-
while (1) switch (
|
|
4561
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4562
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
4703
4563
|
case 0:
|
|
4704
4564
|
existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
4705
4565
|
if (!existingInFlight) {
|
|
4706
|
-
|
|
4566
|
+
_context41.next = 5;
|
|
4707
4567
|
break;
|
|
4708
4568
|
}
|
|
4709
|
-
|
|
4569
|
+
_context41.next = 4;
|
|
4710
4570
|
return existingInFlight;
|
|
4711
4571
|
case 4:
|
|
4712
|
-
return
|
|
4572
|
+
return _context41.abrupt("return", _context41.sent);
|
|
4713
4573
|
case 5:
|
|
4714
4574
|
context = this.getAvailabilityContextEntry(params.contextId);
|
|
4715
4575
|
expectedVersion = context.activeVersion;
|
|
4716
4576
|
expectedRefreshNonce = context.refreshNonce;
|
|
4717
4577
|
expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
4718
|
-
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4578
|
+
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
4719
4579
|
var snapshot, currentContext, projectionEntry;
|
|
4720
|
-
return _regeneratorRuntime().wrap(function
|
|
4721
|
-
while (1) switch (
|
|
4580
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4581
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
4722
4582
|
case 0:
|
|
4723
|
-
|
|
4724
|
-
return
|
|
4583
|
+
_context40.next = 2;
|
|
4584
|
+
return _this12.buildAvailabilityProjectionSnapshot(_this12.cloneAvailabilityPrepareParams(context.prepareParams), {
|
|
4725
4585
|
durationCandidateAnchorAt: context.durationCandidateAnchorAt
|
|
4726
4586
|
});
|
|
4727
4587
|
case 2:
|
|
4728
|
-
snapshot =
|
|
4729
|
-
currentContext =
|
|
4588
|
+
snapshot = _context40.sent;
|
|
4589
|
+
currentContext = _this12.availabilityContextRegistry.get(params.contextId);
|
|
4730
4590
|
if (currentContext) {
|
|
4731
|
-
|
|
4591
|
+
_context40.next = 6;
|
|
4732
4592
|
break;
|
|
4733
4593
|
}
|
|
4734
|
-
return
|
|
4594
|
+
return _context40.abrupt("return", null);
|
|
4735
4595
|
case 6:
|
|
4736
|
-
if (!(expectedLifecycleGeneration !==
|
|
4737
|
-
|
|
4596
|
+
if (!(expectedLifecycleGeneration !== _this12.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
|
|
4597
|
+
_context40.next = 8;
|
|
4738
4598
|
break;
|
|
4739
4599
|
}
|
|
4740
|
-
return
|
|
4600
|
+
return _context40.abrupt("return", null);
|
|
4741
4601
|
case 8:
|
|
4742
|
-
projectionEntry =
|
|
4602
|
+
projectionEntry = _this12.storeAvailabilityProjectionEntry({
|
|
4743
4603
|
contextId: currentContext.contextId,
|
|
4744
4604
|
prepareParams: snapshot.prepareParams,
|
|
4745
4605
|
prepareKey: currentContext.prepareKey,
|
|
@@ -4747,8 +4607,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4747
4607
|
orderRevision: snapshot.orderRevision,
|
|
4748
4608
|
incrementVersion: true
|
|
4749
4609
|
});
|
|
4750
|
-
|
|
4751
|
-
return
|
|
4610
|
+
_context40.next = 11;
|
|
4611
|
+
return _this12.emitAvailabilityDiagnostic({
|
|
4752
4612
|
action: 'refresh',
|
|
4753
4613
|
contextId: currentContext.contextId,
|
|
4754
4614
|
contextVersion: projectionEntry.contextVersion,
|
|
@@ -4759,33 +4619,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4759
4619
|
reason: params.reason
|
|
4760
4620
|
});
|
|
4761
4621
|
case 11:
|
|
4762
|
-
return
|
|
4622
|
+
return _context40.abrupt("return", projectionEntry);
|
|
4763
4623
|
case 12:
|
|
4764
4624
|
case "end":
|
|
4765
|
-
return
|
|
4625
|
+
return _context40.stop();
|
|
4766
4626
|
}
|
|
4767
|
-
},
|
|
4627
|
+
}, _callee40);
|
|
4768
4628
|
}))();
|
|
4769
4629
|
this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
|
|
4770
|
-
|
|
4771
|
-
|
|
4630
|
+
_context41.prev = 11;
|
|
4631
|
+
_context41.next = 14;
|
|
4772
4632
|
return refreshPromise;
|
|
4773
4633
|
case 14:
|
|
4774
|
-
return
|
|
4634
|
+
return _context41.abrupt("return", _context41.sent);
|
|
4775
4635
|
case 15:
|
|
4776
|
-
|
|
4636
|
+
_context41.prev = 15;
|
|
4777
4637
|
current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
4778
4638
|
if (current === refreshPromise) {
|
|
4779
4639
|
this.availabilityProjectionRefreshInFlight.delete(params.contextId);
|
|
4780
4640
|
}
|
|
4781
|
-
return
|
|
4641
|
+
return _context41.finish(15);
|
|
4782
4642
|
case 19:
|
|
4783
4643
|
case "end":
|
|
4784
|
-
return
|
|
4644
|
+
return _context41.stop();
|
|
4785
4645
|
}
|
|
4786
|
-
},
|
|
4646
|
+
}, _callee41, this, [[11,, 15, 19]]);
|
|
4787
4647
|
}));
|
|
4788
|
-
function refreshAvailabilityContextProjection(
|
|
4648
|
+
function refreshAvailabilityContextProjection(_x27) {
|
|
4789
4649
|
return _refreshAvailabilityContextProjection.apply(this, arguments);
|
|
4790
4650
|
}
|
|
4791
4651
|
return refreshAvailabilityContextProjection;
|
|
@@ -4793,53 +4653,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4793
4653
|
}, {
|
|
4794
4654
|
key: "ensureAvailabilityContextProjection",
|
|
4795
4655
|
value: function () {
|
|
4796
|
-
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4656
|
+
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(contextId, reason) {
|
|
4797
4657
|
var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
|
|
4798
|
-
return _regeneratorRuntime().wrap(function
|
|
4799
|
-
while (1) switch (
|
|
4658
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4659
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4800
4660
|
case 0:
|
|
4801
4661
|
retries = 0;
|
|
4802
4662
|
case 1:
|
|
4803
4663
|
if (!(retries < 3)) {
|
|
4804
|
-
|
|
4664
|
+
_context42.next = 19;
|
|
4805
4665
|
break;
|
|
4806
4666
|
}
|
|
4807
4667
|
context = this.getAvailabilityContextEntry(contextId);
|
|
4808
4668
|
currentOrderRevision = this.getCurrentOrderRevision();
|
|
4809
4669
|
projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
|
|
4810
4670
|
if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
|
|
4811
|
-
|
|
4671
|
+
_context42.next = 7;
|
|
4812
4672
|
break;
|
|
4813
4673
|
}
|
|
4814
|
-
return
|
|
4674
|
+
return _context42.abrupt("return", {
|
|
4815
4675
|
context: context,
|
|
4816
4676
|
projectionEntry: projectionEntry,
|
|
4817
4677
|
refreshed: false
|
|
4818
4678
|
});
|
|
4819
4679
|
case 7:
|
|
4820
|
-
|
|
4680
|
+
_context42.next = 9;
|
|
4821
4681
|
return this.refreshAvailabilityContextProjection({
|
|
4822
4682
|
contextId: contextId,
|
|
4823
4683
|
reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
|
|
4824
4684
|
previousOrderRevision: context.lastKnownOrderRevision
|
|
4825
4685
|
});
|
|
4826
4686
|
case 9:
|
|
4827
|
-
refreshedProjectionEntry =
|
|
4687
|
+
refreshedProjectionEntry = _context42.sent;
|
|
4828
4688
|
if (refreshedProjectionEntry) {
|
|
4829
|
-
|
|
4689
|
+
_context42.next = 13;
|
|
4830
4690
|
break;
|
|
4831
4691
|
}
|
|
4832
4692
|
retries += 1;
|
|
4833
|
-
return
|
|
4693
|
+
return _context42.abrupt("continue", 1);
|
|
4834
4694
|
case 13:
|
|
4835
4695
|
if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
4836
|
-
|
|
4696
|
+
_context42.next = 16;
|
|
4837
4697
|
break;
|
|
4838
4698
|
}
|
|
4839
4699
|
retries += 1;
|
|
4840
|
-
return
|
|
4700
|
+
return _context42.abrupt("continue", 1);
|
|
4841
4701
|
case 16:
|
|
4842
|
-
return
|
|
4702
|
+
return _context42.abrupt("return", {
|
|
4843
4703
|
context: this.getAvailabilityContextEntry(contextId),
|
|
4844
4704
|
projectionEntry: refreshedProjectionEntry,
|
|
4845
4705
|
refreshed: true
|
|
@@ -4851,11 +4711,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4851
4711
|
});
|
|
4852
4712
|
case 20:
|
|
4853
4713
|
case "end":
|
|
4854
|
-
return
|
|
4714
|
+
return _context42.stop();
|
|
4855
4715
|
}
|
|
4856
|
-
},
|
|
4716
|
+
}, _callee42, this);
|
|
4857
4717
|
}));
|
|
4858
|
-
function ensureAvailabilityContextProjection(
|
|
4718
|
+
function ensureAvailabilityContextProjection(_x28, _x29) {
|
|
4859
4719
|
return _ensureAvailabilityContextProjection.apply(this, arguments);
|
|
4860
4720
|
}
|
|
4861
4721
|
return ensureAvailabilityContextProjection;
|
|
@@ -4863,18 +4723,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4863
4723
|
}, {
|
|
4864
4724
|
key: "tryAcquireAvailabilityCommitLock",
|
|
4865
4725
|
value: function () {
|
|
4866
|
-
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4726
|
+
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(contextId) {
|
|
4867
4727
|
var _currentContext$activ;
|
|
4868
4728
|
var _waitingContext$activ, waitingContext, currentContext;
|
|
4869
|
-
return _regeneratorRuntime().wrap(function
|
|
4870
|
-
while (1) switch (
|
|
4729
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4730
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4871
4731
|
case 0:
|
|
4872
4732
|
if (!this.availabilityCommitLocks.has(contextId)) {
|
|
4873
|
-
|
|
4733
|
+
_context43.next = 5;
|
|
4874
4734
|
break;
|
|
4875
4735
|
}
|
|
4876
4736
|
waitingContext = this.availabilityContextRegistry.get(contextId);
|
|
4877
|
-
|
|
4737
|
+
_context43.next = 4;
|
|
4878
4738
|
return this.emitAvailabilityDiagnostic({
|
|
4879
4739
|
action: 'commit_lock_wait',
|
|
4880
4740
|
contextId: contextId,
|
|
@@ -4891,7 +4751,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4891
4751
|
case 5:
|
|
4892
4752
|
this.availabilityCommitLocks.add(contextId);
|
|
4893
4753
|
currentContext = this.availabilityContextRegistry.get(contextId);
|
|
4894
|
-
|
|
4754
|
+
_context43.next = 9;
|
|
4895
4755
|
return this.emitAvailabilityDiagnostic({
|
|
4896
4756
|
action: 'commit_lock_acquired',
|
|
4897
4757
|
contextId: contextId,
|
|
@@ -4903,11 +4763,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4903
4763
|
});
|
|
4904
4764
|
case 9:
|
|
4905
4765
|
case "end":
|
|
4906
|
-
return
|
|
4766
|
+
return _context43.stop();
|
|
4907
4767
|
}
|
|
4908
|
-
},
|
|
4768
|
+
}, _callee43, this);
|
|
4909
4769
|
}));
|
|
4910
|
-
function tryAcquireAvailabilityCommitLock(
|
|
4770
|
+
function tryAcquireAvailabilityCommitLock(_x30) {
|
|
4911
4771
|
return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
|
|
4912
4772
|
}
|
|
4913
4773
|
return tryAcquireAvailabilityCommitLock;
|
|
@@ -4915,15 +4775,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4915
4775
|
}, {
|
|
4916
4776
|
key: "releaseAvailabilityCommitLock",
|
|
4917
4777
|
value: function () {
|
|
4918
|
-
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4778
|
+
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(contextId) {
|
|
4919
4779
|
var _releasedContext$acti;
|
|
4920
4780
|
var releasedContext;
|
|
4921
|
-
return _regeneratorRuntime().wrap(function
|
|
4922
|
-
while (1) switch (
|
|
4781
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4782
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4923
4783
|
case 0:
|
|
4924
4784
|
this.availabilityCommitLocks.delete(contextId);
|
|
4925
4785
|
releasedContext = this.availabilityContextRegistry.get(contextId);
|
|
4926
|
-
|
|
4786
|
+
_context44.next = 4;
|
|
4927
4787
|
return this.emitAvailabilityDiagnostic({
|
|
4928
4788
|
action: 'commit_lock_released',
|
|
4929
4789
|
contextId: contextId,
|
|
@@ -4935,11 +4795,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4935
4795
|
});
|
|
4936
4796
|
case 4:
|
|
4937
4797
|
case "end":
|
|
4938
|
-
return
|
|
4798
|
+
return _context44.stop();
|
|
4939
4799
|
}
|
|
4940
|
-
},
|
|
4800
|
+
}, _callee44, this);
|
|
4941
4801
|
}));
|
|
4942
|
-
function releaseAvailabilityCommitLock(
|
|
4802
|
+
function releaseAvailabilityCommitLock(_x31) {
|
|
4943
4803
|
return _releaseAvailabilityCommitLock.apply(this, arguments);
|
|
4944
4804
|
}
|
|
4945
4805
|
return releaseAvailabilityCommitLock;
|
|
@@ -4947,20 +4807,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4947
4807
|
}, {
|
|
4948
4808
|
key: "prepareAvailabilityProjection",
|
|
4949
4809
|
value: (function () {
|
|
4950
|
-
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4810
|
+
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
4951
4811
|
var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
|
|
4952
|
-
return _regeneratorRuntime().wrap(function
|
|
4953
|
-
while (1) switch (
|
|
4812
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4813
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4954
4814
|
case 0:
|
|
4955
4815
|
this.assertAvailabilityPrepareParams(params);
|
|
4956
|
-
|
|
4816
|
+
_context45.next = 3;
|
|
4957
4817
|
return this.resolveAvailabilityPrepareDefaults(params);
|
|
4958
4818
|
case 3:
|
|
4959
|
-
paramsWithDefaults =
|
|
4960
|
-
|
|
4819
|
+
paramsWithDefaults = _context45.sent;
|
|
4820
|
+
_context45.next = 6;
|
|
4961
4821
|
return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
|
|
4962
4822
|
case 6:
|
|
4963
|
-
_yield$this$getShared =
|
|
4823
|
+
_yield$this$getShared = _context45.sent;
|
|
4964
4824
|
prepareKey = _yield$this$getShared.prepareKey;
|
|
4965
4825
|
snapshot = _yield$this$getShared.snapshot;
|
|
4966
4826
|
contextId = this.createAvailabilityContextId();
|
|
@@ -4981,7 +4841,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4981
4841
|
refreshed: false,
|
|
4982
4842
|
reason: 'prepare'
|
|
4983
4843
|
};
|
|
4984
|
-
|
|
4844
|
+
_context45.next = 16;
|
|
4985
4845
|
return this.emitAvailabilityDiagnostic({
|
|
4986
4846
|
action: 'prepare',
|
|
4987
4847
|
contextId: contextId,
|
|
@@ -4992,17 +4852,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4992
4852
|
reason: 'prepare'
|
|
4993
4853
|
});
|
|
4994
4854
|
case 16:
|
|
4995
|
-
|
|
4855
|
+
_context45.next = 18;
|
|
4996
4856
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
|
|
4997
4857
|
case 18:
|
|
4998
|
-
return
|
|
4858
|
+
return _context45.abrupt("return", handle);
|
|
4999
4859
|
case 19:
|
|
5000
4860
|
case "end":
|
|
5001
|
-
return
|
|
4861
|
+
return _context45.stop();
|
|
5002
4862
|
}
|
|
5003
|
-
},
|
|
4863
|
+
}, _callee45, this);
|
|
5004
4864
|
}));
|
|
5005
|
-
function prepareAvailabilityProjection(
|
|
4865
|
+
function prepareAvailabilityProjection(_x32) {
|
|
5006
4866
|
return _prepareAvailabilityProjection.apply(this, arguments);
|
|
5007
4867
|
}
|
|
5008
4868
|
return prepareAvailabilityProjection;
|
|
@@ -5010,10 +4870,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5010
4870
|
}, {
|
|
5011
4871
|
key: "getProductTimeRanges",
|
|
5012
4872
|
value: (function () {
|
|
5013
|
-
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4873
|
+
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(contextId) {
|
|
5014
4874
|
var _this$otherParams$pla,
|
|
5015
|
-
_this$
|
|
5016
|
-
|
|
4875
|
+
_this$otherParams27,
|
|
4876
|
+
_this13 = this;
|
|
5017
4877
|
var request,
|
|
5018
4878
|
_yield$this$ensureAva,
|
|
5019
4879
|
context,
|
|
@@ -5021,23 +4881,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5021
4881
|
contextVersion,
|
|
5022
4882
|
isPosAvailabilityRequest,
|
|
5023
4883
|
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
5024
|
-
|
|
5025
|
-
return _regeneratorRuntime().wrap(function
|
|
5026
|
-
while (1) switch (
|
|
4884
|
+
_args46 = arguments;
|
|
4885
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4886
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
5027
4887
|
case 0:
|
|
5028
|
-
request =
|
|
5029
|
-
|
|
4888
|
+
request = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {};
|
|
4889
|
+
_context46.next = 3;
|
|
5030
4890
|
return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
|
|
5031
4891
|
case 3:
|
|
5032
|
-
_yield$this$ensureAva =
|
|
4892
|
+
_yield$this$ensureAva = _context46.sent;
|
|
5033
4893
|
context = _yield$this$ensureAva.context;
|
|
5034
4894
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
5035
4895
|
contextVersion = context.activeVersion;
|
|
5036
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$
|
|
4896
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase() === 'pos';
|
|
5037
4897
|
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
5038
4898
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
5039
4899
|
});
|
|
5040
|
-
return
|
|
4900
|
+
return _context46.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
|
|
5041
4901
|
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
5042
4902
|
} : {}), {
|
|
5043
4903
|
evaluatedAt: this.getAvailabilityRuntimeDateTime(),
|
|
@@ -5047,17 +4907,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5047
4907
|
}).map(function (group) {
|
|
5048
4908
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
5049
4909
|
ranges: group.ranges.map(function (candidate) {
|
|
5050
|
-
return
|
|
4910
|
+
return _this13.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
|
|
5051
4911
|
})
|
|
5052
4912
|
});
|
|
5053
4913
|
}));
|
|
5054
4914
|
case 10:
|
|
5055
4915
|
case "end":
|
|
5056
|
-
return
|
|
4916
|
+
return _context46.stop();
|
|
5057
4917
|
}
|
|
5058
|
-
},
|
|
4918
|
+
}, _callee46, this);
|
|
5059
4919
|
}));
|
|
5060
|
-
function getProductTimeRanges(
|
|
4920
|
+
function getProductTimeRanges(_x33) {
|
|
5061
4921
|
return _getProductTimeRanges.apply(this, arguments);
|
|
5062
4922
|
}
|
|
5063
4923
|
return getProductTimeRanges;
|
|
@@ -5065,21 +4925,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5065
4925
|
}, {
|
|
5066
4926
|
key: "queryBookingAvailability",
|
|
5067
4927
|
value: (function () {
|
|
5068
|
-
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5069
|
-
var _this$otherParams$pla2, _this$
|
|
4928
|
+
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(contextId, request) {
|
|
4929
|
+
var _this$otherParams$pla2, _this$otherParams28;
|
|
5070
4930
|
var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, result, contextVersion, contextualResult;
|
|
5071
|
-
return _regeneratorRuntime().wrap(function
|
|
5072
|
-
while (1) switch (
|
|
4931
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4932
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
5073
4933
|
case 0:
|
|
5074
|
-
|
|
4934
|
+
_context47.next = 2;
|
|
5075
4935
|
return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
|
|
5076
4936
|
case 2:
|
|
5077
|
-
_yield$this$ensureAva2 =
|
|
4937
|
+
_yield$this$ensureAva2 = _context47.sent;
|
|
5078
4938
|
context = _yield$this$ensureAva2.context;
|
|
5079
4939
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
5080
4940
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
5081
4941
|
this.assertContextualQueryFreshness(context, request);
|
|
5082
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$
|
|
4942
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
5083
4943
|
result = queryAvailabilityProjection(projectionEntry.projection, request, {
|
|
5084
4944
|
useExactDurationCandidateMinute: isPosAvailabilityRequest,
|
|
5085
4945
|
allowExcludedScheduleDateOverride: isPosAvailabilityRequest
|
|
@@ -5110,18 +4970,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5110
4970
|
});
|
|
5111
4971
|
})
|
|
5112
4972
|
}) : result;
|
|
5113
|
-
return
|
|
4973
|
+
return _context47.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
|
|
5114
4974
|
contextId: context.contextId,
|
|
5115
4975
|
contextVersion: contextVersion,
|
|
5116
4976
|
refreshed: refreshed
|
|
5117
4977
|
}));
|
|
5118
4978
|
case 12:
|
|
5119
4979
|
case "end":
|
|
5120
|
-
return
|
|
4980
|
+
return _context47.stop();
|
|
5121
4981
|
}
|
|
5122
|
-
},
|
|
4982
|
+
}, _callee47, this);
|
|
5123
4983
|
}));
|
|
5124
|
-
function queryBookingAvailability(
|
|
4984
|
+
function queryBookingAvailability(_x34, _x35) {
|
|
5125
4985
|
return _queryBookingAvailability.apply(this, arguments);
|
|
5126
4986
|
}
|
|
5127
4987
|
return queryBookingAvailability;
|
|
@@ -5191,27 +5051,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5191
5051
|
}, {
|
|
5192
5052
|
key: "commitAvailabilitySelection",
|
|
5193
5053
|
value: (function () {
|
|
5194
|
-
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5195
|
-
var normalizedContextId, _params$bookingCount, _ref53, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla3, _this$
|
|
5196
|
-
return _regeneratorRuntime().wrap(function
|
|
5197
|
-
while (1) switch (
|
|
5054
|
+
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId, params) {
|
|
5055
|
+
var normalizedContextId, _params$bookingCount, _ref53, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla3, _this$otherParams29, _ref54, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref55, _ref56, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref57, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _params$salesNotes, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
|
|
5056
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5057
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
5198
5058
|
case 0:
|
|
5199
5059
|
normalizedContextId = String(contextId || '').trim();
|
|
5200
5060
|
if (normalizedContextId) {
|
|
5201
|
-
|
|
5061
|
+
_context48.next = 3;
|
|
5202
5062
|
break;
|
|
5203
5063
|
}
|
|
5204
5064
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
|
|
5205
5065
|
candidate: params.candidate
|
|
5206
5066
|
});
|
|
5207
5067
|
case 3:
|
|
5208
|
-
|
|
5068
|
+
_context48.next = 5;
|
|
5209
5069
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
5210
5070
|
case 5:
|
|
5211
|
-
|
|
5071
|
+
_context48.prev = 5;
|
|
5212
5072
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
5213
5073
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
5214
|
-
|
|
5074
|
+
_context48.next = 9;
|
|
5215
5075
|
break;
|
|
5216
5076
|
}
|
|
5217
5077
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
@@ -5219,7 +5079,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5219
5079
|
});
|
|
5220
5080
|
case 9:
|
|
5221
5081
|
if (!(params.mode === 'edit' && bookingCount !== 1)) {
|
|
5222
|
-
|
|
5082
|
+
_context48.next = 11;
|
|
5223
5083
|
break;
|
|
5224
5084
|
}
|
|
5225
5085
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
@@ -5228,7 +5088,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5228
5088
|
case 11:
|
|
5229
5089
|
orderProductQuantity = (_ref53 = (_params$orderProduct$ = (_params$orderProduct = params.orderProduct) === null || _params$orderProduct === void 0 ? void 0 : _params$orderProduct.num) !== null && _params$orderProduct$ !== void 0 ? _params$orderProduct$ : (_params$orderProduct2 = params.orderProduct) === null || _params$orderProduct2 === void 0 ? void 0 : _params$orderProduct2.quantity) !== null && _ref53 !== void 0 ? _ref53 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
|
|
5230
5090
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
5231
|
-
|
|
5091
|
+
_context48.next = 14;
|
|
5232
5092
|
break;
|
|
5233
5093
|
}
|
|
5234
5094
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
@@ -5238,22 +5098,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5238
5098
|
case 14:
|
|
5239
5099
|
partySize = Number(params.partySize);
|
|
5240
5100
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
5241
|
-
|
|
5101
|
+
_context48.next = 17;
|
|
5242
5102
|
break;
|
|
5243
5103
|
}
|
|
5244
5104
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
5245
5105
|
partySize: params.partySize
|
|
5246
5106
|
});
|
|
5247
5107
|
case 17:
|
|
5248
|
-
|
|
5108
|
+
_context48.next = 19;
|
|
5249
5109
|
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
5250
5110
|
case 19:
|
|
5251
|
-
_yield$this$ensureAva3 =
|
|
5111
|
+
_yield$this$ensureAva3 = _context48.sent;
|
|
5252
5112
|
context = _yield$this$ensureAva3.context;
|
|
5253
5113
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
5254
5114
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
5255
5115
|
if (!refreshed) {
|
|
5256
|
-
|
|
5116
|
+
_context48.next = 25;
|
|
5257
5117
|
break;
|
|
5258
5118
|
}
|
|
5259
5119
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5264,11 +5124,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5264
5124
|
case 25:
|
|
5265
5125
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
5266
5126
|
if (!(params.mode === 'edit')) {
|
|
5267
|
-
|
|
5127
|
+
_context48.next = 31;
|
|
5268
5128
|
break;
|
|
5269
5129
|
}
|
|
5270
5130
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
5271
|
-
|
|
5131
|
+
_context48.next = 29;
|
|
5272
5132
|
break;
|
|
5273
5133
|
}
|
|
5274
5134
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -5277,11 +5137,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5277
5137
|
editingProductLineUids: boundEditingUids
|
|
5278
5138
|
});
|
|
5279
5139
|
case 29:
|
|
5280
|
-
|
|
5140
|
+
_context48.next = 33;
|
|
5281
5141
|
break;
|
|
5282
5142
|
case 31:
|
|
5283
5143
|
if (!(boundEditingUids.length > 0)) {
|
|
5284
|
-
|
|
5144
|
+
_context48.next = 33;
|
|
5285
5145
|
break;
|
|
5286
5146
|
}
|
|
5287
5147
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
@@ -5290,7 +5150,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5290
5150
|
});
|
|
5291
5151
|
case 33:
|
|
5292
5152
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
5293
|
-
|
|
5153
|
+
_context48.next = 35;
|
|
5294
5154
|
break;
|
|
5295
5155
|
}
|
|
5296
5156
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -5300,7 +5160,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5300
5160
|
});
|
|
5301
5161
|
case 35:
|
|
5302
5162
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
5303
|
-
|
|
5163
|
+
_context48.next = 37;
|
|
5304
5164
|
break;
|
|
5305
5165
|
}
|
|
5306
5166
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -5311,7 +5171,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5311
5171
|
});
|
|
5312
5172
|
case 37:
|
|
5313
5173
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
5314
|
-
|
|
5174
|
+
_context48.next = 39;
|
|
5315
5175
|
break;
|
|
5316
5176
|
}
|
|
5317
5177
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -5323,7 +5183,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5323
5183
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
5324
5184
|
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;
|
|
5325
5185
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
5326
|
-
|
|
5186
|
+
_context48.next = 43;
|
|
5327
5187
|
break;
|
|
5328
5188
|
}
|
|
5329
5189
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
@@ -5332,14 +5192,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5332
5192
|
});
|
|
5333
5193
|
case 43:
|
|
5334
5194
|
if (!(params.mode === 'edit' && !params.productLineUid)) {
|
|
5335
|
-
|
|
5195
|
+
_context48.next = 45;
|
|
5336
5196
|
break;
|
|
5337
5197
|
}
|
|
5338
5198
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
5339
5199
|
case 45:
|
|
5340
5200
|
editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
5341
5201
|
if (!(params.mode === 'edit' && !editingLine)) {
|
|
5342
|
-
|
|
5202
|
+
_context48.next = 48;
|
|
5343
5203
|
break;
|
|
5344
5204
|
}
|
|
5345
5205
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
@@ -5347,7 +5207,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5347
5207
|
});
|
|
5348
5208
|
case 48:
|
|
5349
5209
|
if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
5350
|
-
|
|
5210
|
+
_context48.next = 50;
|
|
5351
5211
|
break;
|
|
5352
5212
|
}
|
|
5353
5213
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -5357,7 +5217,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5357
5217
|
});
|
|
5358
5218
|
case 50:
|
|
5359
5219
|
if (Array.isArray(params.requirementSelections)) {
|
|
5360
|
-
|
|
5220
|
+
_context48.next = 52;
|
|
5361
5221
|
break;
|
|
5362
5222
|
}
|
|
5363
5223
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
@@ -5374,7 +5234,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5374
5234
|
};
|
|
5375
5235
|
prepareParams = baseProjection.meta.prepareParams;
|
|
5376
5236
|
if (prepareParams) {
|
|
5377
|
-
|
|
5237
|
+
_context48.next = 57;
|
|
5378
5238
|
break;
|
|
5379
5239
|
}
|
|
5380
5240
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
@@ -5386,7 +5246,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5386
5246
|
})),
|
|
5387
5247
|
includesInjectedRawOccupancies: true
|
|
5388
5248
|
};
|
|
5389
|
-
|
|
5249
|
+
_context48.next = 60;
|
|
5390
5250
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
5391
5251
|
editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
|
|
5392
5252
|
}), {
|
|
@@ -5395,13 +5255,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5395
5255
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
5396
5256
|
});
|
|
5397
5257
|
case 60:
|
|
5398
|
-
commitSnapshot =
|
|
5258
|
+
commitSnapshot = _context48.sent;
|
|
5399
5259
|
refreshedProjection = commitSnapshot.projection;
|
|
5400
5260
|
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 : ''))) {
|
|
5401
|
-
|
|
5261
|
+
_context48.next = 67;
|
|
5402
5262
|
break;
|
|
5403
5263
|
}
|
|
5404
|
-
|
|
5264
|
+
_context48.next = 65;
|
|
5405
5265
|
return this.refreshAvailabilityContextProjection({
|
|
5406
5266
|
contextId: normalizedContextId,
|
|
5407
5267
|
reason: 'commit_order_revision_changed',
|
|
@@ -5422,7 +5282,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5422
5282
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
5423
5283
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
5424
5284
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
5425
|
-
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$
|
|
5285
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
|
|
5426
5286
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
5427
5287
|
productIds: [params.candidate.productId],
|
|
5428
5288
|
dateRange: {
|
|
@@ -5446,7 +5306,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5446
5306
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
5447
5307
|
});
|
|
5448
5308
|
if (refreshedCandidateBase) {
|
|
5449
|
-
|
|
5309
|
+
_context48.next = 75;
|
|
5450
5310
|
break;
|
|
5451
5311
|
}
|
|
5452
5312
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -5459,7 +5319,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5459
5319
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
5460
5320
|
});
|
|
5461
5321
|
if (product) {
|
|
5462
|
-
|
|
5322
|
+
_context48.next = 78;
|
|
5463
5323
|
break;
|
|
5464
5324
|
}
|
|
5465
5325
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
@@ -5496,7 +5356,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5496
5356
|
});
|
|
5497
5357
|
}
|
|
5498
5358
|
if (validation.ok) {
|
|
5499
|
-
|
|
5359
|
+
_context48.next = 83;
|
|
5500
5360
|
break;
|
|
5501
5361
|
}
|
|
5502
5362
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -5519,7 +5379,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5519
5379
|
incrementVersion: true
|
|
5520
5380
|
});
|
|
5521
5381
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
5522
|
-
|
|
5382
|
+
_context48.next = 87;
|
|
5523
5383
|
return this.emitAvailabilityDiagnostic({
|
|
5524
5384
|
action: 'refresh',
|
|
5525
5385
|
contextId: normalizedContextId,
|
|
@@ -5542,7 +5402,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5542
5402
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
5543
5403
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
5544
5404
|
if (!(params.mode === 'edit' && !existingBookingUid)) {
|
|
5545
|
-
|
|
5405
|
+
_context48.next = 93;
|
|
5546
5406
|
break;
|
|
5547
5407
|
}
|
|
5548
5408
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
@@ -5564,7 +5424,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5564
5424
|
quantity: bookingCount
|
|
5565
5425
|
}), 'unified_booking_sales', product);
|
|
5566
5426
|
if (transformed) {
|
|
5567
|
-
|
|
5427
|
+
_context48.next = 98;
|
|
5568
5428
|
break;
|
|
5569
5429
|
}
|
|
5570
5430
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
@@ -5583,7 +5443,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5583
5443
|
productLineUids = [];
|
|
5584
5444
|
bookingUids = [];
|
|
5585
5445
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
5586
|
-
|
|
5446
|
+
_context48.next = 117;
|
|
5587
5447
|
break;
|
|
5588
5448
|
}
|
|
5589
5449
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -5593,7 +5453,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5593
5453
|
unique_identification_number: params.productLineUid,
|
|
5594
5454
|
booking_uid: existingBookingUid
|
|
5595
5455
|
});
|
|
5596
|
-
|
|
5456
|
+
_context48.next = 111;
|
|
5597
5457
|
return this.updateOrderProduct(_objectSpread(_objectSpread({
|
|
5598
5458
|
product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
|
|
5599
5459
|
product_variant_id: (_ref57 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref57 !== void 0 ? _ref57 : 0,
|
|
@@ -5610,7 +5470,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5610
5470
|
bookingUid = existingBookingUid;
|
|
5611
5471
|
productLineUids = [productLineUid];
|
|
5612
5472
|
bookingUids = [bookingUid];
|
|
5613
|
-
|
|
5473
|
+
_context48.next = 129;
|
|
5614
5474
|
break;
|
|
5615
5475
|
case 117:
|
|
5616
5476
|
beforeProductLineUids = new Set((((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || []).map(function (line) {
|
|
@@ -5619,12 +5479,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5619
5479
|
beforeBookingUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.bookings) || []).map(function (item) {
|
|
5620
5480
|
return getBookingUid(item);
|
|
5621
5481
|
}).filter(Boolean));
|
|
5622
|
-
|
|
5482
|
+
_context48.next = 121;
|
|
5623
5483
|
return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length ? {
|
|
5624
5484
|
salesNotes: params.salesNotes
|
|
5625
5485
|
} : undefined);
|
|
5626
5486
|
case 121:
|
|
5627
|
-
products =
|
|
5487
|
+
products = _context48.sent;
|
|
5628
5488
|
addedLines = products.filter(function (line) {
|
|
5629
5489
|
var _line$product_id, _line$metadata;
|
|
5630
5490
|
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));
|
|
@@ -5661,23 +5521,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5661
5521
|
productLineUids: productLineUids,
|
|
5662
5522
|
bookingUids: bookingUids
|
|
5663
5523
|
};
|
|
5664
|
-
|
|
5524
|
+
_context48.next = 134;
|
|
5665
5525
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
5666
5526
|
case 134:
|
|
5667
|
-
return
|
|
5527
|
+
return _context48.abrupt("return", result);
|
|
5668
5528
|
case 135:
|
|
5669
|
-
|
|
5670
|
-
|
|
5529
|
+
_context48.prev = 135;
|
|
5530
|
+
_context48.next = 138;
|
|
5671
5531
|
return this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
5672
5532
|
case 138:
|
|
5673
|
-
return
|
|
5533
|
+
return _context48.finish(135);
|
|
5674
5534
|
case 139:
|
|
5675
5535
|
case "end":
|
|
5676
|
-
return
|
|
5536
|
+
return _context48.stop();
|
|
5677
5537
|
}
|
|
5678
|
-
},
|
|
5538
|
+
}, _callee48, this, [[5,, 135, 139]]);
|
|
5679
5539
|
}));
|
|
5680
|
-
function commitAvailabilitySelection(
|
|
5540
|
+
function commitAvailabilitySelection(_x36, _x37) {
|
|
5681
5541
|
return _commitAvailabilitySelection.apply(this, arguments);
|
|
5682
5542
|
}
|
|
5683
5543
|
return commitAvailabilitySelection;
|