@pisell/pisellos 0.10.76 → 0.10.78
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/apis/picoding.d.ts +0 -0
- package/dist/effects/index.d.ts +19 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +105 -0
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +173 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +70 -0
- package/dist/model/strategy/adapter/promotion/examples.d.ts +224 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/promotion/type.d.ts +535 -0
- package/dist/model/strategy/adapter/type.d.ts +28 -0
- package/dist/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/dist/model/strategy/adapter/walletPass/type.d.ts +192 -0
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/dist/model/strategy/engine.d.ts +119 -0
- package/dist/model/strategy/type.d.ts +245 -0
- package/dist/modules/Account/types.d.ts +56 -0
- package/dist/modules/BookingContext/types.d.ts +104 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/Customer/constants.d.ts +7 -0
- package/dist/modules/Date/types.d.ts +84 -0
- package/dist/modules/Date/utils.d.ts +36 -0
- package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
- package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/pickupTiming.d.ts +46 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +68 -0
- package/dist/modules/Order/utils/weighedProduct.d.ts +12 -0
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +21 -0
- package/dist/modules/Payment/mx51.d.ts +0 -0
- package/dist/modules/Payment/types.d.ts +943 -0
- package/dist/modules/Payment/utils.d.ts +19 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.d.ts +2 -0
- package/dist/modules/ProductList/index.js +125 -39
- package/dist/modules/Quotation/types.d.ts +61 -0
- package/dist/modules/Resource/types.d.ts +50 -0
- package/dist/modules/Resource/utils.d.ts +23 -0
- package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/dist/modules/ResourcePlanner/planner.js +5 -0
- package/dist/modules/SalesSummary/types.d.ts +69 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +53 -0
- package/dist/modules/Schedule/getDateIsInSchedule.d.ts +32 -0
- package/dist/modules/Schedule/type.d.ts +157 -0
- package/dist/modules/Schedule/types.d.ts +201 -0
- package/dist/modules/Schedule/utils.d.ts +67 -0
- package/dist/modules/Step/tyeps.d.ts +20 -0
- package/dist/modules/SurchargeList/types.d.ts +15 -0
- package/dist/plugins/app.d.ts +10 -0
- package/dist/plugins/shopStore.d.ts +4 -0
- package/dist/plugins/user.d.ts +7 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/menu/types.d.ts +68 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/quotation/types.d.ts +50 -0
- package/dist/server/modules/resource/types.d.ts +121 -0
- package/dist/server/modules/schedule/types.d.ts +1 -0
- package/dist/server/modules/schedule/utils.d.ts +32 -0
- package/dist/server/types.d.ts +66 -0
- package/dist/server/utils/index.d.ts +5 -0
- package/dist/server/utils/schedule.d.ts +14 -0
- package/dist/server/utils/time.d.ts +18 -0
- package/dist/solution/BaseSales/index.d.ts +12 -1
- package/dist/solution/BaseSales/index.js +275 -185
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -13
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +38 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/PlaceOrder/index.d.ts +0 -0
- package/dist/solution/RegisterAndLogin/config.d.ts +93 -0
- package/dist/solution/RegisterAndLogin/types.d.ts +445 -0
- package/dist/solution/RegisterAndLogin/utils.d.ts +103 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +23 -1
- package/dist/solution/UnifiedBookingSales/index.js +1367 -646
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +25 -0
- package/dist/solution/UnifiedBookingSales/types.js +2 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +277 -0
- package/dist/store/createStore.d.ts +3 -0
- package/dist/types/index.d.ts +132 -0
- package/dist/utils/os-private-payload.d.ts +5 -0
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/task.d.ts +40 -0
- package/dist/utils/watch.d.ts +102 -0
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/effects/index.d.ts +19 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +105 -0
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +173 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +70 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +224 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +535 -0
- package/lib/model/strategy/adapter/type.d.ts +28 -0
- package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/lib/model/strategy/adapter/walletPass/type.d.ts +192 -0
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/lib/model/strategy/engine.d.ts +119 -0
- package/lib/model/strategy/type.d.ts +245 -0
- package/lib/modules/Account/types.d.ts +56 -0
- package/lib/modules/BookingContext/types.d.ts +104 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/Customer/constants.d.ts +7 -0
- package/lib/modules/Date/types.d.ts +84 -0
- package/lib/modules/Date/utils.d.ts +36 -0
- package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
- package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/pickupTiming.d.ts +46 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +68 -0
- package/lib/modules/Order/utils/weighedProduct.d.ts +12 -0
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +21 -0
- package/lib/modules/Payment/mx51.d.ts +0 -0
- package/lib/modules/Payment/types.d.ts +943 -0
- package/lib/modules/Payment/utils.d.ts +19 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.d.ts +2 -0
- package/lib/modules/ProductList/index.js +56 -0
- package/lib/modules/Quotation/types.d.ts +61 -0
- package/lib/modules/Resource/types.d.ts +50 -0
- package/lib/modules/Resource/utils.d.ts +23 -0
- package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/lib/modules/ResourcePlanner/planner.js +4 -0
- package/lib/modules/SalesSummary/types.d.ts +69 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +53 -0
- package/lib/modules/Schedule/getDateIsInSchedule.d.ts +32 -0
- package/lib/modules/Schedule/type.d.ts +157 -0
- package/lib/modules/Schedule/types.d.ts +201 -0
- package/lib/modules/Schedule/utils.d.ts +67 -0
- package/lib/modules/Step/tyeps.d.ts +20 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/plugins/app.d.ts +10 -0
- package/lib/plugins/shopStore.d.ts +4 -0
- package/lib/plugins/user.d.ts +7 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/menu/types.d.ts +68 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/quotation/types.d.ts +50 -0
- package/lib/server/modules/resource/types.d.ts +121 -0
- package/lib/server/modules/schedule/types.d.ts +1 -0
- package/lib/server/modules/schedule/utils.d.ts +32 -0
- package/lib/server/types.d.ts +66 -0
- package/lib/server/utils/index.d.ts +5 -0
- package/lib/server/utils/schedule.d.ts +14 -0
- package/lib/server/utils/time.d.ts +18 -0
- package/lib/solution/BaseSales/index.d.ts +12 -1
- package/lib/solution/BaseSales/index.js +65 -0
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -13
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +38 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/PlaceOrder/index.d.ts +0 -0
- package/lib/solution/RegisterAndLogin/config.d.ts +93 -0
- package/lib/solution/RegisterAndLogin/types.d.ts +445 -0
- package/lib/solution/RegisterAndLogin/utils.d.ts +103 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +23 -1
- package/lib/solution/UnifiedBookingSales/index.js +399 -14
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +25 -0
- package/lib/solution/UnifiedBookingSales/types.js +1 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +151 -0
- package/lib/store/createStore.d.ts +3 -0
- package/lib/types/index.d.ts +132 -0
- package/lib/utils/os-private-payload.d.ts +5 -0
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/task.d.ts +40 -0
- package/lib/utils/watch.d.ts +102 -0
- package/package.json +1 -1
|
@@ -38,19 +38,21 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
38
38
|
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; }
|
|
39
39
|
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); }
|
|
40
40
|
import dayjs from 'dayjs';
|
|
41
|
-
import { cloneDeep } from 'lodash-es';
|
|
41
|
+
import { cloneDeep, isEqual } from 'lodash-es';
|
|
42
42
|
import { OpenDataModule } from "../../modules";
|
|
43
43
|
import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
|
|
44
44
|
import { isProductFlexibleDuration, isSessionProduct, isBookingProduct, isMultiDayProduct } from "../../modules/BookingContext/utils";
|
|
45
45
|
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeSalesSettings } from "../../modules/OpenData";
|
|
46
46
|
import { getBookingBoundary, getBookingHolderIds, normalizeBookingDateTime, resolveDefaultBookingStart } from "./salesSettings";
|
|
47
47
|
import { getScheduleStartEndTimePoints } from "../../modules/Schedule/getDateIsInSchedule";
|
|
48
|
-
import { PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants } from "../../modules/ProductList/clientDataVariants";
|
|
48
|
+
import { PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants, tryResolveClientDataVariants } from "../../modules/ProductList/clientDataVariants";
|
|
49
49
|
import { AvailabilityError, createAvailabilityProjection, getProductTimeRanges as getProjectionProductTimeRanges, queryAvailabilityProjection, validateAvailabilitySelection } from "../../modules/ResourcePlanner";
|
|
50
50
|
import { UnifiedBookingSalesHooks } from "./types";
|
|
51
51
|
import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
|
|
52
|
+
import { AvailabilitySessionResourceCache } from "./sessionResourceCache";
|
|
52
53
|
import { BusinessAvailabilityController } from "./businessAvailability";
|
|
53
54
|
import { createCatalogQueryBatchAdapter } from "./catalogQueryBatch";
|
|
55
|
+
import { activeVenueMenus, createVenueCatalogSessionAdapter, productMatchesVenueMenu, readVenueCatalogList, validateVenueMenus, venueCatalogError } from "./venueCatalogSession";
|
|
54
56
|
import { BookingTicket } from "../BookingTicket";
|
|
55
57
|
import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
|
|
56
58
|
import { isCustomerUserPlatform, isSelfServicePlatform, normalizeRuntimePlatform } from "../../utils/platform";
|
|
@@ -245,6 +247,7 @@ var MAX_AVAILABILITY_RANGE_DAYS = 90;
|
|
|
245
247
|
var MAX_AVAILABILITY_CONTEXT_REGISTRY = 128;
|
|
246
248
|
var MAX_AVAILABILITY_PROJECTION_POOL = 16;
|
|
247
249
|
var MAX_REMOTE_OCCUPANCY_RESOURCE_DATE_CELLS = 4096;
|
|
250
|
+
var PREVIEW_OCCUPANCY_CACHE_MAX_AGE_MS = 30 * 1000;
|
|
248
251
|
function isValidClockTime(value) {
|
|
249
252
|
var match = /^(\d{2}):(\d{2})$/.exec(value);
|
|
250
253
|
if (!match) return false;
|
|
@@ -1337,6 +1340,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1337
1340
|
_defineProperty(_assertThisInitialized(_this), "runtimeInitializationGeneration", 0);
|
|
1338
1341
|
_defineProperty(_assertThisInitialized(_this), "runtimeOpenDataDestroyed", false);
|
|
1339
1342
|
_defineProperty(_assertThisInitialized(_this), "unifiedProductCatalog", []);
|
|
1343
|
+
_defineProperty(_assertThisInitialized(_this), "venueCatalogSessions", new Set());
|
|
1344
|
+
_defineProperty(_assertThisInitialized(_this), "venueCatalogSessionKey", void 0);
|
|
1345
|
+
_defineProperty(_assertThisInitialized(_this), "venueCatalogMenus", void 0);
|
|
1346
|
+
_defineProperty(_assertThisInitialized(_this), "venueVariantDetails", new Map());
|
|
1340
1347
|
_defineProperty(_assertThisInitialized(_this), "availabilityRuntimeOffsetMinutes", null);
|
|
1341
1348
|
_defineProperty(_assertThisInitialized(_this), "availabilityScheduleCatalog", null);
|
|
1342
1349
|
_defineProperty(_assertThisInitialized(_this), "availabilityProjectionSequence", 0);
|
|
@@ -1347,6 +1354,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1347
1354
|
_defineProperty(_assertThisInitialized(_this), "availabilityPrepareInFlight", new Map());
|
|
1348
1355
|
_defineProperty(_assertThisInitialized(_this), "availabilityProjectionRefreshInFlight", new Map());
|
|
1349
1356
|
_defineProperty(_assertThisInitialized(_this), "availabilityRemoteOccupancyCache", new AvailabilityRemoteOccupancyCache(MAX_REMOTE_OCCUPANCY_RESOURCE_DATE_CELLS));
|
|
1357
|
+
_defineProperty(_assertThisInitialized(_this), "availabilitySessionResourceCache", new AvailabilitySessionResourceCache());
|
|
1350
1358
|
_defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceQueryInFlight", new Map());
|
|
1351
1359
|
_defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceQuerySequence", 0);
|
|
1352
1360
|
_defineProperty(_assertThisInitialized(_this), "availabilityRemoteResourceEpoch", 0);
|
|
@@ -1659,6 +1667,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1659
1667
|
value: function clearAvailabilityRemoteResourceState() {
|
|
1660
1668
|
this.availabilityRemoteResourceEpoch += 1;
|
|
1661
1669
|
this.availabilityRemoteOccupancyCache.clear();
|
|
1670
|
+
this.availabilitySessionResourceCache.clear();
|
|
1662
1671
|
this.availabilityRemoteResourceQueryInFlight.clear();
|
|
1663
1672
|
this.availabilityRemoteResourceQuerySequence = 0;
|
|
1664
1673
|
}
|
|
@@ -3258,62 +3267,672 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3258
3267
|
return _queryCatalogProductDetail.apply(this, arguments);
|
|
3259
3268
|
}
|
|
3260
3269
|
return queryCatalogProductDetail;
|
|
3270
|
+
}())
|
|
3271
|
+
}, {
|
|
3272
|
+
key: "isVenueCatalogLocalPricingActive",
|
|
3273
|
+
value: function isVenueCatalogLocalPricingActive() {
|
|
3274
|
+
return this.venueCatalogSessions.size > 0;
|
|
3275
|
+
}
|
|
3276
|
+
}, {
|
|
3277
|
+
key: "getVenueCatalogLocalPriceSource",
|
|
3278
|
+
value: function getVenueCatalogLocalPriceSource(productId, selectedProduct) {
|
|
3279
|
+
var _selectedProduct$meta,
|
|
3280
|
+
_this11 = this;
|
|
3281
|
+
var scope = this.getRuntimeOpenDataScope();
|
|
3282
|
+
var role = selectedProduct === null || selectedProduct === void 0 || (_selectedProduct$meta = selectedProduct.metadata) === null || _selectedProduct$meta === void 0 ? void 0 : _selectedProduct$meta.venue_booking_role;
|
|
3283
|
+
var poolRole = role === 'party_extra' || role === 'tickets_extra' ? 'extras' : role === 'party_main' || role === 'tickets' ? 'main' : undefined;
|
|
3284
|
+
var matches = Array.from(this.venueCatalogSessions).filter(function (entry) {
|
|
3285
|
+
var _entry$pool;
|
|
3286
|
+
return entry.scope === scope && entry.generation === _this11.runtimeInitializationGeneration && (!poolRole || entry.role === poolRole) && ((_entry$pool = entry.pool) === null || _entry$pool === void 0 ? void 0 : _entry$pool.products.some(function (row) {
|
|
3287
|
+
return Number(row.id) === productId;
|
|
3288
|
+
}));
|
|
3289
|
+
});
|
|
3290
|
+
if (!matches.length) return undefined;
|
|
3291
|
+
var pool = matches[0].pool;
|
|
3292
|
+
var product = this.getVenueCatalogHydratedProduct(pool.products.find(function (row) {
|
|
3293
|
+
return Number(row.id) === productId;
|
|
3294
|
+
}));
|
|
3295
|
+
// Legacy promotion/gift inputs may have no venue role. Equivalent complete
|
|
3296
|
+
// sources are unambiguous; different pool snapshots must never use Set order.
|
|
3297
|
+
if (matches.slice(1).some(function (entry) {
|
|
3298
|
+
return !isEqual(product, _this11.getVenueCatalogHydratedProduct(entry.pool.products.find(function (row) {
|
|
3299
|
+
return Number(row.id) === productId;
|
|
3300
|
+
}))) || !isEqual(pool.pricingMenus, entry.pool.pricingMenus);
|
|
3301
|
+
})) return undefined;
|
|
3302
|
+
return {
|
|
3303
|
+
product: cloneDeep(product),
|
|
3304
|
+
menuList: cloneDeep(pool.pricingMenus)
|
|
3305
|
+
};
|
|
3306
|
+
}
|
|
3307
|
+
}, {
|
|
3308
|
+
key: "getProductByIds",
|
|
3309
|
+
value: function () {
|
|
3310
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(ids, options) {
|
|
3311
|
+
var _this12 = this;
|
|
3312
|
+
var active, products;
|
|
3313
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3314
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3315
|
+
case 0:
|
|
3316
|
+
active = this.isVenueCatalogLocalPricingActive();
|
|
3317
|
+
_context30.next = 3;
|
|
3318
|
+
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "getProductByIds", this).call(this, ids, active ? {
|
|
3319
|
+
loadMissing: false
|
|
3320
|
+
} : options);
|
|
3321
|
+
case 3:
|
|
3322
|
+
products = _context30.sent;
|
|
3323
|
+
return _context30.abrupt("return", active ? products.map(function (product) {
|
|
3324
|
+
return _this12.getVenueCatalogHydratedProduct(product);
|
|
3325
|
+
}) : products);
|
|
3326
|
+
case 5:
|
|
3327
|
+
case "end":
|
|
3328
|
+
return _context30.stop();
|
|
3329
|
+
}
|
|
3330
|
+
}, _callee30, this);
|
|
3331
|
+
}));
|
|
3332
|
+
function getProductByIds(_x17, _x18) {
|
|
3333
|
+
return _getProductByIds.apply(this, arguments);
|
|
3334
|
+
}
|
|
3335
|
+
return getProductByIds;
|
|
3261
3336
|
}()
|
|
3337
|
+
}, {
|
|
3338
|
+
key: "getVenueCatalogHydratedProduct",
|
|
3339
|
+
value: function getVenueCatalogHydratedProduct(product) {
|
|
3340
|
+
var _this$venueVariantDet, _product$id;
|
|
3341
|
+
var variants = (_this$venueVariantDet = this.venueVariantDetails.get(Number((_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id))) === null || _this$venueVariantDet === void 0 ? void 0 : _this$venueVariantDet.data;
|
|
3342
|
+
return variants ? _objectSpread(_objectSpread({}, cloneDeep(product)), {}, {
|
|
3343
|
+
variant: cloneDeep(variants)
|
|
3344
|
+
}) : cloneDeep(product);
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
/** Explicit user opening for legacy promotion/gift SKU hosts. Pure readers never call this. */
|
|
3348
|
+
}, {
|
|
3349
|
+
key: "prepareVenueCatalogProductDetail",
|
|
3350
|
+
value: (function () {
|
|
3351
|
+
var _prepareVenueCatalogProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3352
|
+
var owner, scope, generation, source;
|
|
3353
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3354
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3355
|
+
case 0:
|
|
3356
|
+
if (this.isVenueCatalogLocalPricingActive()) {
|
|
3357
|
+
_context31.next = 2;
|
|
3358
|
+
break;
|
|
3359
|
+
}
|
|
3360
|
+
throw venueCatalogError('VENUE_CATALOG_REQUIRED', 'Open a venue catalog before configuring this product.');
|
|
3361
|
+
case 2:
|
|
3362
|
+
owner = this.venueCatalogSessionKey;
|
|
3363
|
+
scope = this.getRuntimeOpenDataScope();
|
|
3364
|
+
generation = this.runtimeInitializationGeneration;
|
|
3365
|
+
source = this.getVenueCatalogLocalPriceSource(params.product_id);
|
|
3366
|
+
if (source) {
|
|
3367
|
+
_context31.next = 8;
|
|
3368
|
+
break;
|
|
3369
|
+
}
|
|
3370
|
+
return _context31.abrupt("return", undefined);
|
|
3371
|
+
case 8:
|
|
3372
|
+
_context31.next = 10;
|
|
3373
|
+
return this.hydrateVenueVariantDetail(source.product, params);
|
|
3374
|
+
case 10:
|
|
3375
|
+
if (!(this.runtimeOpenDataDestroyed || !this.isVenueCatalogLocalPricingActive() || owner !== this.venueCatalogSessionKey || scope !== this.getRuntimeOpenDataScope() || generation !== this.runtimeInitializationGeneration)) {
|
|
3376
|
+
_context31.next = 12;
|
|
3377
|
+
break;
|
|
3378
|
+
}
|
|
3379
|
+
throw venueCatalogError('VENUE_CATALOG_STALE', 'The venue catalog changed while loading product options.');
|
|
3380
|
+
case 12:
|
|
3381
|
+
return _context31.abrupt("return", this.getVenueCatalogHydratedProduct(source.product));
|
|
3382
|
+
case 13:
|
|
3383
|
+
case "end":
|
|
3384
|
+
return _context31.stop();
|
|
3385
|
+
}
|
|
3386
|
+
}, _callee31, this);
|
|
3387
|
+
}));
|
|
3388
|
+
function prepareVenueCatalogProductDetail(_x19) {
|
|
3389
|
+
return _prepareVenueCatalogProductDetail.apply(this, arguments);
|
|
3390
|
+
}
|
|
3391
|
+
return prepareVenueCatalogProductDetail;
|
|
3392
|
+
}())
|
|
3393
|
+
}, {
|
|
3394
|
+
key: "hydrateVenueVariantDetail",
|
|
3395
|
+
value: function () {
|
|
3396
|
+
var _hydrateVenueVariantDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(raw, params) {
|
|
3397
|
+
var _raw$id2,
|
|
3398
|
+
_entry,
|
|
3399
|
+
_this13 = this;
|
|
3400
|
+
var count, productId, entry, owner, scope, generation, core, request, next, assertCurrent;
|
|
3401
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3402
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3403
|
+
case 0:
|
|
3404
|
+
if (!(Number(raw.is_variant) !== 1)) {
|
|
3405
|
+
_context33.next = 2;
|
|
3406
|
+
break;
|
|
3407
|
+
}
|
|
3408
|
+
return _context33.abrupt("return");
|
|
3409
|
+
case 2:
|
|
3410
|
+
count = Number(raw.variant_count) || 0;
|
|
3411
|
+
if (!(Array.isArray(raw.variant) && raw.variant.length > 0 && raw.variant.length >= count)) {
|
|
3412
|
+
_context33.next = 5;
|
|
3413
|
+
break;
|
|
3414
|
+
}
|
|
3415
|
+
return _context33.abrupt("return");
|
|
3416
|
+
case 5:
|
|
3417
|
+
productId = Number((_raw$id2 = raw.id) !== null && _raw$id2 !== void 0 ? _raw$id2 : raw.product_id);
|
|
3418
|
+
entry = this.venueVariantDetails.get(productId);
|
|
3419
|
+
if ((_entry = entry) !== null && _entry !== void 0 && _entry.failed && params.retry === true) {
|
|
3420
|
+
this.venueVariantDetails.delete(productId);
|
|
3421
|
+
entry = undefined;
|
|
3422
|
+
}
|
|
3423
|
+
if (!entry) {
|
|
3424
|
+
owner = this.venueCatalogSessionKey;
|
|
3425
|
+
scope = this.getRuntimeOpenDataScope();
|
|
3426
|
+
generation = this.runtimeInitializationGeneration;
|
|
3427
|
+
core = this.core;
|
|
3428
|
+
request = this.request;
|
|
3429
|
+
next = {
|
|
3430
|
+
promise: Promise.resolve([])
|
|
3431
|
+
};
|
|
3432
|
+
assertCurrent = function assertCurrent() {
|
|
3433
|
+
if (_this13.runtimeOpenDataDestroyed || !_this13.isVenueCatalogLocalPricingActive() || owner !== _this13.venueCatalogSessionKey || scope !== _this13.getRuntimeOpenDataScope() || generation !== _this13.runtimeInitializationGeneration || core !== _this13.core || request !== _this13.request || _this13.venueVariantDetails.get(productId) !== next) {
|
|
3434
|
+
throw venueCatalogError('VENUE_CATALOG_STALE', 'The venue catalog changed while loading product options.');
|
|
3435
|
+
}
|
|
3436
|
+
};
|
|
3437
|
+
this.venueVariantDetails.set(productId, next);
|
|
3438
|
+
next.promise = Promise.resolve().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
3439
|
+
var _response$data$item, _response$data2, _detail$id;
|
|
3440
|
+
var response, detail, variants, _iterator, _step, _this13$store$product, _this13$store$product2, _this13$store$product3, _this13$store$product4, _this13$store$product5, _this13$store$product6, pool, product, hydrated;
|
|
3441
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3442
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3443
|
+
case 0:
|
|
3444
|
+
assertCurrent();
|
|
3445
|
+
_context32.next = 3;
|
|
3446
|
+
return request.get("/product/show/".concat(productId), {
|
|
3447
|
+
open_bundle: 1,
|
|
3448
|
+
with_schedule: 1,
|
|
3449
|
+
is_eject: 1,
|
|
3450
|
+
with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS)
|
|
3451
|
+
}, {
|
|
3452
|
+
useCache: false,
|
|
3453
|
+
customToast: function customToast() {}
|
|
3454
|
+
});
|
|
3455
|
+
case 3:
|
|
3456
|
+
response = _context32.sent;
|
|
3457
|
+
assertCurrent();
|
|
3458
|
+
if (!((response === null || response === void 0 ? void 0 : response.status) === false || (response === null || response === void 0 ? void 0 : response.code) != null && Number(response.code) !== 200)) {
|
|
3459
|
+
_context32.next = 7;
|
|
3460
|
+
break;
|
|
3461
|
+
}
|
|
3462
|
+
throw venueCatalogError('VENUE_VARIANT_DETAIL_FAILED', (response === null || response === void 0 ? void 0 : response.message) || 'Product options could not be loaded.');
|
|
3463
|
+
case 7:
|
|
3464
|
+
detail = (_response$data$item = response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.item) !== null && _response$data$item !== void 0 ? _response$data$item : response === null || response === void 0 ? void 0 : response.data;
|
|
3465
|
+
if (!(Number((_detail$id = detail === null || detail === void 0 ? void 0 : detail.id) !== null && _detail$id !== void 0 ? _detail$id : detail === null || detail === void 0 ? void 0 : detail.product_id) !== productId || !Array.isArray(detail === null || detail === void 0 ? void 0 : detail.variant) || !detail.variant.length || detail.variant.length < count)) {
|
|
3466
|
+
_context32.next = 10;
|
|
3467
|
+
break;
|
|
3468
|
+
}
|
|
3469
|
+
throw venueCatalogError('VENUE_VARIANT_DETAIL_INCOMPLETE', 'Complete product variants are unavailable. Please retry.');
|
|
3470
|
+
case 10:
|
|
3471
|
+
variants = detail.variant.map(function (value) {
|
|
3472
|
+
var _variant$_dataVariant, _variant$metadata, _ref42, _ref43, _original$price;
|
|
3473
|
+
var variant = cloneDeep(value);
|
|
3474
|
+
var original = (_variant$_dataVariant = variant._dataVariant) === null || _variant$_dataVariant === void 0 ? void 0 : _variant$_dataVariant.original;
|
|
3475
|
+
var evaluated = variant._dataVariant || Array.isArray((_variant$metadata = variant.metadata) === null || _variant$metadata === void 0 ? void 0 : _variant$metadata.data_variant_ids);
|
|
3476
|
+
var basePrice = (_ref42 = (_ref43 = (_original$price = original === null || original === void 0 ? void 0 : original.price) !== null && _original$price !== void 0 ? _original$price : original === null || original === void 0 ? void 0 : original.base_price) !== null && _ref43 !== void 0 ? _ref43 : variant.base_price) !== null && _ref42 !== void 0 ? _ref42 : evaluated ? undefined : variant.price;
|
|
3477
|
+
if (!Number.isSafeInteger(Number(variant.id)) || Number(variant.id) <= 0 || basePrice === undefined || basePrice === null || basePrice === '' || !Number.isFinite(Number(basePrice))) {
|
|
3478
|
+
throw venueCatalogError('VENUE_VARIANT_DETAIL_INCOMPLETE', 'The base price for a product variant is unavailable.');
|
|
3479
|
+
}
|
|
3480
|
+
// Copy only combination SKU data. The pool's price/data_variants and
|
|
3481
|
+
// pricing metadata remain its original baseline for every later context.
|
|
3482
|
+
variant.price = basePrice;
|
|
3483
|
+
variant.base_price = basePrice;
|
|
3484
|
+
if (variant.selling_price !== undefined) variant.selling_price = basePrice;
|
|
3485
|
+
delete variant._dataVariant;
|
|
3486
|
+
if (variant.metadata) delete variant.metadata.data_variant_ids;
|
|
3487
|
+
return variant;
|
|
3488
|
+
});
|
|
3489
|
+
next.data = variants;
|
|
3490
|
+
_iterator = _createForOfIteratorHelper(_this13.venueCatalogSessions);
|
|
3491
|
+
_context32.prev = 13;
|
|
3492
|
+
_iterator.s();
|
|
3493
|
+
case 15:
|
|
3494
|
+
if ((_step = _iterator.n()).done) {
|
|
3495
|
+
_context32.next = 27;
|
|
3496
|
+
break;
|
|
3497
|
+
}
|
|
3498
|
+
pool = _step.value;
|
|
3499
|
+
if (!(pool.scope !== scope || !pool.pool)) {
|
|
3500
|
+
_context32.next = 19;
|
|
3501
|
+
break;
|
|
3502
|
+
}
|
|
3503
|
+
return _context32.abrupt("continue", 25);
|
|
3504
|
+
case 19:
|
|
3505
|
+
product = pool.pool.products.find(function (row) {
|
|
3506
|
+
return Number(row.id) === productId;
|
|
3507
|
+
});
|
|
3508
|
+
if (product) {
|
|
3509
|
+
_context32.next = 22;
|
|
3510
|
+
break;
|
|
3511
|
+
}
|
|
3512
|
+
return _context32.abrupt("continue", 25);
|
|
3513
|
+
case 22:
|
|
3514
|
+
hydrated = _this13.getVenueCatalogHydratedProduct(product);
|
|
3515
|
+
(_this13$store$product = _this13.store.products) === null || _this13$store$product === void 0 || (_this13$store$product2 = (_this13$store$product3 = _this13$store$product).rememberRawProductQueryResult) === null || _this13$store$product2 === void 0 || _this13$store$product2.call(_this13$store$product3, [cloneDeep(hydrated)]);
|
|
3516
|
+
(_this13$store$product4 = _this13.store.products) === null || _this13$store$product4 === void 0 || (_this13$store$product5 = (_this13$store$product6 = _this13$store$product4).addProduct) === null || _this13$store$product5 === void 0 || _this13$store$product5.call(_this13$store$product6, [cloneDeep(hydrated)]);
|
|
3517
|
+
case 25:
|
|
3518
|
+
_context32.next = 15;
|
|
3519
|
+
break;
|
|
3520
|
+
case 27:
|
|
3521
|
+
_context32.next = 32;
|
|
3522
|
+
break;
|
|
3523
|
+
case 29:
|
|
3524
|
+
_context32.prev = 29;
|
|
3525
|
+
_context32.t0 = _context32["catch"](13);
|
|
3526
|
+
_iterator.e(_context32.t0);
|
|
3527
|
+
case 32:
|
|
3528
|
+
_context32.prev = 32;
|
|
3529
|
+
_iterator.f();
|
|
3530
|
+
return _context32.finish(32);
|
|
3531
|
+
case 35:
|
|
3532
|
+
return _context32.abrupt("return", variants);
|
|
3533
|
+
case 36:
|
|
3534
|
+
case "end":
|
|
3535
|
+
return _context32.stop();
|
|
3536
|
+
}
|
|
3537
|
+
}, _callee32, null, [[13, 29, 32, 35]]);
|
|
3538
|
+
}))).catch(function (error) {
|
|
3539
|
+
next.failed = true;
|
|
3540
|
+
throw error;
|
|
3541
|
+
});
|
|
3542
|
+
entry = next;
|
|
3543
|
+
}
|
|
3544
|
+
_context33.next = 11;
|
|
3545
|
+
return entry.promise;
|
|
3546
|
+
case 11:
|
|
3547
|
+
case "end":
|
|
3548
|
+
return _context33.stop();
|
|
3549
|
+
}
|
|
3550
|
+
}, _callee33, this);
|
|
3551
|
+
}));
|
|
3552
|
+
function hydrateVenueVariantDetail(_x20, _x21) {
|
|
3553
|
+
return _hydrateVenueVariantDetail.apply(this, arguments);
|
|
3554
|
+
}
|
|
3555
|
+
return hydrateVenueVariantDetail;
|
|
3556
|
+
}() /** One complete raw product query per explicitly configured pool for this page lifetime. */
|
|
3557
|
+
}, {
|
|
3558
|
+
key: "createVenueCatalogSession",
|
|
3559
|
+
value: function createVenueCatalogSession(params) {
|
|
3560
|
+
var _this$otherParams30,
|
|
3561
|
+
_params$sessionKey,
|
|
3562
|
+
_this14 = this;
|
|
3563
|
+
if (!isCustomerUserPlatform((_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform)) {
|
|
3564
|
+
throw venueCatalogError('VENUE_CATALOG_PLATFORM_UNSUPPORTED', 'Venue catalog sessions require a customer platform.');
|
|
3565
|
+
}
|
|
3566
|
+
var ids = params.menu_list_ids;
|
|
3567
|
+
if (!Array.isArray(ids) || !ids.length || ids.some(function (id) {
|
|
3568
|
+
return !Number.isSafeInteger(id) || id <= 0;
|
|
3569
|
+
})) {
|
|
3570
|
+
throw venueCatalogError('VENUE_MENU_REQUIRED', 'Choose an explicit menu for this venue product pool.');
|
|
3571
|
+
}
|
|
3572
|
+
var menuIds = _toConsumableArray(new Set(ids)).sort(function (a, b) {
|
|
3573
|
+
return a - b;
|
|
3574
|
+
});
|
|
3575
|
+
var scope = this.getRuntimeOpenDataScope();
|
|
3576
|
+
var generation = this.runtimeInitializationGeneration;
|
|
3577
|
+
var core = this.core;
|
|
3578
|
+
var request = this.request;
|
|
3579
|
+
var entry = {
|
|
3580
|
+
scope: scope,
|
|
3581
|
+
generation: generation,
|
|
3582
|
+
role: params.poolRole
|
|
3583
|
+
};
|
|
3584
|
+
var sessionKey = JSON.stringify([scope, generation, (_params$sessionKey = params.sessionKey) !== null && _params$sessionKey !== void 0 ? _params$sessionKey : null]);
|
|
3585
|
+
if (!this.venueCatalogSessions.size || sessionKey !== this.venueCatalogSessionKey) {
|
|
3586
|
+
// React may create new page pools before disposing the old page's pools.
|
|
3587
|
+
// The explicit session identity prevents reusing old-order occupancy then.
|
|
3588
|
+
this.venueCatalogSessions.clear();
|
|
3589
|
+
this.venueCatalogSessionKey = sessionKey;
|
|
3590
|
+
this.venueCatalogMenus = undefined;
|
|
3591
|
+
this.venueVariantDetails.clear();
|
|
3592
|
+
this.availabilitySessionResourceCache.clear();
|
|
3593
|
+
}
|
|
3594
|
+
this.venueCatalogSessions.add(entry);
|
|
3595
|
+
var assertCurrent = function assertCurrent() {
|
|
3596
|
+
if (!_this14.venueCatalogSessions.has(entry)) {
|
|
3597
|
+
throw venueCatalogError('VENUE_CATALOG_DISPOSED', 'The venue catalog session is closed.');
|
|
3598
|
+
}
|
|
3599
|
+
if (_this14.runtimeOpenDataDestroyed || _this14.core !== core || _this14.request !== request || generation !== _this14.runtimeInitializationGeneration || scope !== _this14.getRuntimeOpenDataScope()) {
|
|
3600
|
+
throw venueCatalogError('VENUE_CATALOG_STALE', 'The venue store context changed. Reopen the booking page.');
|
|
3601
|
+
}
|
|
3602
|
+
};
|
|
3603
|
+
var now = function now() {
|
|
3604
|
+
var _this14$otherParams;
|
|
3605
|
+
var timezone = String(((_this14$otherParams = _this14.otherParams) === null || _this14$otherParams === void 0 ? void 0 : _this14$otherParams.businessTimezone) || _this14.getPickupTimingContextData('timezone') || '').trim();
|
|
3606
|
+
if (!timezone) throw venueCatalogError('VENUE_TIMEZONE_REQUIRED', 'The venue timezone is not ready.');
|
|
3607
|
+
var parts = new Intl.DateTimeFormat('en-GB', {
|
|
3608
|
+
timeZone: timezone,
|
|
3609
|
+
year: 'numeric',
|
|
3610
|
+
month: '2-digit',
|
|
3611
|
+
day: '2-digit',
|
|
3612
|
+
hour: '2-digit',
|
|
3613
|
+
minute: '2-digit',
|
|
3614
|
+
second: '2-digit',
|
|
3615
|
+
hourCycle: 'h23'
|
|
3616
|
+
}).formatToParts(new Date());
|
|
3617
|
+
var part = function part(type) {
|
|
3618
|
+
var _parts$find;
|
|
3619
|
+
return (_parts$find = parts.find(function (item) {
|
|
3620
|
+
return item.type === type;
|
|
3621
|
+
})) === null || _parts$find === void 0 ? void 0 : _parts$find.value;
|
|
3622
|
+
};
|
|
3623
|
+
return "".concat(part('year'), "-").concat(part('month'), "-").concat(part('day'), " ").concat(part('hour'), ":").concat(part('minute'), ":").concat(part('second'));
|
|
3624
|
+
};
|
|
3625
|
+
var snapshot = function snapshot(pool, input) {
|
|
3626
|
+
var _input$product_ids, _this14$core$getPlugi, _this14$core, _ref44, _input$customer_id, _this14$getTempOrder, _user$get;
|
|
3627
|
+
assertCurrent();
|
|
3628
|
+
if (input.menu_list_ids && JSON.stringify(_toConsumableArray(new Set(input.menu_list_ids)).sort(function (a, b) {
|
|
3629
|
+
return a - b;
|
|
3630
|
+
})) !== JSON.stringify(menuIds)) {
|
|
3631
|
+
throw venueCatalogError('VENUE_MENU_SCOPE_CHANGED', 'This catalog session belongs to another menu.');
|
|
3632
|
+
}
|
|
3633
|
+
var current = now();
|
|
3634
|
+
var datetime = input.schedule_datetime || (input.schedule_date ? "".concat(input.schedule_date, " ").concat(current.slice(11)) : current);
|
|
3635
|
+
if (!parseLocalDateTime(datetime.replace('T', ' ')) || input.schedule_date && datetime.slice(0, 10) !== input.schedule_date) {
|
|
3636
|
+
throw venueCatalogError('VENUE_CATALOG_DATETIME_INVALID', 'Choose a valid venue catalog date and time.');
|
|
3637
|
+
}
|
|
3638
|
+
var menus = activeVenueMenus(pool.menus, _this14.getAvailabilityScheduleCatalog(), datetime, Boolean(input.schedule_date && !input.schedule_datetime));
|
|
3639
|
+
var products = pool.products.filter(function (product) {
|
|
3640
|
+
return menus.some(function (menu) {
|
|
3641
|
+
return productMatchesVenueMenu(product, menu);
|
|
3642
|
+
});
|
|
3643
|
+
}).map(function (product) {
|
|
3644
|
+
return _this14.getVenueCatalogHydratedProduct(product);
|
|
3645
|
+
});
|
|
3646
|
+
if ((_input$product_ids = input.product_ids) !== null && _input$product_ids !== void 0 && _input$product_ids.length) products = products.filter(function (product) {
|
|
3647
|
+
return input.product_ids.some(function (id) {
|
|
3648
|
+
return Number(id) === Number(product.id);
|
|
3649
|
+
});
|
|
3650
|
+
});
|
|
3651
|
+
var user = (_this14$core$getPlugi = (_this14$core = _this14.core).getPlugin) === null || _this14$core$getPlugi === void 0 ? void 0 : _this14$core$getPlugi.call(_this14$core, 'user');
|
|
3652
|
+
var queryPayload = {
|
|
3653
|
+
schedule_date: datetime.slice(0, 10),
|
|
3654
|
+
schedule_datetime: datetime,
|
|
3655
|
+
customer_id: (_ref44 = (_input$customer_id = input.customer_id) !== null && _input$customer_id !== void 0 ? _input$customer_id : (_this14$getTempOrder = _this14.getTempOrder()) === null || _this14$getTempOrder === void 0 ? void 0 : _this14$getTempOrder.customer_id) !== null && _ref44 !== void 0 ? _ref44 : user === null || user === void 0 || (_user$get = user.get) === null || _user$get === void 0 || (_user$get = _user$get.call(user)) === null || _user$get === void 0 ? void 0 : _user$get.id,
|
|
3656
|
+
strategy_context: _objectSpread(_objectSpread({}, _this14.getPriceQueryStrategyContext()), input.strategy_context || {})
|
|
3657
|
+
};
|
|
3658
|
+
var result = tryResolveClientDataVariants({
|
|
3659
|
+
core: _this14.core,
|
|
3660
|
+
otherParams: _this14.otherParams,
|
|
3661
|
+
products: cloneDeep(products),
|
|
3662
|
+
queryPayload: queryPayload,
|
|
3663
|
+
handledByOsServer: false,
|
|
3664
|
+
scheduleList: _this14.getAvailabilityScheduleCatalog(),
|
|
3665
|
+
menuList: pool.pricingMenus
|
|
3666
|
+
});
|
|
3667
|
+
if (result.status !== 'resolved' && result.status !== 'empty') {
|
|
3668
|
+
throw venueCatalogError('VENUE_LOCAL_PRICE_UNAVAILABLE', 'Complete product pricing rules are not ready. Please retry.');
|
|
3669
|
+
}
|
|
3670
|
+
return result.products.slice().sort(function (a, b) {
|
|
3671
|
+
return Number(b.sort || 0) - Number(a.sort || 0);
|
|
3672
|
+
});
|
|
3673
|
+
};
|
|
3674
|
+
return createVenueCatalogSessionAdapter({
|
|
3675
|
+
assertCurrent: assertCurrent,
|
|
3676
|
+
load: function () {
|
|
3677
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
3678
|
+
var promise, pricingMenus, menus, onlyIds, onlyCollections, productIds, collections, products, pool;
|
|
3679
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3680
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3681
|
+
case 0:
|
|
3682
|
+
if (!_this14.venueCatalogMenus || _this14.venueCatalogMenus.scope !== scope) {
|
|
3683
|
+
promise = request.get('/form/data/v1', {
|
|
3684
|
+
skip: 1,
|
|
3685
|
+
num: 999,
|
|
3686
|
+
code: 'menu_list'
|
|
3687
|
+
}, {
|
|
3688
|
+
useCache: false,
|
|
3689
|
+
customToast: function customToast() {}
|
|
3690
|
+
}).then(function (response) {
|
|
3691
|
+
return readVenueCatalogList(response, 'Venue menus');
|
|
3692
|
+
});
|
|
3693
|
+
_this14.venueCatalogMenus = {
|
|
3694
|
+
scope: scope,
|
|
3695
|
+
promise: promise
|
|
3696
|
+
};
|
|
3697
|
+
void promise.catch(function () {
|
|
3698
|
+
var _this14$venueCatalogM;
|
|
3699
|
+
if (((_this14$venueCatalogM = _this14.venueCatalogMenus) === null || _this14$venueCatalogM === void 0 ? void 0 : _this14$venueCatalogM.promise) === promise) _this14.venueCatalogMenus = undefined;
|
|
3700
|
+
});
|
|
3701
|
+
}
|
|
3702
|
+
_context34.next = 3;
|
|
3703
|
+
return _this14.venueCatalogMenus.promise;
|
|
3704
|
+
case 3:
|
|
3705
|
+
pricingMenus = _context34.sent;
|
|
3706
|
+
menus = validateVenueMenus(pricingMenus, menuIds);
|
|
3707
|
+
assertCurrent();
|
|
3708
|
+
// A menu query with a date may exclude future members. Read the raw ID union
|
|
3709
|
+
// without menu/time/customer pricing filters, then filter collection/all menus locally.
|
|
3710
|
+
onlyIds = menus.every(function (menu) {
|
|
3711
|
+
return menu.partyroom_package.type === 'products';
|
|
3712
|
+
});
|
|
3713
|
+
onlyCollections = menus.every(function (menu) {
|
|
3714
|
+
return menu.partyroom_package.type === 'product_collection';
|
|
3715
|
+
});
|
|
3716
|
+
productIds = onlyIds ? _toConsumableArray(new Set(menus.flatMap(function (menu) {
|
|
3717
|
+
return menu.partyroom_package.products.map(function (product) {
|
|
3718
|
+
return Number(product.product_id);
|
|
3719
|
+
});
|
|
3720
|
+
}))) : undefined;
|
|
3721
|
+
collections = onlyCollections ? _toConsumableArray(new Set(menus.flatMap(function (menu) {
|
|
3722
|
+
return menu.partyroom_package.products.map(function (product) {
|
|
3723
|
+
return String(product.product_collection_id);
|
|
3724
|
+
});
|
|
3725
|
+
}))) : undefined;
|
|
3726
|
+
if (!(onlyIds && !(productIds !== null && productIds !== void 0 && productIds.length))) {
|
|
3727
|
+
_context34.next = 14;
|
|
3728
|
+
break;
|
|
3729
|
+
}
|
|
3730
|
+
_context34.t0 = [];
|
|
3731
|
+
_context34.next = 17;
|
|
3732
|
+
break;
|
|
3733
|
+
case 14:
|
|
3734
|
+
_context34.next = 16;
|
|
3735
|
+
return _this14.store.products.loadVenueCatalogPool({
|
|
3736
|
+
product_ids: productIds,
|
|
3737
|
+
collection: collections,
|
|
3738
|
+
category_ids: params.category_ids,
|
|
3739
|
+
extension_type: params.extension_type,
|
|
3740
|
+
cacheId: _this14.cacheId
|
|
3741
|
+
});
|
|
3742
|
+
case 16:
|
|
3743
|
+
_context34.t0 = _context34.sent;
|
|
3744
|
+
case 17:
|
|
3745
|
+
products = _context34.t0;
|
|
3746
|
+
assertCurrent();
|
|
3747
|
+
pool = {
|
|
3748
|
+
menus: menus,
|
|
3749
|
+
pricingMenus: cloneDeep(pricingMenus),
|
|
3750
|
+
products: products.filter(function (product) {
|
|
3751
|
+
return menus.some(function (menu) {
|
|
3752
|
+
return productMatchesVenueMenu(product, menu);
|
|
3753
|
+
});
|
|
3754
|
+
})
|
|
3755
|
+
};
|
|
3756
|
+
entry.pool = cloneDeep(pool);
|
|
3757
|
+
// Legacy marketing lookups can reuse complete records without changing
|
|
3758
|
+
// either pool's membership or publishing a replacement sales catalog.
|
|
3759
|
+
_this14.store.products.rememberRawProductQueryResult(cloneDeep(pool.products));
|
|
3760
|
+
_this14.store.products.addProduct(cloneDeep(pool.products));
|
|
3761
|
+
return _context34.abrupt("return", pool);
|
|
3762
|
+
case 24:
|
|
3763
|
+
case "end":
|
|
3764
|
+
return _context34.stop();
|
|
3765
|
+
}
|
|
3766
|
+
}, _callee34);
|
|
3767
|
+
}));
|
|
3768
|
+
function load() {
|
|
3769
|
+
return _load.apply(this, arguments);
|
|
3770
|
+
}
|
|
3771
|
+
return load;
|
|
3772
|
+
}(),
|
|
3773
|
+
snapshot: snapshot,
|
|
3774
|
+
prepareDetail: function () {
|
|
3775
|
+
var _prepareDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(pool, query) {
|
|
3776
|
+
var raw;
|
|
3777
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3778
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3779
|
+
case 0:
|
|
3780
|
+
raw = pool.products.find(function (product) {
|
|
3781
|
+
return Number(product.id) === Number(query.product_id);
|
|
3782
|
+
});
|
|
3783
|
+
if (!raw) {
|
|
3784
|
+
_context35.next = 4;
|
|
3785
|
+
break;
|
|
3786
|
+
}
|
|
3787
|
+
_context35.next = 4;
|
|
3788
|
+
return _this14.hydrateVenueVariantDetail(raw, query);
|
|
3789
|
+
case 4:
|
|
3790
|
+
assertCurrent();
|
|
3791
|
+
case 5:
|
|
3792
|
+
case "end":
|
|
3793
|
+
return _context35.stop();
|
|
3794
|
+
}
|
|
3795
|
+
}, _callee35);
|
|
3796
|
+
}));
|
|
3797
|
+
function prepareDetail(_x22, _x23) {
|
|
3798
|
+
return _prepareDetail.apply(this, arguments);
|
|
3799
|
+
}
|
|
3800
|
+
return prepareDetail;
|
|
3801
|
+
}(),
|
|
3802
|
+
quote: function () {
|
|
3803
|
+
var _quote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(pool, query) {
|
|
3804
|
+
var _product$product_id3;
|
|
3805
|
+
var product, productId, booking, datetime, raw, result;
|
|
3806
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3807
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3808
|
+
case 0:
|
|
3809
|
+
product = query.product;
|
|
3810
|
+
productId = Number((_product$product_id3 = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id3 !== void 0 ? _product$product_id3 : product === null || product === void 0 ? void 0 : product.id);
|
|
3811
|
+
booking = query.booking;
|
|
3812
|
+
datetime = booking !== null && booking !== void 0 && booking.start_date ? "".concat(booking.start_date, " ").concat(booking.start_time || '00:00:00') : query.datetime || now();
|
|
3813
|
+
if (snapshot(pool, {
|
|
3814
|
+
product_ids: [productId],
|
|
3815
|
+
schedule_datetime: datetime,
|
|
3816
|
+
customer_id: query.customer_id == null ? undefined : Number(query.customer_id)
|
|
3817
|
+
}).length) {
|
|
3818
|
+
_context36.next = 6;
|
|
3819
|
+
break;
|
|
3820
|
+
}
|
|
3821
|
+
throw venueCatalogError('VENUE_PRODUCT_UNAVAILABLE', 'This product is unavailable in the selected menu at this time.');
|
|
3822
|
+
case 6:
|
|
3823
|
+
raw = pool.products.find(function (row) {
|
|
3824
|
+
return Number(row.id) === productId;
|
|
3825
|
+
});
|
|
3826
|
+
if (raw) {
|
|
3827
|
+
_context36.next = 9;
|
|
3828
|
+
break;
|
|
3829
|
+
}
|
|
3830
|
+
throw venueCatalogError('VENUE_PRODUCT_UNAVAILABLE', 'This product is not in the venue catalog.');
|
|
3831
|
+
case 9:
|
|
3832
|
+
_context36.next = 11;
|
|
3833
|
+
return _this14.calculateVenueCatalogProductBookingPrice(_objectSpread(_objectSpread({}, query), {}, {
|
|
3834
|
+
datetime: datetime
|
|
3835
|
+
}), {
|
|
3836
|
+
product: _this14.getVenueCatalogHydratedProduct(raw),
|
|
3837
|
+
menuList: pool.pricingMenus
|
|
3838
|
+
});
|
|
3839
|
+
case 11:
|
|
3840
|
+
result = _context36.sent;
|
|
3841
|
+
assertCurrent();
|
|
3842
|
+
return _context36.abrupt("return", result);
|
|
3843
|
+
case 14:
|
|
3844
|
+
case "end":
|
|
3845
|
+
return _context36.stop();
|
|
3846
|
+
}
|
|
3847
|
+
}, _callee36);
|
|
3848
|
+
}));
|
|
3849
|
+
function quote(_x24, _x25) {
|
|
3850
|
+
return _quote.apply(this, arguments);
|
|
3851
|
+
}
|
|
3852
|
+
return quote;
|
|
3853
|
+
}(),
|
|
3854
|
+
onRetry: function onRetry() {
|
|
3855
|
+
var _iterator2 = _createForOfIteratorHelper(_this14.venueVariantDetails),
|
|
3856
|
+
_step2;
|
|
3857
|
+
try {
|
|
3858
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
3859
|
+
var _step2$value = _slicedToArray(_step2.value, 2),
|
|
3860
|
+
id = _step2$value[0],
|
|
3861
|
+
detail = _step2$value[1];
|
|
3862
|
+
if (detail.failed) _this14.venueVariantDetails.delete(id);
|
|
3863
|
+
}
|
|
3864
|
+
} catch (err) {
|
|
3865
|
+
_iterator2.e(err);
|
|
3866
|
+
} finally {
|
|
3867
|
+
_iterator2.f();
|
|
3868
|
+
}
|
|
3869
|
+
},
|
|
3870
|
+
onDispose: function onDispose() {
|
|
3871
|
+
_this14.venueCatalogSessions.delete(entry);
|
|
3872
|
+
if (!_this14.venueCatalogSessions.size) {
|
|
3873
|
+
_this14.venueCatalogSessionKey = undefined;
|
|
3874
|
+
_this14.venueCatalogMenus = undefined;
|
|
3875
|
+
_this14.venueVariantDetails.clear();
|
|
3876
|
+
_this14.availabilitySessionResourceCache.clear();
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
});
|
|
3880
|
+
}
|
|
3881
|
+
|
|
3262
3882
|
/**
|
|
3263
3883
|
* Opt-in calendar/card preview batching. Results expire after sixty seconds or a
|
|
3264
3884
|
* runtime change; the next read starts a fresh clock/cache. Selection and submit
|
|
3265
3885
|
* must keep using the ordinary fresh query methods. Call dispose on owner cleanup.
|
|
3266
3886
|
*/
|
|
3267
|
-
)
|
|
3268
3887
|
}, {
|
|
3269
3888
|
key: "createCatalogQueryBatch",
|
|
3270
3889
|
value: function createCatalogQueryBatch() {
|
|
3271
|
-
var
|
|
3890
|
+
var _this15 = this;
|
|
3272
3891
|
return createCatalogQueryBatchAdapter({
|
|
3273
3892
|
runtime: function runtime() {
|
|
3274
|
-
var
|
|
3275
|
-
if (
|
|
3276
|
-
var user = (
|
|
3277
|
-
var productParams = ((
|
|
3893
|
+
var _this15$core$getPlugi, _this15$core, _this15$store$product, _this15$core$getModul, _this15$core2, _this15$core$getModul2, _this15$core3, _this15$core$context, _this15$core$getPlugi2, _this15$core4, _this15$core$getPlugi3, _this15$core5, _user$get2, _getScheduleList, _ref46, _this15$core$context2, _this15$core$context3, _evaluator$getStrateg;
|
|
3894
|
+
if (_this15.runtimeOpenDataDestroyed) throw new Error('The booking service is closed.');
|
|
3895
|
+
var user = (_this15$core$getPlugi = (_this15$core = _this15.core).getPlugin) === null || _this15$core$getPlugi === void 0 ? void 0 : _this15$core$getPlugi.call(_this15$core, 'user');
|
|
3896
|
+
var productParams = ((_this15$store$product = _this15.store.products) === null || _this15$store$product === void 0 ? void 0 : _this15$store$product.otherParams) || _this15.otherParams || {};
|
|
3278
3897
|
var fatherModule = String(productParams.fatherModule || '').trim();
|
|
3279
|
-
var schedule = (fatherModule ? (
|
|
3280
|
-
var evaluator = (
|
|
3898
|
+
var schedule = (fatherModule ? (_this15$core$getModul = (_this15$core2 = _this15.core).getModule) === null || _this15$core$getModul === void 0 ? void 0 : _this15$core$getModul.call(_this15$core2, "".concat(fatherModule, "_schedule")) : null) || ((_this15$core$getModul2 = (_this15$core3 = _this15.core).getModule) === null || _this15$core$getModul2 === void 0 ? void 0 : _this15$core$getModul2.call(_this15$core3, 'schedule'));
|
|
3899
|
+
var evaluator = (_this15$core$context = _this15.core.context) === null || _this15$core$context === void 0 ? void 0 : _this15$core$context.dataVariantEvaluator;
|
|
3281
3900
|
// OpenData hydration is not a catalog input. Its temporary null/reload cycle
|
|
3282
3901
|
// must not expire a batch while a parallel preview reads sales settings.
|
|
3283
|
-
var
|
|
3284
|
-
_openData =
|
|
3285
|
-
otherParams = _objectWithoutProperties(
|
|
3902
|
+
var _ref45 = _this15.otherParams || {},
|
|
3903
|
+
_openData = _ref45.openData,
|
|
3904
|
+
otherParams = _objectWithoutProperties(_ref45, _excluded2);
|
|
3286
3905
|
var _productOpenData = productParams.openData,
|
|
3287
3906
|
productOtherParams = _objectWithoutProperties(productParams, _excluded3);
|
|
3288
3907
|
return {
|
|
3289
|
-
references: [
|
|
3908
|
+
references: [_this15.core, _this15.request, _this15.store.products, _this15.core.server, user, _this15.appPlugin, (_this15$core$getPlugi2 = (_this15$core4 = _this15.core).getPlugin) === null || _this15$core$getPlugi2 === void 0 ? void 0 : _this15$core$getPlugi2.call(_this15$core4, 'request'), (_this15$core$getPlugi3 = (_this15$core5 = _this15.core).getPlugin) === null || _this15$core$getPlugi3 === void 0 ? void 0 : _this15$core$getPlugi3.call(_this15$core5, 'app'), schedule, evaluator],
|
|
3290
3909
|
values: {
|
|
3291
|
-
initialization:
|
|
3292
|
-
scope:
|
|
3293
|
-
requestBaseUrl:
|
|
3294
|
-
customerId: user === null || user === void 0 || (_user$
|
|
3910
|
+
initialization: _this15.runtimeInitializationGeneration,
|
|
3911
|
+
scope: _this15.getRuntimeOpenDataScope(),
|
|
3912
|
+
requestBaseUrl: _this15.request.baseUrl,
|
|
3913
|
+
customerId: user === null || user === void 0 || (_user$get2 = user.get) === null || _user$get2 === void 0 || (_user$get2 = _user$get2.call(user)) === null || _user$get2 === void 0 ? void 0 : _user$get2.id,
|
|
3295
3914
|
otherParams: otherParams,
|
|
3296
3915
|
productOtherParams: productOtherParams
|
|
3297
3916
|
},
|
|
3298
3917
|
refreshValues: {
|
|
3299
|
-
scheduleList: schedule === null || schedule === void 0 || (_getScheduleList = (
|
|
3300
|
-
contextScheduleList: (
|
|
3301
|
-
contextMenuList: (
|
|
3918
|
+
scheduleList: schedule === null || schedule === void 0 || (_getScheduleList = (_ref46 = schedule).getScheduleList) === null || _getScheduleList === void 0 ? void 0 : _getScheduleList.call(_ref46),
|
|
3919
|
+
contextScheduleList: (_this15$core$context2 = _this15.core.context) === null || _this15$core$context2 === void 0 ? void 0 : _this15$core$context2.scheduleList,
|
|
3920
|
+
contextMenuList: (_this15$core$context3 = _this15.core.context) === null || _this15$core$context3 === void 0 ? void 0 : _this15$core$context3.menuList,
|
|
3302
3921
|
strategyConfigs: evaluator === null || evaluator === void 0 || (_evaluator$getStrateg = evaluator.getStrategyConfigs) === null || _evaluator$getStrateg === void 0 ? void 0 : _evaluator$getStrateg.call(evaluator)
|
|
3303
3922
|
}
|
|
3304
3923
|
};
|
|
3305
3924
|
},
|
|
3306
3925
|
normalize: function normalize(params, now) {
|
|
3307
|
-
var
|
|
3926
|
+
var _this15$core$getPlugi4, _this15$core6, _user$get3, _this15$store$product2, _productParams$busine, _params$with_count, _params$with_schedule, _params$status;
|
|
3308
3927
|
var date = params.schedule_date || dayjs(now).format('YYYY-MM-DD');
|
|
3309
|
-
var user = (
|
|
3928
|
+
var user = (_this15$core$getPlugi4 = (_this15$core6 = _this15.core).getPlugin) === null || _this15$core$getPlugi4 === void 0 ? void 0 : _this15$core$getPlugi4.call(_this15$core6, 'user');
|
|
3310
3929
|
var explicitCustomer = params.customer_id;
|
|
3311
3930
|
if (explicitCustomer != null && (!Number.isSafeInteger(Number(explicitCustomer)) || Number(explicitCustomer) <= 0)) {
|
|
3312
3931
|
throw new Error('Catalog query customer_id must be a positive integer.');
|
|
3313
3932
|
}
|
|
3314
|
-
var fallbackCustomer = user === null || user === void 0 || (_user$
|
|
3933
|
+
var fallbackCustomer = user === null || user === void 0 || (_user$get3 = user.get) === null || _user$get3 === void 0 || (_user$get3 = _user$get3.call(user)) === null || _user$get3 === void 0 ? void 0 : _user$get3.id;
|
|
3315
3934
|
var customer = explicitCustomer !== null && explicitCustomer !== void 0 ? explicitCustomer : Number.isSafeInteger(Number(fallbackCustomer)) && Number(fallbackCustomer) > 0 ? Number(fallbackCustomer) : undefined;
|
|
3316
|
-
var productParams = ((
|
|
3935
|
+
var productParams = ((_this15$store$product2 = _this15.store.products) === null || _this15$store$product2 === void 0 ? void 0 : _this15$store$product2.otherParams) || _this15.otherParams || {};
|
|
3317
3936
|
var channelMap = {
|
|
3318
3937
|
online_store: 'online-store',
|
|
3319
3938
|
scan_to_order: 'online-store',
|
|
@@ -3350,28 +3969,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3350
3969
|
return JSON.stringify(stableValue(params));
|
|
3351
3970
|
},
|
|
3352
3971
|
snapshot: function snapshot(params) {
|
|
3353
|
-
return
|
|
3972
|
+
return _this15.queryCatalogSnapshot(params);
|
|
3354
3973
|
},
|
|
3355
3974
|
detail: function detail(params, snapshot) {
|
|
3356
|
-
return
|
|
3975
|
+
return _this15.loadCatalogProductDetail(params, snapshot);
|
|
3357
3976
|
}
|
|
3358
3977
|
});
|
|
3359
3978
|
}
|
|
3360
3979
|
}, {
|
|
3361
3980
|
key: "loadCatalogProductDetail",
|
|
3362
3981
|
value: function () {
|
|
3363
|
-
var _loadCatalogProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3364
|
-
var _this$
|
|
3982
|
+
var _loadCatalogProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params, loadSnapshot) {
|
|
3983
|
+
var _this$otherParams31, _this$core$server, _this$core$server$has, _this$otherParams32, _this$otherParams33, _this$otherParams$bus3, _this$otherParams34, _this$otherParams35, _this$core$getPlugin, _this$core3, _this$core$getPlugin$, _this$otherParams36, _response$data$item2, _response$data3, _raw$id3, _this$store$products, _this$store$products$;
|
|
3365
3984
|
var _cloneDeep2, product_id, _ignoredIds, catalogParams, schedule_date, schedule_datetime, scopedParams, member, baseUrl, localPath, handledByOsServer, channelMap, channel, businessCode, strategy_context, customerId, queryPayload, response, raw, resolved, detail, _i2, _arr2, key;
|
|
3366
|
-
return _regeneratorRuntime().wrap(function
|
|
3367
|
-
while (1) switch (
|
|
3985
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3986
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3368
3987
|
case 0:
|
|
3369
3988
|
_cloneDeep2 = cloneDeep(params), product_id = _cloneDeep2.product_id, _ignoredIds = _cloneDeep2.product_ids, catalogParams = _objectWithoutProperties(_cloneDeep2, _excluded4);
|
|
3370
3989
|
if (!(!Number.isInteger(product_id) || product_id <= 0)) {
|
|
3371
|
-
|
|
3990
|
+
_context37.next = 3;
|
|
3372
3991
|
break;
|
|
3373
3992
|
}
|
|
3374
|
-
return
|
|
3993
|
+
return _context37.abrupt("return", undefined);
|
|
3375
3994
|
case 3:
|
|
3376
3995
|
schedule_date = catalogParams.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
3377
3996
|
schedule_datetime = catalogParams.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
@@ -3379,19 +3998,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3379
3998
|
schedule_date: schedule_date,
|
|
3380
3999
|
schedule_datetime: schedule_datetime
|
|
3381
4000
|
});
|
|
3382
|
-
|
|
4001
|
+
_context37.next = 8;
|
|
3383
4002
|
return loadSnapshot(scopedParams);
|
|
3384
4003
|
case 8:
|
|
3385
|
-
member =
|
|
4004
|
+
member = _context37.sent.find(function (item) {
|
|
3386
4005
|
return Number(item.id) === product_id;
|
|
3387
4006
|
});
|
|
3388
4007
|
if (member) {
|
|
3389
|
-
|
|
4008
|
+
_context37.next = 11;
|
|
3390
4009
|
break;
|
|
3391
4010
|
}
|
|
3392
|
-
return
|
|
4011
|
+
return _context37.abrupt("return", undefined);
|
|
3393
4012
|
case 11:
|
|
3394
|
-
baseUrl = String(this.request.baseUrl || (isCustomerUserPlatform((_this$
|
|
4013
|
+
baseUrl = String(this.request.baseUrl || (isCustomerUserPlatform((_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.platform) ? '/h5' : '/shop')).replace(/\/+$/, '');
|
|
3395
4014
|
localPath = "/product/query/".concat(product_id);
|
|
3396
4015
|
handledByOsServer = ((_this$core$server = this.core.server) === null || _this$core$server === void 0 || (_this$core$server$has = _this$core$server.hasRoute) === null || _this$core$server$has === void 0 ? void 0 : _this$core$server$has.call(_this$core$server, 'get', "".concat(baseUrl).concat(localPath))) === true;
|
|
3397
4016
|
channelMap = {
|
|
@@ -3401,8 +4020,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3401
4020
|
scan_to_order_2: 'online-store',
|
|
3402
4021
|
scan_to_order_3: 'scantoorder3'
|
|
3403
4022
|
};
|
|
3404
|
-
channel = channelMap[(_this$
|
|
3405
|
-
businessCode = (_this$otherParams$bus3 = (_this$
|
|
4023
|
+
channel = channelMap[(_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.channel] || ((_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.channel);
|
|
4024
|
+
businessCode = (_this$otherParams$bus3 = (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.businessCode) !== null && _this$otherParams$bus3 !== void 0 ? _this$otherParams$bus3 : (_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.business_code;
|
|
3406
4025
|
strategy_context = _objectSpread(_objectSpread(_objectSpread({}, channel ? {
|
|
3407
4026
|
channel: channel
|
|
3408
4027
|
} : {}), businessCode ? {
|
|
@@ -3418,35 +4037,35 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3418
4037
|
open_bundle: 1,
|
|
3419
4038
|
with_schedule: 1,
|
|
3420
4039
|
with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS)
|
|
3421
|
-
}, isCustomerUserPlatform((_this$
|
|
4040
|
+
}, isCustomerUserPlatform((_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.platform) ? {} : {
|
|
3422
4041
|
open_quotation: 1
|
|
3423
4042
|
});
|
|
3424
|
-
|
|
4043
|
+
_context37.next = 23;
|
|
3425
4044
|
return this.request.get(baseUrl === '/shop' ? localPath : "/product/show/".concat(product_id), queryPayload, {
|
|
3426
4045
|
osServer: true,
|
|
3427
4046
|
useCache: false,
|
|
3428
4047
|
customToast: function customToast() {}
|
|
3429
4048
|
});
|
|
3430
4049
|
case 23:
|
|
3431
|
-
response =
|
|
4050
|
+
response = _context37.sent;
|
|
3432
4051
|
if (!((response === null || response === void 0 ? void 0 : response.status) === false || Number(response === null || response === void 0 ? void 0 : response.code) >= 400)) {
|
|
3433
|
-
|
|
4052
|
+
_context37.next = 26;
|
|
3434
4053
|
break;
|
|
3435
4054
|
}
|
|
3436
4055
|
throw new Error('[UnifiedBookingSales] Product detail query failed');
|
|
3437
4056
|
case 26:
|
|
3438
|
-
raw = (_response$data$
|
|
3439
|
-
if (!(!raw || Number((_raw$
|
|
3440
|
-
|
|
4057
|
+
raw = (_response$data$item2 = response === null || response === void 0 || (_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : _response$data3.item) !== null && _response$data$item2 !== void 0 ? _response$data$item2 : response === null || response === void 0 ? void 0 : response.data;
|
|
4058
|
+
if (!(!raw || Number((_raw$id3 = raw.id) !== null && _raw$id3 !== void 0 ? _raw$id3 : raw.product_id) !== product_id)) {
|
|
4059
|
+
_context37.next = 29;
|
|
3441
4060
|
break;
|
|
3442
4061
|
}
|
|
3443
|
-
return
|
|
4062
|
+
return _context37.abrupt("return", undefined);
|
|
3444
4063
|
case 29:
|
|
3445
4064
|
if (!(raw.status && raw.status !== 'published')) {
|
|
3446
|
-
|
|
4065
|
+
_context37.next = 31;
|
|
3447
4066
|
break;
|
|
3448
4067
|
}
|
|
3449
|
-
return
|
|
4068
|
+
return _context37.abrupt("return", undefined);
|
|
3450
4069
|
case 31:
|
|
3451
4070
|
if (!handledByOsServer) (_this$store$products = this.store.products) === null || _this$store$products === void 0 || (_this$store$products$ = _this$store$products.rememberRawProductQueryResult) === null || _this$store$products$ === void 0 || _this$store$products$.call(_this$store$products, [cloneDeep(raw)]);
|
|
3452
4071
|
resolved = resolveClientDataVariants({
|
|
@@ -3457,10 +4076,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3457
4076
|
handledByOsServer: handledByOsServer
|
|
3458
4077
|
})[0]; // Detail owns relation arrays. Never synthesize empty groups from list counts.
|
|
3459
4078
|
if (resolved) {
|
|
3460
|
-
|
|
4079
|
+
_context37.next = 35;
|
|
3461
4080
|
break;
|
|
3462
4081
|
}
|
|
3463
|
-
return
|
|
4082
|
+
return _context37.abrupt("return", undefined);
|
|
3464
4083
|
case 35:
|
|
3465
4084
|
detail = _objectSpread(_objectSpread(_objectSpread({}, member), resolved), {}, {
|
|
3466
4085
|
metadata: _objectSpread(_objectSpread({}, member.metadata || {}), resolved.metadata || {})
|
|
@@ -3469,14 +4088,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3469
4088
|
key = _arr2[_i2];
|
|
3470
4089
|
if (!Object.prototype.hasOwnProperty.call(resolved, key)) delete detail[key];
|
|
3471
4090
|
}
|
|
3472
|
-
return
|
|
4091
|
+
return _context37.abrupt("return", cloneDeep(detail));
|
|
3473
4092
|
case 38:
|
|
3474
4093
|
case "end":
|
|
3475
|
-
return
|
|
4094
|
+
return _context37.stop();
|
|
3476
4095
|
}
|
|
3477
|
-
},
|
|
4096
|
+
}, _callee37, this);
|
|
3478
4097
|
}));
|
|
3479
|
-
function loadCatalogProductDetail(
|
|
4098
|
+
function loadCatalogProductDetail(_x26, _x27) {
|
|
3480
4099
|
return _loadCatalogProductDetail.apply(this, arguments);
|
|
3481
4100
|
}
|
|
3482
4101
|
return loadCatalogProductDetail;
|
|
@@ -3484,21 +4103,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3484
4103
|
}, {
|
|
3485
4104
|
key: "loadCatalogProducts",
|
|
3486
4105
|
value: function () {
|
|
3487
|
-
var _loadCatalogProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4106
|
+
var _loadCatalogProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3488
4107
|
var params,
|
|
3489
4108
|
options,
|
|
3490
4109
|
catalogScope,
|
|
3491
4110
|
schedule_date,
|
|
3492
4111
|
schedule_datetime,
|
|
3493
4112
|
result,
|
|
3494
|
-
|
|
3495
|
-
return _regeneratorRuntime().wrap(function
|
|
3496
|
-
while (1) switch (
|
|
4113
|
+
_args38 = arguments;
|
|
4114
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
4115
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3497
4116
|
case 0:
|
|
3498
|
-
params =
|
|
3499
|
-
options =
|
|
4117
|
+
params = _args38.length > 0 && _args38[0] !== undefined ? _args38[0] : {};
|
|
4118
|
+
options = _args38.length > 1 ? _args38[1] : undefined;
|
|
3500
4119
|
if (this.store.products) {
|
|
3501
|
-
|
|
4120
|
+
_context38.next = 4;
|
|
3502
4121
|
break;
|
|
3503
4122
|
}
|
|
3504
4123
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
@@ -3506,7 +4125,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3506
4125
|
catalogScope = this.otherParams.catalogScopeKey;
|
|
3507
4126
|
schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
3508
4127
|
schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
3509
|
-
|
|
4128
|
+
_context38.next = 9;
|
|
3510
4129
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
3511
4130
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
3512
4131
|
with_schedule: 1
|
|
@@ -3516,21 +4135,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3516
4135
|
cacheId: this.cacheId
|
|
3517
4136
|
}), options);
|
|
3518
4137
|
case 9:
|
|
3519
|
-
result =
|
|
4138
|
+
result = _context38.sent;
|
|
3520
4139
|
if (!(catalogScope !== this.otherParams.catalogScopeKey)) {
|
|
3521
|
-
|
|
4140
|
+
_context38.next = 12;
|
|
3522
4141
|
break;
|
|
3523
4142
|
}
|
|
3524
4143
|
throw Object.assign(new Error('Product scope changed'), {
|
|
3525
4144
|
name: 'AbortError'
|
|
3526
4145
|
});
|
|
3527
4146
|
case 12:
|
|
3528
|
-
return
|
|
4147
|
+
return _context38.abrupt("return", result);
|
|
3529
4148
|
case 13:
|
|
3530
4149
|
case "end":
|
|
3531
|
-
return
|
|
4150
|
+
return _context38.stop();
|
|
3532
4151
|
}
|
|
3533
|
-
},
|
|
4152
|
+
}, _callee38, this);
|
|
3534
4153
|
}));
|
|
3535
4154
|
function loadCatalogProducts() {
|
|
3536
4155
|
return _loadCatalogProducts.apply(this, arguments);
|
|
@@ -3540,25 +4159,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3540
4159
|
}, {
|
|
3541
4160
|
key: "queryProducts",
|
|
3542
4161
|
value: function () {
|
|
3543
|
-
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4162
|
+
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3544
4163
|
var params,
|
|
3545
|
-
|
|
3546
|
-
return _regeneratorRuntime().wrap(function
|
|
3547
|
-
while (1) switch (
|
|
4164
|
+
_args39 = arguments;
|
|
4165
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4166
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3548
4167
|
case 0:
|
|
3549
|
-
params =
|
|
4168
|
+
params = _args39.length > 0 && _args39[0] !== undefined ? _args39[0] : {};
|
|
3550
4169
|
if (this.store.products) {
|
|
3551
|
-
|
|
4170
|
+
_context39.next = 3;
|
|
3552
4171
|
break;
|
|
3553
4172
|
}
|
|
3554
4173
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
3555
4174
|
case 3:
|
|
3556
|
-
return
|
|
4175
|
+
return _context39.abrupt("return", this.store.products.queryProducts(params));
|
|
3557
4176
|
case 4:
|
|
3558
4177
|
case "end":
|
|
3559
|
-
return
|
|
4178
|
+
return _context39.stop();
|
|
3560
4179
|
}
|
|
3561
|
-
},
|
|
4180
|
+
}, _callee39, this);
|
|
3562
4181
|
}));
|
|
3563
4182
|
function queryProducts() {
|
|
3564
4183
|
return _queryProducts.apply(this, arguments);
|
|
@@ -3568,24 +4187,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3568
4187
|
}, {
|
|
3569
4188
|
key: "loadScheduleAvailableDate",
|
|
3570
4189
|
value: (function () {
|
|
3571
|
-
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3572
|
-
return _regeneratorRuntime().wrap(function
|
|
3573
|
-
while (1) switch (
|
|
4190
|
+
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
4191
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4192
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3574
4193
|
case 0:
|
|
3575
4194
|
if (this.store.schedule) {
|
|
3576
|
-
|
|
4195
|
+
_context40.next = 2;
|
|
3577
4196
|
break;
|
|
3578
4197
|
}
|
|
3579
4198
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
3580
4199
|
case 2:
|
|
3581
|
-
return
|
|
4200
|
+
return _context40.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
|
|
3582
4201
|
case 3:
|
|
3583
4202
|
case "end":
|
|
3584
|
-
return
|
|
4203
|
+
return _context40.stop();
|
|
3585
4204
|
}
|
|
3586
|
-
},
|
|
4205
|
+
}, _callee40, this);
|
|
3587
4206
|
}));
|
|
3588
|
-
function loadScheduleAvailableDate(
|
|
4207
|
+
function loadScheduleAvailableDate(_x28) {
|
|
3589
4208
|
return _loadScheduleAvailableDate.apply(this, arguments);
|
|
3590
4209
|
}
|
|
3591
4210
|
return loadScheduleAvailableDate;
|
|
@@ -3599,15 +4218,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3599
4218
|
}, {
|
|
3600
4219
|
key: "loadProductsByScheduleDate",
|
|
3601
4220
|
value: (function () {
|
|
3602
|
-
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4221
|
+
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
3603
4222
|
var _this$store$schedule$, _this$store$schedule, _this$store$schedule$2, _this$store$schedule2, _this$store$schedule$3, _this$store$schedule3, _this$store$schedule$4, _this$store$schedule4;
|
|
3604
|
-
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts,
|
|
3605
|
-
return _regeneratorRuntime().wrap(function
|
|
3606
|
-
while (1) switch (
|
|
4223
|
+
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator3, _step3, _productId, result;
|
|
4224
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4225
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3607
4226
|
case 0:
|
|
3608
4227
|
date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded5);
|
|
3609
4228
|
if (this.store.schedule) {
|
|
3610
|
-
|
|
4229
|
+
_context41.next = 3;
|
|
3611
4230
|
break;
|
|
3612
4231
|
}
|
|
3613
4232
|
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
@@ -3618,10 +4237,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3618
4237
|
});
|
|
3619
4238
|
hasOtherProducts = (((_this$store$schedule$2 = (_this$store$schedule2 = this.store.schedule).getOtherProductsIds) === null || _this$store$schedule$2 === void 0 ? void 0 : _this$store$schedule$2.call(_this$store$schedule2)) || []).length > 0;
|
|
3620
4239
|
if (!(!hasCachedDate && !hasOtherProducts)) {
|
|
3621
|
-
|
|
4240
|
+
_context41.next = 9;
|
|
3622
4241
|
break;
|
|
3623
4242
|
}
|
|
3624
|
-
|
|
4243
|
+
_context41.next = 9;
|
|
3625
4244
|
return this.loadScheduleAvailableDate({
|
|
3626
4245
|
startDate: date,
|
|
3627
4246
|
endDate: date,
|
|
@@ -3641,45 +4260,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3641
4260
|
return !productIdFilter || productIdFilter.has(String(id));
|
|
3642
4261
|
});
|
|
3643
4262
|
if (availableProductIds.length) {
|
|
3644
|
-
|
|
4263
|
+
_context41.next = 17;
|
|
3645
4264
|
break;
|
|
3646
4265
|
}
|
|
3647
4266
|
this.unifiedProductCatalog = [];
|
|
3648
|
-
|
|
4267
|
+
_context41.next = 16;
|
|
3649
4268
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
|
|
3650
4269
|
case 16:
|
|
3651
|
-
return
|
|
4270
|
+
return _context41.abrupt("return", []);
|
|
3652
4271
|
case 17:
|
|
3653
|
-
|
|
4272
|
+
_context41.next = 19;
|
|
3654
4273
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
3655
4274
|
product_ids: availableProductIds,
|
|
3656
4275
|
schedule_date: date
|
|
3657
4276
|
}));
|
|
3658
4277
|
case 19:
|
|
3659
|
-
products =
|
|
4278
|
+
products = _context41.sent;
|
|
3660
4279
|
if (!(products.length || availableProductIds.length <= 1)) {
|
|
3661
|
-
|
|
4280
|
+
_context41.next = 22;
|
|
3662
4281
|
break;
|
|
3663
4282
|
}
|
|
3664
|
-
return
|
|
4283
|
+
return _context41.abrupt("return", products);
|
|
3665
4284
|
case 22:
|
|
3666
4285
|
fallbackProducts = [];
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
4286
|
+
_iterator3 = _createForOfIteratorHelper(availableProductIds);
|
|
4287
|
+
_context41.prev = 24;
|
|
4288
|
+
_iterator3.s();
|
|
3670
4289
|
case 26:
|
|
3671
|
-
if ((
|
|
3672
|
-
|
|
4290
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
4291
|
+
_context41.next = 34;
|
|
3673
4292
|
break;
|
|
3674
4293
|
}
|
|
3675
|
-
|
|
3676
|
-
|
|
4294
|
+
_productId = _step3.value;
|
|
4295
|
+
_context41.next = 30;
|
|
3677
4296
|
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
3678
|
-
product_ids: [
|
|
4297
|
+
product_ids: [_productId],
|
|
3679
4298
|
schedule_date: date
|
|
3680
4299
|
}));
|
|
3681
4300
|
case 30:
|
|
3682
|
-
result =
|
|
4301
|
+
result = _context41.sent;
|
|
3683
4302
|
result.forEach(function (product) {
|
|
3684
4303
|
var _id;
|
|
3685
4304
|
var id = (_id = product === null || product === void 0 ? void 0 : product.id) !== null && _id !== void 0 ? _id : product === null || product === void 0 ? void 0 : product.product_id;
|
|
@@ -3691,32 +4310,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3691
4310
|
}
|
|
3692
4311
|
});
|
|
3693
4312
|
case 32:
|
|
3694
|
-
|
|
4313
|
+
_context41.next = 26;
|
|
3695
4314
|
break;
|
|
3696
4315
|
case 34:
|
|
3697
|
-
|
|
4316
|
+
_context41.next = 39;
|
|
3698
4317
|
break;
|
|
3699
4318
|
case 36:
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
4319
|
+
_context41.prev = 36;
|
|
4320
|
+
_context41.t0 = _context41["catch"](24);
|
|
4321
|
+
_iterator3.e(_context41.t0);
|
|
3703
4322
|
case 39:
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
return
|
|
4323
|
+
_context41.prev = 39;
|
|
4324
|
+
_iterator3.f();
|
|
4325
|
+
return _context41.finish(39);
|
|
3707
4326
|
case 42:
|
|
3708
4327
|
this.unifiedProductCatalog = [].concat(fallbackProducts);
|
|
3709
|
-
|
|
4328
|
+
_context41.next = 45;
|
|
3710
4329
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
|
|
3711
4330
|
case 45:
|
|
3712
|
-
return
|
|
4331
|
+
return _context41.abrupt("return", fallbackProducts);
|
|
3713
4332
|
case 46:
|
|
3714
4333
|
case "end":
|
|
3715
|
-
return
|
|
4334
|
+
return _context41.stop();
|
|
3716
4335
|
}
|
|
3717
|
-
},
|
|
4336
|
+
}, _callee41, this, [[24, 36, 39, 42]]);
|
|
3718
4337
|
}));
|
|
3719
|
-
function loadProductsByScheduleDate(
|
|
4338
|
+
function loadProductsByScheduleDate(_x29) {
|
|
3720
4339
|
return _loadProductsByScheduleDate.apply(this, arguments);
|
|
3721
4340
|
}
|
|
3722
4341
|
return loadProductsByScheduleDate;
|
|
@@ -3769,7 +4388,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3769
4388
|
}, {
|
|
3770
4389
|
key: "applyPlannerDiscounts",
|
|
3771
4390
|
value: (function () {
|
|
3772
|
-
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4391
|
+
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3773
4392
|
var _params$customerId;
|
|
3774
4393
|
var params,
|
|
3775
4394
|
tempOrder,
|
|
@@ -3781,29 +4400,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3781
4400
|
preferredDiscount,
|
|
3782
4401
|
preferredId,
|
|
3783
4402
|
selectedOtherDiscounts,
|
|
3784
|
-
|
|
3785
|
-
|
|
4403
|
+
_iterator4,
|
|
4404
|
+
_step4,
|
|
3786
4405
|
discount,
|
|
3787
4406
|
discountId,
|
|
3788
4407
|
nextTempOrder,
|
|
3789
|
-
|
|
3790
|
-
return _regeneratorRuntime().wrap(function
|
|
3791
|
-
while (1) switch (
|
|
4408
|
+
_args42 = arguments;
|
|
4409
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4410
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3792
4411
|
case 0:
|
|
3793
|
-
params =
|
|
4412
|
+
params = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
|
|
3794
4413
|
tempOrder = this.getTempOrder();
|
|
3795
4414
|
requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
3796
4415
|
parsedCustomerId = Number(requestedCustomerId);
|
|
3797
4416
|
customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
|
|
3798
|
-
|
|
4417
|
+
_context42.next = 7;
|
|
3799
4418
|
return this.getSummary();
|
|
3800
4419
|
case 7:
|
|
3801
|
-
summaryBefore =
|
|
4420
|
+
summaryBefore = _context42.sent;
|
|
3802
4421
|
if (customerId) {
|
|
3803
|
-
|
|
4422
|
+
_context42.next = 10;
|
|
3804
4423
|
break;
|
|
3805
4424
|
}
|
|
3806
|
-
return
|
|
4425
|
+
return _context42.abrupt("return", buildPlannerDiscountResult({
|
|
3807
4426
|
customerId: null,
|
|
3808
4427
|
discountList: this.getDiscountList(),
|
|
3809
4428
|
products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
|
|
@@ -3812,7 +4431,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3812
4431
|
status: 'no_customer'
|
|
3813
4432
|
}));
|
|
3814
4433
|
case 10:
|
|
3815
|
-
|
|
4434
|
+
_context42.next = 12;
|
|
3816
4435
|
return this.loadDiscountConfig({
|
|
3817
4436
|
customerId: customerId,
|
|
3818
4437
|
action: 'create'
|
|
@@ -3824,7 +4443,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3824
4443
|
return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
|
|
3825
4444
|
});
|
|
3826
4445
|
if (!preferredDiscount) {
|
|
3827
|
-
|
|
4446
|
+
_context42.next = 40;
|
|
3828
4447
|
break;
|
|
3829
4448
|
}
|
|
3830
4449
|
// A requested card is an explicit UI choice, not a best-effort preference. Clear prior
|
|
@@ -3835,99 +4454,99 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3835
4454
|
var _resolvePlannerDiscou2;
|
|
3836
4455
|
return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
|
|
3837
4456
|
});
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
4457
|
+
_iterator4 = _createForOfIteratorHelper(selectedOtherDiscounts);
|
|
4458
|
+
_context42.prev = 18;
|
|
4459
|
+
_iterator4.s();
|
|
3841
4460
|
case 20:
|
|
3842
|
-
if ((
|
|
3843
|
-
|
|
4461
|
+
if ((_step4 = _iterator4.n()).done) {
|
|
4462
|
+
_context42.next = 28;
|
|
3844
4463
|
break;
|
|
3845
4464
|
}
|
|
3846
|
-
discount =
|
|
4465
|
+
discount = _step4.value;
|
|
3847
4466
|
discountId = Number(resolvePlannerDiscountId(discount));
|
|
3848
4467
|
if (!Number.isFinite(discountId)) {
|
|
3849
|
-
|
|
4468
|
+
_context42.next = 26;
|
|
3850
4469
|
break;
|
|
3851
4470
|
}
|
|
3852
|
-
|
|
4471
|
+
_context42.next = 26;
|
|
3853
4472
|
return this.setDiscountSelected({
|
|
3854
4473
|
discountId: discountId,
|
|
3855
4474
|
isSelected: false
|
|
3856
4475
|
});
|
|
3857
4476
|
case 26:
|
|
3858
|
-
|
|
4477
|
+
_context42.next = 20;
|
|
3859
4478
|
break;
|
|
3860
4479
|
case 28:
|
|
3861
|
-
|
|
4480
|
+
_context42.next = 33;
|
|
3862
4481
|
break;
|
|
3863
4482
|
case 30:
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
4483
|
+
_context42.prev = 30;
|
|
4484
|
+
_context42.t0 = _context42["catch"](18);
|
|
4485
|
+
_iterator4.e(_context42.t0);
|
|
3867
4486
|
case 33:
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
return
|
|
4487
|
+
_context42.prev = 33;
|
|
4488
|
+
_iterator4.f();
|
|
4489
|
+
return _context42.finish(33);
|
|
3871
4490
|
case 36:
|
|
3872
|
-
|
|
4491
|
+
_context42.next = 38;
|
|
3873
4492
|
return this.setDiscountSelected({
|
|
3874
4493
|
discountId: Number(preferredId),
|
|
3875
4494
|
isSelected: true
|
|
3876
4495
|
});
|
|
3877
4496
|
case 38:
|
|
3878
|
-
|
|
4497
|
+
_context42.next = 49;
|
|
3879
4498
|
break;
|
|
3880
4499
|
case 40:
|
|
3881
4500
|
if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
|
|
3882
|
-
|
|
4501
|
+
_context42.next = 46;
|
|
3883
4502
|
break;
|
|
3884
4503
|
}
|
|
3885
4504
|
if (!(params.applyBestDiscount !== false)) {
|
|
3886
|
-
|
|
4505
|
+
_context42.next = 44;
|
|
3887
4506
|
break;
|
|
3888
4507
|
}
|
|
3889
|
-
|
|
4508
|
+
_context42.next = 44;
|
|
3890
4509
|
return this.bestDiscount();
|
|
3891
4510
|
case 44:
|
|
3892
|
-
|
|
4511
|
+
_context42.next = 49;
|
|
3893
4512
|
break;
|
|
3894
4513
|
case 46:
|
|
3895
4514
|
if (!(params.applyBestDiscount !== false)) {
|
|
3896
|
-
|
|
4515
|
+
_context42.next = 49;
|
|
3897
4516
|
break;
|
|
3898
4517
|
}
|
|
3899
|
-
|
|
4518
|
+
_context42.next = 49;
|
|
3900
4519
|
return this.bestDiscount();
|
|
3901
4520
|
case 49:
|
|
3902
4521
|
nextTempOrder = this.getTempOrder();
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
4522
|
+
_context42.t1 = buildPlannerDiscountResult;
|
|
4523
|
+
_context42.t2 = customerId;
|
|
4524
|
+
_context42.t3 = this.getDiscountList();
|
|
4525
|
+
_context42.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
|
|
4526
|
+
_context42.t5 = summaryBefore;
|
|
4527
|
+
_context42.next = 57;
|
|
3909
4528
|
return this.getSummary();
|
|
3910
4529
|
case 57:
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
customerId:
|
|
3917
|
-
discountList:
|
|
3918
|
-
products:
|
|
3919
|
-
summaryBefore:
|
|
3920
|
-
summaryAfter:
|
|
3921
|
-
status:
|
|
3922
|
-
preferredDiscountId:
|
|
3923
|
-
preferredDiscountFound:
|
|
4530
|
+
_context42.t6 = _context42.sent;
|
|
4531
|
+
_context42.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
|
|
4532
|
+
_context42.t8 = preferredDiscountId;
|
|
4533
|
+
_context42.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
|
|
4534
|
+
_context42.t10 = {
|
|
4535
|
+
customerId: _context42.t2,
|
|
4536
|
+
discountList: _context42.t3,
|
|
4537
|
+
products: _context42.t4,
|
|
4538
|
+
summaryBefore: _context42.t5,
|
|
4539
|
+
summaryAfter: _context42.t6,
|
|
4540
|
+
status: _context42.t7,
|
|
4541
|
+
preferredDiscountId: _context42.t8,
|
|
4542
|
+
preferredDiscountFound: _context42.t9
|
|
3924
4543
|
};
|
|
3925
|
-
return
|
|
4544
|
+
return _context42.abrupt("return", (0, _context42.t1)(_context42.t10));
|
|
3926
4545
|
case 63:
|
|
3927
4546
|
case "end":
|
|
3928
|
-
return
|
|
4547
|
+
return _context42.stop();
|
|
3929
4548
|
}
|
|
3930
|
-
},
|
|
4549
|
+
}, _callee42, this, [[18, 30, 33, 36]]);
|
|
3931
4550
|
}));
|
|
3932
4551
|
function applyPlannerDiscounts() {
|
|
3933
4552
|
return _applyPlannerDiscounts.apply(this, arguments);
|
|
@@ -3937,16 +4556,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3937
4556
|
}, {
|
|
3938
4557
|
key: "buildUnifiedOrderProduct",
|
|
3939
4558
|
value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
|
|
3940
|
-
var
|
|
4559
|
+
var _ref47, _sourceProduct$_exten, _sourceProduct$_exten2, _sourceProduct$metada, _sourceProduct$id, _ref48, _sourceProduct$produc, _ref49, _ref50, _sourceProduct$quanti, _sourceProduct$price, _ref51, _ref52, _sourceProduct$sellin;
|
|
3941
4560
|
var normalizedProductRaw = (product === null || product === void 0 ? void 0 : product.raw) || {};
|
|
3942
|
-
var quotationShelfId = (
|
|
4561
|
+
var quotationShelfId = (_ref47 = (_sourceProduct$_exten = (_sourceProduct$_exten2 = sourceProduct._extend) === null || _sourceProduct$_exten2 === void 0 ? void 0 : _sourceProduct$_exten2.quotation_shelf_id) !== null && _sourceProduct$_exten !== void 0 ? _sourceProduct$_exten : sourceProduct.quotation_shelf_id) !== null && _ref47 !== void 0 ? _ref47 : (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.quotation_shelf_id;
|
|
3943
4562
|
var orderProduct = this.transformBaseProductToOrderProduct({
|
|
3944
4563
|
payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
|
|
3945
4564
|
id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
|
|
3946
|
-
product_id: (
|
|
3947
|
-
quantity: (
|
|
4565
|
+
product_id: (_ref48 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref48 !== void 0 ? _ref48 : product === null || product === void 0 ? void 0 : product.id,
|
|
4566
|
+
quantity: (_ref49 = (_ref50 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref50 !== void 0 ? _ref50 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref49 !== void 0 ? _ref49 : 1,
|
|
3948
4567
|
price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : normalizedProductRaw.price,
|
|
3949
|
-
selling_price: (
|
|
4568
|
+
selling_price: (_ref51 = (_ref52 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref52 !== void 0 ? _ref52 : normalizedProductRaw.selling_price) !== null && _ref51 !== void 0 ? _ref51 : normalizedProductRaw.price,
|
|
3950
4569
|
metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
|
|
3951
4570
|
}),
|
|
3952
4571
|
sourceProduct: sourceProduct
|
|
@@ -3971,29 +4590,29 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
3971
4590
|
}, {
|
|
3972
4591
|
key: "removeExistingStagedLines",
|
|
3973
4592
|
value: (function () {
|
|
3974
|
-
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4593
|
+
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(ownershipKey) {
|
|
3975
4594
|
var _this$getTempOrder2;
|
|
3976
4595
|
var existingLines;
|
|
3977
|
-
return _regeneratorRuntime().wrap(function
|
|
3978
|
-
while (1) switch (
|
|
4596
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4597
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3979
4598
|
case 0:
|
|
3980
4599
|
existingLines = (((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.products) || []).filter(function (product) {
|
|
3981
4600
|
var _product$metadata5;
|
|
3982
4601
|
return (product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5[ownershipKey]) === true;
|
|
3983
4602
|
});
|
|
3984
4603
|
if (!(existingLines.length > 0)) {
|
|
3985
|
-
|
|
4604
|
+
_context43.next = 4;
|
|
3986
4605
|
break;
|
|
3987
4606
|
}
|
|
3988
|
-
|
|
4607
|
+
_context43.next = 4;
|
|
3989
4608
|
return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
|
|
3990
4609
|
case 4:
|
|
3991
4610
|
case "end":
|
|
3992
|
-
return
|
|
4611
|
+
return _context43.stop();
|
|
3993
4612
|
}
|
|
3994
|
-
},
|
|
4613
|
+
}, _callee43, this);
|
|
3995
4614
|
}));
|
|
3996
|
-
function removeExistingStagedLines(
|
|
4615
|
+
function removeExistingStagedLines(_x30) {
|
|
3997
4616
|
return _removeExistingStagedLines.apply(this, arguments);
|
|
3998
4617
|
}
|
|
3999
4618
|
return removeExistingStagedLines;
|
|
@@ -4001,80 +4620,80 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4001
4620
|
}, {
|
|
4002
4621
|
key: "stageProducts",
|
|
4003
4622
|
value: function () {
|
|
4004
|
-
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4623
|
+
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params, ownershipKey) {
|
|
4005
4624
|
var _params$rawProducts;
|
|
4006
4625
|
var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i3, _arr3, sourceProduct, productInput;
|
|
4007
|
-
return _regeneratorRuntime().wrap(function
|
|
4008
|
-
while (1) switch (
|
|
4626
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4627
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4009
4628
|
case 0:
|
|
4010
4629
|
productIds = params.productIds || [];
|
|
4011
4630
|
if (productIds.length) {
|
|
4012
|
-
|
|
4631
|
+
_context44.next = 3;
|
|
4013
4632
|
break;
|
|
4014
4633
|
}
|
|
4015
|
-
return
|
|
4634
|
+
return _context44.abrupt("return", this.getTempOrder());
|
|
4016
4635
|
case 3:
|
|
4017
4636
|
if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
|
|
4018
|
-
|
|
4637
|
+
_context44.next = 7;
|
|
4019
4638
|
break;
|
|
4020
4639
|
}
|
|
4021
4640
|
this.unifiedProductCatalog = params.rawProducts;
|
|
4022
|
-
|
|
4641
|
+
_context44.next = 12;
|
|
4023
4642
|
break;
|
|
4024
4643
|
case 7:
|
|
4025
4644
|
existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
|
|
4026
|
-
var _product$
|
|
4027
|
-
return String((_product$
|
|
4645
|
+
var _product$id2;
|
|
4646
|
+
return String((_product$id2 = product.id) !== null && _product$id2 !== void 0 ? _product$id2 : product.product_id);
|
|
4028
4647
|
}));
|
|
4029
4648
|
missingIds = productIds.filter(function (id) {
|
|
4030
4649
|
return !existingIds.has(String(id));
|
|
4031
4650
|
});
|
|
4032
4651
|
if (!(missingIds.length || params.productLoadParams)) {
|
|
4033
|
-
|
|
4652
|
+
_context44.next = 12;
|
|
4034
4653
|
break;
|
|
4035
4654
|
}
|
|
4036
|
-
|
|
4655
|
+
_context44.next = 12;
|
|
4037
4656
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
4038
4657
|
product_ids: productIds.map(Number).filter(Number.isFinite)
|
|
4039
4658
|
}));
|
|
4040
4659
|
case 12:
|
|
4041
|
-
|
|
4660
|
+
_context44.next = 14;
|
|
4042
4661
|
return this.removeExistingStagedLines(ownershipKey);
|
|
4043
4662
|
case 14:
|
|
4044
4663
|
productIdSet = new Set(productIds.map(function (id) {
|
|
4045
4664
|
return String(id);
|
|
4046
4665
|
}));
|
|
4047
4666
|
selectedProducts = (this.unifiedProductCatalog || []).filter(function (product) {
|
|
4048
|
-
var _product$
|
|
4049
|
-
return productIdSet.has(String((_product$
|
|
4667
|
+
var _product$id3;
|
|
4668
|
+
return productIdSet.has(String((_product$id3 = product.id) !== null && _product$id3 !== void 0 ? _product$id3 : product.product_id));
|
|
4050
4669
|
});
|
|
4051
4670
|
_i3 = 0, _arr3 = selectedProducts;
|
|
4052
4671
|
case 17:
|
|
4053
4672
|
if (!(_i3 < _arr3.length)) {
|
|
4054
|
-
|
|
4673
|
+
_context44.next = 26;
|
|
4055
4674
|
break;
|
|
4056
4675
|
}
|
|
4057
4676
|
sourceProduct = _arr3[_i3];
|
|
4058
4677
|
productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
|
|
4059
4678
|
if (!productInput) {
|
|
4060
|
-
|
|
4679
|
+
_context44.next = 23;
|
|
4061
4680
|
break;
|
|
4062
4681
|
}
|
|
4063
|
-
|
|
4682
|
+
_context44.next = 23;
|
|
4064
4683
|
return this.addProductToOrder(productInput);
|
|
4065
4684
|
case 23:
|
|
4066
4685
|
_i3++;
|
|
4067
|
-
|
|
4686
|
+
_context44.next = 17;
|
|
4068
4687
|
break;
|
|
4069
4688
|
case 26:
|
|
4070
|
-
return
|
|
4689
|
+
return _context44.abrupt("return", this.getTempOrder());
|
|
4071
4690
|
case 27:
|
|
4072
4691
|
case "end":
|
|
4073
|
-
return
|
|
4692
|
+
return _context44.stop();
|
|
4074
4693
|
}
|
|
4075
|
-
},
|
|
4694
|
+
}, _callee44, this);
|
|
4076
4695
|
}));
|
|
4077
|
-
function stageProducts(
|
|
4696
|
+
function stageProducts(_x31, _x32) {
|
|
4078
4697
|
return _stageProducts.apply(this, arguments);
|
|
4079
4698
|
}
|
|
4080
4699
|
return stageProducts;
|
|
@@ -4086,18 +4705,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4086
4705
|
}, {
|
|
4087
4706
|
key: "stageRetailProducts",
|
|
4088
4707
|
value: (function () {
|
|
4089
|
-
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4090
|
-
return _regeneratorRuntime().wrap(function
|
|
4091
|
-
while (1) switch (
|
|
4708
|
+
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
4709
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4710
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4092
4711
|
case 0:
|
|
4093
|
-
return
|
|
4712
|
+
return _context45.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
|
|
4094
4713
|
case 1:
|
|
4095
4714
|
case "end":
|
|
4096
|
-
return
|
|
4715
|
+
return _context45.stop();
|
|
4097
4716
|
}
|
|
4098
|
-
},
|
|
4717
|
+
}, _callee45, this);
|
|
4099
4718
|
}));
|
|
4100
|
-
function stageRetailProducts(
|
|
4719
|
+
function stageRetailProducts(_x33) {
|
|
4101
4720
|
return _stageRetailProducts.apply(this, arguments);
|
|
4102
4721
|
}
|
|
4103
4722
|
return stageRetailProducts;
|
|
@@ -4116,51 +4735,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4116
4735
|
}, {
|
|
4117
4736
|
key: "addRetailProduct",
|
|
4118
4737
|
value: (function () {
|
|
4119
|
-
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4738
|
+
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
4120
4739
|
var _params$quantity,
|
|
4121
|
-
|
|
4740
|
+
_ref53,
|
|
4122
4741
|
_params$productId,
|
|
4123
4742
|
_params$product,
|
|
4124
4743
|
_params$product2,
|
|
4125
4744
|
_metadata2,
|
|
4126
|
-
|
|
4745
|
+
_this16 = this,
|
|
4127
4746
|
_metadata3;
|
|
4128
4747
|
var quantity, productId, sourceProduct, products, orderProduct, order, meta, scopeKey, purchaseDatetime, identity, isCurrentOrder, guard, _order, _meta, parentUid, _scopeKey, _purchaseDatetime, normalizedPurchaseDatetime, _identity, _isCurrentOrder, _guard;
|
|
4129
|
-
return _regeneratorRuntime().wrap(function
|
|
4130
|
-
while (1) switch (
|
|
4748
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4749
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4131
4750
|
case 0:
|
|
4132
4751
|
quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
|
|
4133
4752
|
if (!(!Number.isFinite(quantity) || quantity <= 0)) {
|
|
4134
|
-
|
|
4753
|
+
_context46.next = 3;
|
|
4135
4754
|
break;
|
|
4136
4755
|
}
|
|
4137
4756
|
throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
|
|
4138
4757
|
case 3:
|
|
4139
|
-
productId = (
|
|
4758
|
+
productId = (_ref53 = (_params$productId = params.productId) !== null && _params$productId !== void 0 ? _params$productId : (_params$product = params.product) === null || _params$product === void 0 ? void 0 : _params$product.id) !== null && _ref53 !== void 0 ? _ref53 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
|
|
4140
4759
|
sourceProduct = params.product;
|
|
4141
4760
|
if (!sourceProduct && productId !== undefined && productId !== null) {
|
|
4142
4761
|
sourceProduct = this.unifiedProductCatalog.find(function (product) {
|
|
4143
|
-
var _product$
|
|
4144
|
-
return String((_product$
|
|
4762
|
+
var _product$id4;
|
|
4763
|
+
return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
|
|
4145
4764
|
});
|
|
4146
4765
|
}
|
|
4147
4766
|
if (!(!sourceProduct && productId !== undefined && productId !== null)) {
|
|
4148
|
-
|
|
4767
|
+
_context46.next = 11;
|
|
4149
4768
|
break;
|
|
4150
4769
|
}
|
|
4151
|
-
|
|
4770
|
+
_context46.next = 9;
|
|
4152
4771
|
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
4153
4772
|
product_ids: [Number(productId)].filter(Number.isFinite)
|
|
4154
4773
|
}));
|
|
4155
4774
|
case 9:
|
|
4156
|
-
products =
|
|
4775
|
+
products = _context46.sent;
|
|
4157
4776
|
sourceProduct = products.find(function (product) {
|
|
4158
|
-
var _product$
|
|
4159
|
-
return String((_product$
|
|
4777
|
+
var _product$id5;
|
|
4778
|
+
return String((_product$id5 = product.id) !== null && _product$id5 !== void 0 ? _product$id5 : product.product_id) === String(productId);
|
|
4160
4779
|
});
|
|
4161
4780
|
case 11:
|
|
4162
4781
|
if (sourceProduct) {
|
|
4163
|
-
|
|
4782
|
+
_context46.next = 13;
|
|
4164
4783
|
break;
|
|
4165
4784
|
}
|
|
4166
4785
|
throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
|
|
@@ -4169,13 +4788,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4169
4788
|
quantity: quantity
|
|
4170
4789
|
}), 'unified_booking_sales_retail');
|
|
4171
4790
|
if (orderProduct) {
|
|
4172
|
-
|
|
4791
|
+
_context46.next = 16;
|
|
4173
4792
|
break;
|
|
4174
4793
|
}
|
|
4175
4794
|
throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
|
|
4176
4795
|
case 16:
|
|
4177
4796
|
if (!(((_metadata2 = orderProduct.metadata) === null || _metadata2 === void 0 ? void 0 : _metadata2.venue_booking_role) === 'tickets_extra')) {
|
|
4178
|
-
|
|
4797
|
+
_context46.next = 31;
|
|
4179
4798
|
break;
|
|
4180
4799
|
}
|
|
4181
4800
|
order = this.getTempOrder();
|
|
@@ -4184,7 +4803,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4184
4803
|
purchaseDatetime = String(meta.venue_booking_service_datetime || '');
|
|
4185
4804
|
identity = [order === null || order === void 0 ? void 0 : order.order_id, order === null || order === void 0 ? void 0 : order.external_sale_number, order === null || order === void 0 ? void 0 : order.customer_id];
|
|
4186
4805
|
isCurrentOrder = function isCurrentOrder() {
|
|
4187
|
-
return
|
|
4806
|
+
return _this16.getTempOrder() === order && (order === null || order === void 0 ? void 0 : order.order_id) === identity[0] && (order === null || order === void 0 ? void 0 : order.external_sale_number) === identity[1] && (order === null || order === void 0 ? void 0 : order.customer_id) === identity[2];
|
|
4188
4807
|
};
|
|
4189
4808
|
guard = function guard() {
|
|
4190
4809
|
var _params$availabilityC;
|
|
@@ -4193,7 +4812,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4193
4812
|
var _line$metadata, _line$metadata2;
|
|
4194
4813
|
return ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata.venue_booking_role) === 'tickets' && ((_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.venue_booking_scope_key) === scopeKey;
|
|
4195
4814
|
})) {
|
|
4196
|
-
throw
|
|
4815
|
+
throw _this16.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '门票订单或购买时间已变化,请重新确认附加商品');
|
|
4197
4816
|
}
|
|
4198
4817
|
};
|
|
4199
4818
|
guard();
|
|
@@ -4209,7 +4828,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4209
4828
|
status: 'disable',
|
|
4210
4829
|
required: 0
|
|
4211
4830
|
};
|
|
4212
|
-
return
|
|
4831
|
+
return _context46.abrupt("return", this.addProductToOrder(orderProduct, undefined, {
|
|
4213
4832
|
disableMerge: true,
|
|
4214
4833
|
availabilityCommitGuard: guard,
|
|
4215
4834
|
availabilityCommitTargetGuard: isCurrentOrder,
|
|
@@ -4217,7 +4836,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4217
4836
|
}));
|
|
4218
4837
|
case 31:
|
|
4219
4838
|
if (!(((_metadata3 = orderProduct.metadata) === null || _metadata3 === void 0 ? void 0 : _metadata3.venue_booking_role) === 'party_extra')) {
|
|
4220
|
-
|
|
4839
|
+
_context46.next = 47;
|
|
4221
4840
|
break;
|
|
4222
4841
|
}
|
|
4223
4842
|
_order = this.getTempOrder();
|
|
@@ -4229,7 +4848,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4229
4848
|
normalizedPurchaseDatetime = _purchaseDatetime.length === 16 ? "".concat(_purchaseDatetime, ":00") : _purchaseDatetime;
|
|
4230
4849
|
_identity = [_order === null || _order === void 0 ? void 0 : _order.order_id, _order === null || _order === void 0 ? void 0 : _order.external_sale_number];
|
|
4231
4850
|
_isCurrentOrder = function _isCurrentOrder() {
|
|
4232
|
-
return
|
|
4851
|
+
return _this16.getTempOrder() === _order && (_order === null || _order === void 0 ? void 0 : _order.order_id) === _identity[0] && (_order === null || _order === void 0 ? void 0 : _order.external_sale_number) === _identity[1];
|
|
4233
4852
|
};
|
|
4234
4853
|
_guard = function _guard() {
|
|
4235
4854
|
var _params$availabilityC2, _parent$metadata, _parent$metadata2;
|
|
@@ -4237,7 +4856,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4237
4856
|
var parent = ((_order === null || _order === void 0 ? void 0 : _order.products) || []).find(function (line) {
|
|
4238
4857
|
return getProductLineUid(line) === parentUid;
|
|
4239
4858
|
});
|
|
4240
|
-
if (!_isCurrentOrder() || !_order || _order.order_id || !parentUid || !_scopeKey || (parent === null || parent === void 0 || (_parent$metadata = parent.metadata) === null || _parent$metadata === void 0 ? void 0 : _parent$metadata.venue_booking_role) !== 'party_main' || (parent === null || parent === void 0 || (_parent$metadata2 = parent.metadata) === null || _parent$metadata2 === void 0 ? void 0 : _parent$metadata2.venue_booking_scope_key) !== _scopeKey || !/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?$/.test(_purchaseDatetime) || !dayjs(_purchaseDatetime).isValid() || dayjs(_purchaseDatetime).format('YYYY-MM-DD HH:mm:ss') !== normalizedPurchaseDatetime) throw
|
|
4859
|
+
if (!_isCurrentOrder() || !_order || _order.order_id || !parentUid || !_scopeKey || (parent === null || parent === void 0 || (_parent$metadata = parent.metadata) === null || _parent$metadata === void 0 ? void 0 : _parent$metadata.venue_booking_role) !== 'party_main' || (parent === null || parent === void 0 || (_parent$metadata2 = parent.metadata) === null || _parent$metadata2 === void 0 ? void 0 : _parent$metadata2.venue_booking_scope_key) !== _scopeKey || !/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?$/.test(_purchaseDatetime) || !dayjs(_purchaseDatetime).isValid() || dayjs(_purchaseDatetime).format('YYYY-MM-DD HH:mm:ss') !== normalizedPurchaseDatetime) throw _this16.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'Party 主商品或附加商品报价上下文已变化,请重新确认附加商品');
|
|
4241
4860
|
};
|
|
4242
4861
|
_guard();
|
|
4243
4862
|
delete orderProduct.unique_identification_number;
|
|
@@ -4250,25 +4869,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4250
4869
|
status: 'disable',
|
|
4251
4870
|
required: 0
|
|
4252
4871
|
};
|
|
4253
|
-
return
|
|
4872
|
+
return _context46.abrupt("return", this.addProductToOrder(orderProduct, undefined, {
|
|
4254
4873
|
disableMerge: true,
|
|
4255
4874
|
availabilityCommitGuard: _guard,
|
|
4256
4875
|
availabilityCommitTargetGuard: _isCurrentOrder,
|
|
4257
4876
|
salesNotes: params.salesNotes
|
|
4258
4877
|
}));
|
|
4259
4878
|
case 47:
|
|
4260
|
-
return
|
|
4879
|
+
return _context46.abrupt("return", this.addProductToOrder(orderProduct, undefined, _objectSpread(_objectSpread({}, params.availabilityCommitGuard ? {
|
|
4261
4880
|
availabilityCommitGuard: params.availabilityCommitGuard
|
|
4262
4881
|
} : {}), params.salesNotes ? {
|
|
4263
4882
|
salesNotes: params.salesNotes
|
|
4264
4883
|
} : {})));
|
|
4265
4884
|
case 48:
|
|
4266
4885
|
case "end":
|
|
4267
|
-
return
|
|
4886
|
+
return _context46.stop();
|
|
4268
4887
|
}
|
|
4269
|
-
},
|
|
4888
|
+
}, _callee46, this);
|
|
4270
4889
|
}));
|
|
4271
|
-
function addRetailProduct(
|
|
4890
|
+
function addRetailProduct(_x34) {
|
|
4272
4891
|
return _addRetailProduct.apply(this, arguments);
|
|
4273
4892
|
}
|
|
4274
4893
|
return addRetailProduct;
|
|
@@ -4323,6 +4942,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4323
4942
|
key: "assertAvailabilityPrepareParams",
|
|
4324
4943
|
value: function assertAvailabilityPrepareParams(params) {
|
|
4325
4944
|
var _params$dateRange3, _params$dateRange4;
|
|
4945
|
+
if (params.occupancyCachePolicy !== undefined && params.occupancyCachePolicy !== 'cache_first' && params.occupancyCachePolicy !== 'session') {
|
|
4946
|
+
throw new AvailabilityError('INVALID_TARGET_FILTER', 'Unknown occupancyCachePolicy');
|
|
4947
|
+
}
|
|
4326
4948
|
assertAvailabilityCatalogProductIds(params.productIds, 'prepare.productIds');
|
|
4327
4949
|
var hasProductAnchor = Array.isArray(params.productIds) && params.productIds.length > 0;
|
|
4328
4950
|
var hasResourceAnchor = Array.isArray(params.resourceIds) && params.resourceIds.length > 0;
|
|
@@ -4368,7 +4990,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4368
4990
|
}, {
|
|
4369
4991
|
key: "buildAvailabilityOperatingHoursSnapshot",
|
|
4370
4992
|
value: function buildAvailabilityOperatingHoursSnapshot(params) {
|
|
4371
|
-
var
|
|
4993
|
+
var _this17 = this;
|
|
4372
4994
|
var descriptor = params.prepare._availabilityOperatingHours || {
|
|
4373
4995
|
source: params.prepare.businessHours ? 'prepare_business_hours' : 'default_business_hours',
|
|
4374
4996
|
scheduleIds: []
|
|
@@ -4378,7 +5000,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4378
5000
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4379
5001
|
startAt: "".concat(date, "T").concat(params.businessHours.startTime, ":00"),
|
|
4380
5002
|
endAt: "".concat(date, "T").concat(params.businessHours.endTime, ":00"),
|
|
4381
|
-
fixedOffsetMinutes:
|
|
5003
|
+
fixedOffsetMinutes: _this17.getAvailabilityRuntimeOffsetMinutes(),
|
|
4382
5004
|
rollOverEnd: true
|
|
4383
5005
|
});
|
|
4384
5006
|
return range ? [{
|
|
@@ -4413,7 +5035,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4413
5035
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4414
5036
|
startAt: slot.start_at,
|
|
4415
5037
|
endAt: slot.end_at,
|
|
4416
|
-
fixedOffsetMinutes:
|
|
5038
|
+
fixedOffsetMinutes: _this17.getAvailabilityRuntimeOffsetMinutes(),
|
|
4417
5039
|
rollOverEnd: true
|
|
4418
5040
|
});
|
|
4419
5041
|
return range ? [{
|
|
@@ -4429,7 +5051,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4429
5051
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
4430
5052
|
startAt: slot.start_at,
|
|
4431
5053
|
endAt: slot.end_at,
|
|
4432
|
-
fixedOffsetMinutes:
|
|
5054
|
+
fixedOffsetMinutes: _this17.getAvailabilityRuntimeOffsetMinutes(),
|
|
4433
5055
|
rollOverEnd: true
|
|
4434
5056
|
});
|
|
4435
5057
|
return range ? [{
|
|
@@ -4456,51 +5078,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4456
5078
|
}, {
|
|
4457
5079
|
key: "loadAvailabilityProducts",
|
|
4458
5080
|
value: function () {
|
|
4459
|
-
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4460
|
-
var
|
|
5081
|
+
var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
5082
|
+
var _this18 = this,
|
|
4461
5083
|
_prepare$catalogScope3,
|
|
4462
5084
|
_prepare$catalogScope4,
|
|
4463
5085
|
_prepare$resourceIds;
|
|
4464
5086
|
var prepare, dateRange, explicitProductIds, publishCatalog, loadProducts, rawProducts, _prepare$catalogScope2, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
|
|
4465
|
-
return _regeneratorRuntime().wrap(function
|
|
4466
|
-
while (1) switch (
|
|
5087
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
5088
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4467
5089
|
case 0:
|
|
4468
5090
|
prepare = params.prepare, dateRange = params.dateRange;
|
|
4469
5091
|
explicitProductIds = prepare.productIds || [];
|
|
4470
5092
|
publishCatalog = prepare.publishCatalog !== false;
|
|
4471
5093
|
loadProducts = function loadProducts(query) {
|
|
4472
5094
|
var _prepare$catalogScope;
|
|
4473
|
-
return publishCatalog ?
|
|
5095
|
+
return publishCatalog ? _this18.loadProducts(query) : ((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'productList' ? _this18.queryCatalogSnapshot(query) : _this18.loadCatalogProducts(query);
|
|
4474
5096
|
};
|
|
4475
5097
|
rawProducts = [];
|
|
4476
5098
|
if (!Array.isArray(prepare.rawProducts)) {
|
|
4477
|
-
|
|
5099
|
+
_context47.next = 10;
|
|
4478
5100
|
break;
|
|
4479
5101
|
}
|
|
4480
5102
|
rawProducts = prepare.rawProducts;
|
|
4481
5103
|
if (publishCatalog) this.unifiedProductCatalog = _toConsumableArray(rawProducts);
|
|
4482
|
-
|
|
5104
|
+
_context47.next = 36;
|
|
4483
5105
|
break;
|
|
4484
5106
|
case 10:
|
|
4485
5107
|
if (!(explicitProductIds.length > 0)) {
|
|
4486
|
-
|
|
5108
|
+
_context47.next = 16;
|
|
4487
5109
|
break;
|
|
4488
5110
|
}
|
|
4489
|
-
|
|
5111
|
+
_context47.next = 13;
|
|
4490
5112
|
return loadProducts(_objectSpread(_objectSpread({}, !publishCatalog && ((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList' ? prepare.catalogScope.params : {}), {}, {
|
|
4491
5113
|
product_ids: explicitProductIds,
|
|
4492
5114
|
schedule_date: dateRange.startDate
|
|
4493
5115
|
}));
|
|
4494
5116
|
case 13:
|
|
4495
|
-
rawProducts =
|
|
4496
|
-
|
|
5117
|
+
rawProducts = _context47.sent;
|
|
5118
|
+
_context47.next = 36;
|
|
4497
5119
|
break;
|
|
4498
5120
|
case 16:
|
|
4499
5121
|
if (!(((_prepare$catalogScope3 = prepare.catalogScope) === null || _prepare$catalogScope3 === void 0 ? void 0 : _prepare$catalogScope3.type) === 'schedule')) {
|
|
4500
|
-
|
|
5122
|
+
_context47.next = 32;
|
|
4501
5123
|
break;
|
|
4502
5124
|
}
|
|
4503
|
-
|
|
5125
|
+
_context47.next = 19;
|
|
4504
5126
|
return this.loadScheduleAvailableDate({
|
|
4505
5127
|
startDate: dateRange.startDate,
|
|
4506
5128
|
endDate: dateRange.endDate,
|
|
@@ -4516,44 +5138,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4516
5138
|
});
|
|
4517
5139
|
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)) || [])));
|
|
4518
5140
|
if (!(productIds.length > 0)) {
|
|
4519
|
-
|
|
5141
|
+
_context47.next = 29;
|
|
4520
5142
|
break;
|
|
4521
5143
|
}
|
|
4522
5144
|
assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
|
|
4523
|
-
|
|
5145
|
+
_context47.next = 26;
|
|
4524
5146
|
return loadProducts({
|
|
4525
5147
|
product_ids: productIds,
|
|
4526
5148
|
schedule_date: dateRange.startDate
|
|
4527
5149
|
});
|
|
4528
5150
|
case 26:
|
|
4529
|
-
rawProducts =
|
|
4530
|
-
|
|
5151
|
+
rawProducts = _context47.sent;
|
|
5152
|
+
_context47.next = 30;
|
|
4531
5153
|
break;
|
|
4532
5154
|
case 29:
|
|
4533
5155
|
if (publishCatalog) this.unifiedProductCatalog = [];
|
|
4534
5156
|
case 30:
|
|
4535
|
-
|
|
5157
|
+
_context47.next = 36;
|
|
4536
5158
|
break;
|
|
4537
5159
|
case 32:
|
|
4538
5160
|
if (!(((_prepare$catalogScope4 = prepare.catalogScope) === null || _prepare$catalogScope4 === void 0 ? void 0 : _prepare$catalogScope4.type) === 'productList')) {
|
|
4539
|
-
|
|
5161
|
+
_context47.next = 36;
|
|
4540
5162
|
break;
|
|
4541
5163
|
}
|
|
4542
|
-
|
|
5164
|
+
_context47.next = 35;
|
|
4543
5165
|
return loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
|
|
4544
5166
|
schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
|
|
4545
5167
|
}));
|
|
4546
5168
|
case 35:
|
|
4547
|
-
rawProducts =
|
|
5169
|
+
rawProducts = _context47.sent;
|
|
4548
5170
|
case 36:
|
|
4549
5171
|
normalized = rawProducts.map(function (product) {
|
|
4550
|
-
return normalizeProductForAvailability(product, params.scheduleList,
|
|
5172
|
+
return normalizeProductForAvailability(product, params.scheduleList, _this18.getAvailabilityRuntimeOffsetMinutes());
|
|
4551
5173
|
});
|
|
4552
5174
|
if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
|
|
4553
|
-
|
|
5175
|
+
_context47.next = 39;
|
|
4554
5176
|
break;
|
|
4555
5177
|
}
|
|
4556
|
-
return
|
|
5178
|
+
return _context47.abrupt("return", normalized.filter(function (product) {
|
|
4557
5179
|
var _product$requirementG2;
|
|
4558
5180
|
return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
|
|
4559
5181
|
var _group$resourceIds3;
|
|
@@ -4566,16 +5188,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4566
5188
|
}));
|
|
4567
5189
|
case 39:
|
|
4568
5190
|
productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
|
|
4569
|
-
return
|
|
5191
|
+
return _context47.abrupt("return", productIdSet ? normalized.filter(function (product) {
|
|
4570
5192
|
return productIdSet.has(String(product.id));
|
|
4571
5193
|
}) : normalized);
|
|
4572
5194
|
case 41:
|
|
4573
5195
|
case "end":
|
|
4574
|
-
return
|
|
5196
|
+
return _context47.stop();
|
|
4575
5197
|
}
|
|
4576
|
-
},
|
|
5198
|
+
}, _callee47, this);
|
|
4577
5199
|
}));
|
|
4578
|
-
function loadAvailabilityProducts(
|
|
5200
|
+
function loadAvailabilityProducts(_x35) {
|
|
4579
5201
|
return _loadAvailabilityProducts.apply(this, arguments);
|
|
4580
5202
|
}
|
|
4581
5203
|
return loadAvailabilityProducts;
|
|
@@ -4588,12 +5210,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4588
5210
|
}, {
|
|
4589
5211
|
key: "fetchAvailabilityResourcesV2",
|
|
4590
5212
|
value: (function () {
|
|
4591
|
-
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5213
|
+
var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
|
|
4592
5214
|
var response, data, message;
|
|
4593
|
-
return _regeneratorRuntime().wrap(function
|
|
4594
|
-
while (1) switch (
|
|
5215
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5216
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4595
5217
|
case 0:
|
|
4596
|
-
|
|
5218
|
+
_context48.next = 2;
|
|
4597
5219
|
return this.request.get('/schedule/resource/list/v2', {
|
|
4598
5220
|
start_date: params.dateRange.startDate,
|
|
4599
5221
|
end_date: params.dateRange.endDate,
|
|
@@ -4603,10 +5225,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4603
5225
|
useCache: false
|
|
4604
5226
|
});
|
|
4605
5227
|
case 2:
|
|
4606
|
-
response =
|
|
5228
|
+
response = _context48.sent;
|
|
4607
5229
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
4608
5230
|
if (!(params.strictResponse && (response === null || response === void 0 ? void 0 : response.status) === false)) {
|
|
4609
|
-
|
|
5231
|
+
_context48.next = 7;
|
|
4610
5232
|
break;
|
|
4611
5233
|
}
|
|
4612
5234
|
message = response === null || response === void 0 ? void 0 : response.message;
|
|
@@ -4615,31 +5237,31 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4615
5237
|
});
|
|
4616
5238
|
case 7:
|
|
4617
5239
|
if (!Array.isArray(data)) {
|
|
4618
|
-
|
|
5240
|
+
_context48.next = 9;
|
|
4619
5241
|
break;
|
|
4620
5242
|
}
|
|
4621
|
-
return
|
|
5243
|
+
return _context48.abrupt("return", data);
|
|
4622
5244
|
case 9:
|
|
4623
5245
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
|
|
4624
|
-
|
|
5246
|
+
_context48.next = 11;
|
|
4625
5247
|
break;
|
|
4626
5248
|
}
|
|
4627
|
-
return
|
|
5249
|
+
return _context48.abrupt("return", data.list);
|
|
4628
5250
|
case 11:
|
|
4629
5251
|
if (!params.strictResponse) {
|
|
4630
|
-
|
|
5252
|
+
_context48.next = 13;
|
|
4631
5253
|
break;
|
|
4632
5254
|
}
|
|
4633
5255
|
throw new Error('Booking resource details returned an invalid response.');
|
|
4634
5256
|
case 13:
|
|
4635
|
-
return
|
|
5257
|
+
return _context48.abrupt("return", []);
|
|
4636
5258
|
case 14:
|
|
4637
5259
|
case "end":
|
|
4638
|
-
return
|
|
5260
|
+
return _context48.stop();
|
|
4639
5261
|
}
|
|
4640
|
-
},
|
|
5262
|
+
}, _callee48, this);
|
|
4641
5263
|
}));
|
|
4642
|
-
function fetchAvailabilityResourcesV2(
|
|
5264
|
+
function fetchAvailabilityResourcesV2(_x36) {
|
|
4643
5265
|
return _fetchAvailabilityResourcesV.apply(this, arguments);
|
|
4644
5266
|
}
|
|
4645
5267
|
return fetchAvailabilityResourcesV2;
|
|
@@ -4647,32 +5269,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4647
5269
|
}, {
|
|
4648
5270
|
key: "queryBookingResourceDetails",
|
|
4649
5271
|
value: (function () {
|
|
4650
|
-
var _queryBookingResourceDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4651
|
-
var
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
5272
|
+
var _queryBookingResourceDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
5273
|
+
var _this19 = this,
|
|
5274
|
+
_this$otherParams37;
|
|
5275
|
+
var date, resourceIds, core, request, generation, scope, assertCurrent, resourceQuery, timezone, resources, byId;
|
|
5276
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
5277
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4655
5278
|
case 0:
|
|
4656
5279
|
date = params === null || params === void 0 ? void 0 : params.date;
|
|
4657
|
-
|
|
5280
|
+
_context49.prev = 1;
|
|
4658
5281
|
if (!(typeof date !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(date))) {
|
|
4659
|
-
|
|
5282
|
+
_context49.next = 4;
|
|
4660
5283
|
break;
|
|
4661
5284
|
}
|
|
4662
5285
|
throw new Error('date');
|
|
4663
5286
|
case 4:
|
|
4664
5287
|
parseLocalDate(date);
|
|
4665
|
-
|
|
5288
|
+
_context49.next = 10;
|
|
4666
5289
|
break;
|
|
4667
5290
|
case 7:
|
|
4668
|
-
|
|
4669
|
-
|
|
5291
|
+
_context49.prev = 7;
|
|
5292
|
+
_context49.t0 = _context49["catch"](1);
|
|
4670
5293
|
throw this.createAvailabilityFacadeError('INVALID_DATE_RANGE', 'A valid booking date is required to load resource details.');
|
|
4671
5294
|
case 10:
|
|
4672
5295
|
if (!(!Array.isArray(params === null || params === void 0 ? void 0 : params.resourceIds) || !params.resourceIds.length || params.resourceIds.some(function (id) {
|
|
4673
5296
|
return !['number', 'string'].includes(_typeof(id)) || !/^\d+$/.test(String(id)) || !Number.isSafeInteger(Number(id)) || Number(id) <= 0;
|
|
4674
5297
|
}))) {
|
|
4675
|
-
|
|
5298
|
+
_context49.next = 12;
|
|
4676
5299
|
break;
|
|
4677
5300
|
}
|
|
4678
5301
|
throw this.createAvailabilityFacadeError('INVALID_TARGET_FILTER', 'Selected resource IDs are required to load resource details.');
|
|
@@ -4685,22 +5308,48 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4685
5308
|
generation = this.runtimeInitializationGeneration;
|
|
4686
5309
|
scope = this.getRuntimeOpenDataScope();
|
|
4687
5310
|
assertCurrent = function assertCurrent() {
|
|
4688
|
-
if (
|
|
4689
|
-
throw
|
|
5311
|
+
if (_this19.runtimeOpenDataDestroyed || !request || core !== _this19.core || request !== _this19.request || generation !== _this19.runtimeInitializationGeneration || scope !== _this19.getRuntimeOpenDataScope()) {
|
|
5312
|
+
throw _this19.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'Booking settings changed. Please reload the resource details.');
|
|
4690
5313
|
}
|
|
4691
5314
|
};
|
|
4692
5315
|
assertCurrent();
|
|
4693
|
-
|
|
4694
|
-
return this.fetchAvailabilityResourcesV2({
|
|
5316
|
+
resourceQuery = {
|
|
4695
5317
|
dateRange: {
|
|
4696
5318
|
startDate: date,
|
|
4697
5319
|
endDate: date
|
|
4698
5320
|
},
|
|
4699
|
-
resourceIds: resourceIds
|
|
5321
|
+
resourceIds: resourceIds
|
|
5322
|
+
}; // Match normalizeAvailabilityPrepareDescriptor so confirmation reuses exactly
|
|
5323
|
+
// the same resource/date coverage as the selection projection.
|
|
5324
|
+
timezone = String(((_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.businessTimezone) || Intl.DateTimeFormat().resolvedOptions().timeZone || 'Asia/Shanghai').trim();
|
|
5325
|
+
if (!this.isVenueCatalogLocalPricingActive()) {
|
|
5326
|
+
_context49.next = 27;
|
|
5327
|
+
break;
|
|
5328
|
+
}
|
|
5329
|
+
_context49.next = 24;
|
|
5330
|
+
return this.availabilitySessionResourceCache.load(_objectSpread(_objectSpread({
|
|
5331
|
+
scopeKey: "".concat(scope, ":").concat(this.buildAvailabilityRemoteResourceScopeKey(timezone)),
|
|
5332
|
+
timezoneName: timezone
|
|
5333
|
+
}, resourceQuery), {}, {
|
|
5334
|
+
fetch: function fetch(query) {
|
|
5335
|
+
return _this19.fetchAvailabilityResourcesV2(_objectSpread(_objectSpread({}, query), {}, {
|
|
5336
|
+
strictResponse: true
|
|
5337
|
+
}));
|
|
5338
|
+
}
|
|
5339
|
+
}));
|
|
5340
|
+
case 24:
|
|
5341
|
+
_context49.t1 = _context49.sent;
|
|
5342
|
+
_context49.next = 30;
|
|
5343
|
+
break;
|
|
5344
|
+
case 27:
|
|
5345
|
+
_context49.next = 29;
|
|
5346
|
+
return this.fetchAvailabilityResourcesV2(_objectSpread(_objectSpread({}, resourceQuery), {}, {
|
|
4700
5347
|
strictResponse: true
|
|
4701
|
-
});
|
|
4702
|
-
case
|
|
4703
|
-
|
|
5348
|
+
}));
|
|
5349
|
+
case 29:
|
|
5350
|
+
_context49.t1 = _context49.sent;
|
|
5351
|
+
case 30:
|
|
5352
|
+
resources = _context49.t1;
|
|
4704
5353
|
assertCurrent();
|
|
4705
5354
|
byId = new Map(resources.filter(isRecord).map(function (resource) {
|
|
4706
5355
|
return [String(resource.id), resource];
|
|
@@ -4708,21 +5357,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4708
5357
|
if (!resourceIds.some(function (id) {
|
|
4709
5358
|
return !byId.has(id);
|
|
4710
5359
|
})) {
|
|
4711
|
-
|
|
5360
|
+
_context49.next = 35;
|
|
4712
5361
|
break;
|
|
4713
5362
|
}
|
|
4714
5363
|
throw this.createAvailabilityFacadeError('INVALID_TARGET_FILTER', 'A selected booking resource is no longer available.');
|
|
4715
|
-
case
|
|
4716
|
-
return
|
|
5364
|
+
case 35:
|
|
5365
|
+
return _context49.abrupt("return", cloneDeep(resourceIds.map(function (id) {
|
|
4717
5366
|
return byId.get(id);
|
|
4718
5367
|
})));
|
|
4719
|
-
case
|
|
5368
|
+
case 36:
|
|
4720
5369
|
case "end":
|
|
4721
|
-
return
|
|
5370
|
+
return _context49.stop();
|
|
4722
5371
|
}
|
|
4723
|
-
},
|
|
5372
|
+
}, _callee49, this, [[1, 7]]);
|
|
4724
5373
|
}));
|
|
4725
|
-
function queryBookingResourceDetails(
|
|
5374
|
+
function queryBookingResourceDetails(_x37) {
|
|
4726
5375
|
return _queryBookingResourceDetails.apply(this, arguments);
|
|
4727
5376
|
}
|
|
4728
5377
|
return queryBookingResourceDetails;
|
|
@@ -4730,27 +5379,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4730
5379
|
}, {
|
|
4731
5380
|
key: "fetchAndPublishAvailabilityResourcesV2",
|
|
4732
5381
|
value: function () {
|
|
4733
|
-
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4734
|
-
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
|
|
4735
|
-
return _regeneratorRuntime().wrap(function
|
|
4736
|
-
while (1) switch (
|
|
5382
|
+
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
|
|
5383
|
+
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources, epoch, covering, coveredResources;
|
|
5384
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
5385
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4737
5386
|
case 0:
|
|
4738
5387
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4739
5388
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4740
|
-
|
|
5389
|
+
_context50.next = 3;
|
|
4741
5390
|
break;
|
|
4742
5391
|
}
|
|
4743
|
-
return
|
|
5392
|
+
return _context50.abrupt("return", []);
|
|
4744
5393
|
case 3:
|
|
4745
5394
|
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
4746
5395
|
cacheParams = {
|
|
4747
5396
|
scopeKey: scopeKey,
|
|
4748
5397
|
resourceIds: normalizedResourceIds,
|
|
4749
|
-
dateRange: params.dateRange
|
|
5398
|
+
dateRange: params.dateRange,
|
|
5399
|
+
maxAgeMs: params.maxAgeMs
|
|
4750
5400
|
};
|
|
4751
5401
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
4752
5402
|
if (!cachedRawResources) {
|
|
4753
|
-
|
|
5403
|
+
_context50.next = 9;
|
|
4754
5404
|
break;
|
|
4755
5405
|
}
|
|
4756
5406
|
if (params.useCacheOnHit) {
|
|
@@ -4762,23 +5412,59 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4762
5412
|
console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
|
|
4763
5413
|
});
|
|
4764
5414
|
}
|
|
4765
|
-
return
|
|
5415
|
+
return _context50.abrupt("return", cachedRawResources);
|
|
4766
5416
|
case 9:
|
|
4767
|
-
|
|
5417
|
+
if (!(params.maxAgeMs !== undefined)) {
|
|
5418
|
+
_context50.next = 20;
|
|
5419
|
+
break;
|
|
5420
|
+
}
|
|
5421
|
+
// A visible-month request can cover a concurrent day/resource-subset preview.
|
|
5422
|
+
// Only share fully covering requests; partial overlaps keep the normal fetch path.
|
|
5423
|
+
epoch = this.availabilityRemoteResourceEpoch;
|
|
5424
|
+
covering = Array.from(this.availabilityRemoteResourceQueryInFlight.values()).find(function (entry) {
|
|
5425
|
+
return entry.epoch === epoch && entry.scopeKey === scopeKey && entry.dateRange.startDate <= params.dateRange.startDate && entry.dateRange.endDate >= params.dateRange.endDate && normalizedResourceIds.every(function (id) {
|
|
5426
|
+
return entry.resourceIds.some(function (other) {
|
|
5427
|
+
return String(other) === String(id);
|
|
5428
|
+
});
|
|
5429
|
+
});
|
|
5430
|
+
});
|
|
5431
|
+
if (!covering) {
|
|
5432
|
+
_context50.next = 20;
|
|
5433
|
+
break;
|
|
5434
|
+
}
|
|
5435
|
+
_context50.next = 15;
|
|
5436
|
+
return covering.promise;
|
|
5437
|
+
case 15:
|
|
5438
|
+
if (!(epoch !== this.availabilityRemoteResourceEpoch)) {
|
|
5439
|
+
_context50.next = 17;
|
|
5440
|
+
break;
|
|
5441
|
+
}
|
|
5442
|
+
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'Resource settings changed while loading. Please prepare again.');
|
|
5443
|
+
case 17:
|
|
5444
|
+
// Read a detached, correctly sliced graph after publication. A newer overlapping
|
|
5445
|
+
// response may have invalidated cells, in which case fetch this exact range below.
|
|
5446
|
+
coveredResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
5447
|
+
if (!coveredResources) {
|
|
5448
|
+
_context50.next = 20;
|
|
5449
|
+
break;
|
|
5450
|
+
}
|
|
5451
|
+
return _context50.abrupt("return", coveredResources);
|
|
5452
|
+
case 20:
|
|
5453
|
+
_context50.next = 22;
|
|
4768
5454
|
return this.refreshAvailabilityRemoteResourceQuery({
|
|
4769
5455
|
timezone: params.timezone,
|
|
4770
5456
|
dateRange: params.dateRange,
|
|
4771
5457
|
resourceIds: normalizedResourceIds
|
|
4772
5458
|
});
|
|
4773
|
-
case
|
|
4774
|
-
return
|
|
4775
|
-
case
|
|
5459
|
+
case 22:
|
|
5460
|
+
return _context50.abrupt("return", _context50.sent);
|
|
5461
|
+
case 23:
|
|
4776
5462
|
case "end":
|
|
4777
|
-
return
|
|
5463
|
+
return _context50.stop();
|
|
4778
5464
|
}
|
|
4779
|
-
},
|
|
5465
|
+
}, _callee50, this);
|
|
4780
5466
|
}));
|
|
4781
|
-
function fetchAndPublishAvailabilityResourcesV2(
|
|
5467
|
+
function fetchAndPublishAvailabilityResourcesV2(_x38) {
|
|
4782
5468
|
return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
|
|
4783
5469
|
}
|
|
4784
5470
|
return fetchAndPublishAvailabilityResourcesV2;
|
|
@@ -4786,17 +5472,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4786
5472
|
}, {
|
|
4787
5473
|
key: "refreshAvailabilityRemoteResourceQuery",
|
|
4788
5474
|
value: function () {
|
|
4789
|
-
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4790
|
-
var
|
|
4791
|
-
|
|
4792
|
-
|
|
5475
|
+
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
|
|
5476
|
+
var _this20 = this;
|
|
5477
|
+
var normalizedResourceIds, queryKey, epoch, existing, writeVersion, scopeKey, promise, current;
|
|
5478
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
5479
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
4793
5480
|
case 0:
|
|
4794
5481
|
normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
|
|
4795
5482
|
if (!(normalizedResourceIds.length === 0)) {
|
|
4796
|
-
|
|
5483
|
+
_context51.next = 3;
|
|
4797
5484
|
break;
|
|
4798
5485
|
}
|
|
4799
|
-
return
|
|
5486
|
+
return _context51.abrupt("return", []);
|
|
4800
5487
|
case 3:
|
|
4801
5488
|
queryKey = this.buildAvailabilityRemoteResourceQueryKey({
|
|
4802
5489
|
timezone: params.timezone,
|
|
@@ -4806,54 +5493,59 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4806
5493
|
epoch = this.availabilityRemoteResourceEpoch;
|
|
4807
5494
|
existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4808
5495
|
if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
|
|
4809
|
-
|
|
5496
|
+
_context51.next = 10;
|
|
4810
5497
|
break;
|
|
4811
5498
|
}
|
|
4812
|
-
|
|
5499
|
+
_context51.next = 9;
|
|
4813
5500
|
return existing.promise;
|
|
4814
5501
|
case 9:
|
|
4815
|
-
return
|
|
5502
|
+
return _context51.abrupt("return", _context51.sent);
|
|
4816
5503
|
case 10:
|
|
4817
5504
|
this.availabilityRemoteResourceQuerySequence += 1;
|
|
4818
5505
|
writeVersion = this.availabilityRemoteResourceQuerySequence;
|
|
5506
|
+
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
4819
5507
|
promise = this.fetchAvailabilityResourcesV2({
|
|
4820
5508
|
dateRange: params.dateRange,
|
|
4821
5509
|
resourceIds: normalizedResourceIds
|
|
5510
|
+
}).then(function (rawResources) {
|
|
5511
|
+
if (epoch === _this20.availabilityRemoteResourceEpoch) {
|
|
5512
|
+
_this20.availabilityRemoteOccupancyCache.publish({
|
|
5513
|
+
scopeKey: scopeKey,
|
|
5514
|
+
timezoneName: params.timezone,
|
|
5515
|
+
resourceIds: normalizedResourceIds,
|
|
5516
|
+
dateRange: params.dateRange,
|
|
5517
|
+
rawResources: rawResources,
|
|
5518
|
+
version: writeVersion
|
|
5519
|
+
});
|
|
5520
|
+
}
|
|
5521
|
+
return rawResources;
|
|
4822
5522
|
});
|
|
4823
5523
|
this.availabilityRemoteResourceQueryInFlight.set(queryKey, {
|
|
4824
5524
|
epoch: epoch,
|
|
5525
|
+
scopeKey: scopeKey,
|
|
5526
|
+
dateRange: _objectSpread({}, params.dateRange),
|
|
5527
|
+
resourceIds: _toConsumableArray(normalizedResourceIds),
|
|
4825
5528
|
promise: promise
|
|
4826
5529
|
});
|
|
4827
|
-
|
|
4828
|
-
|
|
5530
|
+
_context51.prev = 15;
|
|
5531
|
+
_context51.next = 18;
|
|
4829
5532
|
return promise;
|
|
4830
|
-
case
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
|
|
4835
|
-
timezoneName: params.timezone,
|
|
4836
|
-
resourceIds: normalizedResourceIds,
|
|
4837
|
-
dateRange: params.dateRange,
|
|
4838
|
-
rawResources: rawResources,
|
|
4839
|
-
version: writeVersion
|
|
4840
|
-
});
|
|
4841
|
-
}
|
|
4842
|
-
return _context44.abrupt("return", rawResources);
|
|
4843
|
-
case 20:
|
|
4844
|
-
_context44.prev = 20;
|
|
5533
|
+
case 18:
|
|
5534
|
+
return _context51.abrupt("return", _context51.sent);
|
|
5535
|
+
case 19:
|
|
5536
|
+
_context51.prev = 19;
|
|
4845
5537
|
current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4846
5538
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4847
5539
|
this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
|
|
4848
5540
|
}
|
|
4849
|
-
return
|
|
4850
|
-
case
|
|
5541
|
+
return _context51.finish(19);
|
|
5542
|
+
case 23:
|
|
4851
5543
|
case "end":
|
|
4852
|
-
return
|
|
5544
|
+
return _context51.stop();
|
|
4853
5545
|
}
|
|
4854
|
-
},
|
|
5546
|
+
}, _callee51, this, [[15,, 19, 23]]);
|
|
4855
5547
|
}));
|
|
4856
|
-
function refreshAvailabilityRemoteResourceQuery(
|
|
5548
|
+
function refreshAvailabilityRemoteResourceQuery(_x39) {
|
|
4857
5549
|
return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
|
|
4858
5550
|
}
|
|
4859
5551
|
return refreshAvailabilityRemoteResourceQuery;
|
|
@@ -4861,34 +5553,60 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4861
5553
|
}, {
|
|
4862
5554
|
key: "loadAvailabilityResources",
|
|
4863
5555
|
value: function () {
|
|
4864
|
-
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4865
|
-
var
|
|
4866
|
-
|
|
4867
|
-
|
|
5556
|
+
var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
|
|
5557
|
+
var _this21 = this;
|
|
5558
|
+
var resourceIds, _rawResources, cachedRawResources, remoteQuery, rawResources;
|
|
5559
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
5560
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
4868
5561
|
case 0:
|
|
4869
5562
|
resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
|
|
4870
5563
|
if (!(resourceIds.length === 0)) {
|
|
4871
|
-
|
|
5564
|
+
_context52.next = 3;
|
|
4872
5565
|
break;
|
|
4873
5566
|
}
|
|
4874
|
-
return
|
|
5567
|
+
return _context52.abrupt("return", {
|
|
4875
5568
|
resources: [],
|
|
4876
5569
|
resourceOccupancies: []
|
|
4877
5570
|
});
|
|
4878
5571
|
case 3:
|
|
5572
|
+
if (!(params.fetchPolicy === 'session')) {
|
|
5573
|
+
_context52.next = 8;
|
|
5574
|
+
break;
|
|
5575
|
+
}
|
|
5576
|
+
_context52.next = 6;
|
|
5577
|
+
return this.availabilitySessionResourceCache.load({
|
|
5578
|
+
scopeKey: "".concat(this.getRuntimeOpenDataScope(), ":").concat(this.buildAvailabilityRemoteResourceScopeKey(params.timezone)),
|
|
5579
|
+
timezoneName: params.timezone,
|
|
5580
|
+
resourceIds: resourceIds,
|
|
5581
|
+
dateRange: params.dateRange,
|
|
5582
|
+
fetch: function fetch(query) {
|
|
5583
|
+
return _this21.fetchAvailabilityResourcesV2(_objectSpread(_objectSpread({}, query), {}, {
|
|
5584
|
+
strictResponse: true
|
|
5585
|
+
}));
|
|
5586
|
+
}
|
|
5587
|
+
});
|
|
5588
|
+
case 6:
|
|
5589
|
+
_rawResources = _context52.sent;
|
|
5590
|
+
return _context52.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
5591
|
+
rawResources: _rawResources,
|
|
5592
|
+
scheduleList: params.scheduleList,
|
|
5593
|
+
dateRange: params.dateRange,
|
|
5594
|
+
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
5595
|
+
}));
|
|
5596
|
+
case 8:
|
|
4879
5597
|
if (!(Array.isArray(params.rawResources) && params.fetchPolicy !== 'refresh')) {
|
|
4880
|
-
|
|
5598
|
+
_context52.next = 10;
|
|
4881
5599
|
break;
|
|
4882
5600
|
}
|
|
4883
|
-
return
|
|
5601
|
+
return _context52.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4884
5602
|
rawResources: params.rawResources,
|
|
4885
5603
|
scheduleList: params.scheduleList,
|
|
4886
5604
|
dateRange: params.dateRange,
|
|
4887
5605
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4888
5606
|
}));
|
|
4889
|
-
case
|
|
5607
|
+
case 10:
|
|
4890
5608
|
if (!(params.fetchPolicy === 'cache_only')) {
|
|
4891
|
-
|
|
5609
|
+
_context52.next = 15;
|
|
4892
5610
|
break;
|
|
4893
5611
|
}
|
|
4894
5612
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read({
|
|
@@ -4897,58 +5615,60 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4897
5615
|
dateRange: params.dateRange
|
|
4898
5616
|
});
|
|
4899
5617
|
if (!cachedRawResources) {
|
|
4900
|
-
|
|
5618
|
+
_context52.next = 14;
|
|
4901
5619
|
break;
|
|
4902
5620
|
}
|
|
4903
|
-
return
|
|
5621
|
+
return _context52.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4904
5622
|
rawResources: cachedRawResources,
|
|
4905
5623
|
scheduleList: params.scheduleList,
|
|
4906
5624
|
dateRange: params.dateRange,
|
|
4907
5625
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4908
5626
|
}));
|
|
4909
|
-
case
|
|
4910
|
-
return
|
|
5627
|
+
case 14:
|
|
5628
|
+
return _context52.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
|
|
4911
5629
|
resources: [],
|
|
4912
5630
|
resourceOccupancies: []
|
|
4913
5631
|
});
|
|
4914
|
-
case
|
|
5632
|
+
case 15:
|
|
4915
5633
|
remoteQuery = {
|
|
4916
5634
|
timezone: params.timezone,
|
|
4917
5635
|
dateRange: params.dateRange,
|
|
4918
5636
|
resourceIds: resourceIds
|
|
4919
5637
|
};
|
|
4920
5638
|
if (!(params.fetchPolicy === 'refresh')) {
|
|
4921
|
-
|
|
5639
|
+
_context52.next = 22;
|
|
4922
5640
|
break;
|
|
4923
5641
|
}
|
|
4924
|
-
|
|
5642
|
+
_context52.next = 19;
|
|
4925
5643
|
return this.refreshAvailabilityRemoteResourceQuery(remoteQuery);
|
|
4926
|
-
case
|
|
4927
|
-
|
|
4928
|
-
|
|
5644
|
+
case 19:
|
|
5645
|
+
_context52.t0 = _context52.sent;
|
|
5646
|
+
_context52.next = 25;
|
|
4929
5647
|
break;
|
|
4930
|
-
case
|
|
4931
|
-
|
|
5648
|
+
case 22:
|
|
5649
|
+
_context52.next = 24;
|
|
4932
5650
|
return this.fetchAndPublishAvailabilityResourcesV2(_objectSpread(_objectSpread({}, remoteQuery), {}, {
|
|
4933
|
-
useCacheOnHit:
|
|
4934
|
-
}
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
case
|
|
4938
|
-
|
|
4939
|
-
|
|
5651
|
+
useCacheOnHit: params.fetchPolicy !== 'cache_first'
|
|
5652
|
+
}, params.fetchPolicy === 'cache_first' ? {
|
|
5653
|
+
maxAgeMs: PREVIEW_OCCUPANCY_CACHE_MAX_AGE_MS
|
|
5654
|
+
} : {}));
|
|
5655
|
+
case 24:
|
|
5656
|
+
_context52.t0 = _context52.sent;
|
|
5657
|
+
case 25:
|
|
5658
|
+
rawResources = _context52.t0;
|
|
5659
|
+
return _context52.abrupt("return", buildAvailabilityResourcesFromV2({
|
|
4940
5660
|
rawResources: rawResources,
|
|
4941
5661
|
scheduleList: params.scheduleList,
|
|
4942
5662
|
dateRange: params.dateRange,
|
|
4943
5663
|
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
|
|
4944
5664
|
}));
|
|
4945
|
-
case
|
|
5665
|
+
case 27:
|
|
4946
5666
|
case "end":
|
|
4947
|
-
return
|
|
5667
|
+
return _context52.stop();
|
|
4948
5668
|
}
|
|
4949
|
-
},
|
|
5669
|
+
}, _callee52, this);
|
|
4950
5670
|
}));
|
|
4951
|
-
function loadAvailabilityResources(
|
|
5671
|
+
function loadAvailabilityResources(_x40) {
|
|
4952
5672
|
return _loadAvailabilityResources.apply(this, arguments);
|
|
4953
5673
|
}
|
|
4954
5674
|
return loadAvailabilityResources;
|
|
@@ -4968,7 +5688,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4968
5688
|
var products = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) ? tempOrder.products : [];
|
|
4969
5689
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
4970
5690
|
productLineUids.forEach(function (requestedUid) {
|
|
4971
|
-
var
|
|
5691
|
+
var _ref54, _product$booking_uid2, _product$metadata6;
|
|
4972
5692
|
var product = products.find(function (line) {
|
|
4973
5693
|
return getProductLineUid(line) === String(requestedUid);
|
|
4974
5694
|
});
|
|
@@ -4978,7 +5698,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4978
5698
|
});
|
|
4979
5699
|
}
|
|
4980
5700
|
var productUid = getProductLineUid(product);
|
|
4981
|
-
var linkedBookingUid = String((
|
|
5701
|
+
var linkedBookingUid = String((_ref54 = (_product$booking_uid2 = product.booking_uid) !== null && _product$booking_uid2 !== void 0 ? _product$booking_uid2 : (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid) !== null && _ref54 !== void 0 ? _ref54 : '');
|
|
4982
5702
|
var linkedBookings = bookings.filter(function (booking) {
|
|
4983
5703
|
var _booking$product_uid;
|
|
4984
5704
|
return linkedBookingUid && getBookingUid(booking) === linkedBookingUid || productUid && String((_booking$product_uid = booking.product_uid) !== null && _booking$product_uid !== void 0 ? _booking$product_uid : '') === productUid;
|
|
@@ -5021,24 +5741,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5021
5741
|
}, {
|
|
5022
5742
|
key: "collectCartResourceOccupancies",
|
|
5023
5743
|
value: function collectCartResourceOccupancies(tempOrder, exclusions) {
|
|
5024
|
-
var
|
|
5744
|
+
var _this22 = this;
|
|
5025
5745
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
5026
5746
|
return bookings.flatMap(function (booking) {
|
|
5027
|
-
var
|
|
5747
|
+
var _ref55, _booking$product_uid2, _booking$metadata2;
|
|
5028
5748
|
var bookingUid = getBookingUid(booking);
|
|
5029
|
-
var productUid = String((
|
|
5749
|
+
var productUid = String((_ref55 = (_booking$product_uid2 = booking.product_uid) !== null && _booking$product_uid2 !== void 0 ? _booking$product_uid2 : (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid) !== null && _ref55 !== void 0 ? _ref55 : '');
|
|
5030
5750
|
var scheduleEventId = toNumberId(booking.schedule_event_id);
|
|
5031
5751
|
var startAt = booking.start_at || "".concat(booking.start_date || '', " ").concat(booking.start_time || '').trim();
|
|
5032
5752
|
var endAt = booking.end_at || "".concat(booking.end_date || booking.start_date || '', " ").concat(booking.end_time || '').trim();
|
|
5033
5753
|
var resources = Array.isArray(booking.resources) ? booking.resources : [];
|
|
5034
5754
|
return resources.flatMap(function (resource) {
|
|
5035
|
-
var
|
|
5036
|
-
var resourceId = (
|
|
5755
|
+
var _ref56, _resource$resource_id, _ref57, _resource$capacity;
|
|
5756
|
+
var resourceId = (_ref56 = (_resource$resource_id = resource.resource_id) !== null && _resource$resource_id !== void 0 ? _resource$resource_id : resource.relation_id) !== null && _ref56 !== void 0 ? _ref56 : resource.id;
|
|
5037
5757
|
if (resourceId == null || !startAt || !endAt) return [];
|
|
5038
5758
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
5039
5759
|
startAt: startAt,
|
|
5040
5760
|
endAt: endAt,
|
|
5041
|
-
fixedOffsetMinutes:
|
|
5761
|
+
fixedOffsetMinutes: _this22.getAvailabilityRuntimeOffsetMinutes(),
|
|
5042
5762
|
rollOverEnd: false
|
|
5043
5763
|
});
|
|
5044
5764
|
if (!range) return [];
|
|
@@ -5046,7 +5766,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5046
5766
|
resourceId: resourceId,
|
|
5047
5767
|
startAt: range.startAt,
|
|
5048
5768
|
endAt: range.endAt,
|
|
5049
|
-
pax: Math.max(1, Number((
|
|
5769
|
+
pax: Math.max(1, Number((_ref57 = (_resource$capacity = resource.capacity) !== null && _resource$capacity !== void 0 ? _resource$capacity : booking.capacity) !== null && _ref57 !== void 0 ? _ref57 : 1) || 1),
|
|
5050
5770
|
source: 'cart',
|
|
5051
5771
|
scheduleEventId: scheduleEventId,
|
|
5052
5772
|
bookingUid: bookingUid || undefined,
|
|
@@ -5056,7 +5776,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5056
5776
|
resource: resource
|
|
5057
5777
|
}
|
|
5058
5778
|
};
|
|
5059
|
-
return
|
|
5779
|
+
return _this22.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
|
|
5060
5780
|
});
|
|
5061
5781
|
});
|
|
5062
5782
|
}
|
|
@@ -5123,16 +5843,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5123
5843
|
}, {
|
|
5124
5844
|
key: "assertContextualQueryFreshness",
|
|
5125
5845
|
value: function assertContextualQueryFreshness(context, request) {
|
|
5126
|
-
var
|
|
5846
|
+
var _this23 = this;
|
|
5127
5847
|
if (request.target === 'time') {
|
|
5128
5848
|
request.candidates.forEach(function (candidate) {
|
|
5129
|
-
|
|
5849
|
+
_this23.assertAvailabilityCandidateFreshness(context, candidate);
|
|
5130
5850
|
});
|
|
5131
5851
|
return;
|
|
5132
5852
|
}
|
|
5133
5853
|
if (request.target === 'resource') {
|
|
5134
5854
|
request.selectedRanges.forEach(function (candidate) {
|
|
5135
|
-
|
|
5855
|
+
_this23.assertAvailabilityCandidateFreshness(context, candidate);
|
|
5136
5856
|
});
|
|
5137
5857
|
}
|
|
5138
5858
|
}
|
|
@@ -5179,8 +5899,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5179
5899
|
}, {
|
|
5180
5900
|
key: "buildAvailabilityProjectionSnapshot",
|
|
5181
5901
|
value: function () {
|
|
5182
|
-
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5183
|
-
var
|
|
5902
|
+
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(params) {
|
|
5903
|
+
var _this24 = this;
|
|
5184
5904
|
var options,
|
|
5185
5905
|
normalizedPrepareParams,
|
|
5186
5906
|
timezoneLabel,
|
|
@@ -5201,11 +5921,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5201
5921
|
durationCandidateAnchorAt,
|
|
5202
5922
|
orderRevision,
|
|
5203
5923
|
projection,
|
|
5204
|
-
|
|
5205
|
-
return _regeneratorRuntime().wrap(function
|
|
5206
|
-
while (1) switch (
|
|
5924
|
+
_args53 = arguments;
|
|
5925
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5926
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
5207
5927
|
case 0:
|
|
5208
|
-
options =
|
|
5928
|
+
options = _args53.length > 1 && _args53[1] !== undefined ? _args53[1] : {};
|
|
5209
5929
|
normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
5210
5930
|
timezoneLabel = String(normalizedPrepareParams.timezone);
|
|
5211
5931
|
dateRange = normalizedPrepareParams.dateRange;
|
|
@@ -5219,15 +5939,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5219
5939
|
scheduleList: scheduleList,
|
|
5220
5940
|
businessHours: businessHours
|
|
5221
5941
|
});
|
|
5222
|
-
|
|
5942
|
+
_context53.next = 11;
|
|
5223
5943
|
return this.loadAvailabilityProducts({
|
|
5224
5944
|
prepare: normalizedPrepareParams,
|
|
5225
5945
|
dateRange: dateRange,
|
|
5226
5946
|
scheduleList: scheduleList
|
|
5227
5947
|
});
|
|
5228
5948
|
case 11:
|
|
5229
|
-
products =
|
|
5230
|
-
|
|
5949
|
+
products = _context53.sent;
|
|
5950
|
+
_context53.next = 14;
|
|
5231
5951
|
return this.loadAvailabilityResources({
|
|
5232
5952
|
timezone: timezoneLabel,
|
|
5233
5953
|
dateRange: dateRange,
|
|
@@ -5235,19 +5955,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5235
5955
|
products: products,
|
|
5236
5956
|
rawResources: normalizedPrepareParams.rawResources,
|
|
5237
5957
|
scheduleList: scheduleList,
|
|
5238
|
-
//
|
|
5239
|
-
|
|
5958
|
+
// Explicit Venue sessions retain physical occupancy coverage across preview,
|
|
5959
|
+
// selection and commit. Cart-derived occupancy is still rebuilt below.
|
|
5960
|
+
fetchPolicy: normalizedPrepareParams.occupancyCachePolicy === 'session' ? 'session' : options.resourceFetchPolicy || (normalizedPrepareParams.refreshOccupancies ? 'refresh' : normalizedPrepareParams.occupancyCachePolicy === 'cache_first' ? 'cache_first' : 'default'),
|
|
5240
5961
|
fallbackResources: options.fallbackResources
|
|
5241
5962
|
});
|
|
5242
5963
|
case 14:
|
|
5243
|
-
loadedResources =
|
|
5964
|
+
loadedResources = _context53.sent;
|
|
5244
5965
|
tempOrder = this.getTempOrder();
|
|
5245
5966
|
exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
|
|
5246
5967
|
injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
|
|
5247
5968
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
5248
5969
|
startAt: occupancy.startAt,
|
|
5249
5970
|
endAt: occupancy.endAt,
|
|
5250
|
-
fixedOffsetMinutes:
|
|
5971
|
+
fixedOffsetMinutes: _this24.getAvailabilityRuntimeOffsetMinutes(),
|
|
5251
5972
|
rollOverEnd: false
|
|
5252
5973
|
});
|
|
5253
5974
|
if (!range) return [];
|
|
@@ -5257,7 +5978,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5257
5978
|
})];
|
|
5258
5979
|
});
|
|
5259
5980
|
remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
|
|
5260
|
-
return !
|
|
5981
|
+
return !_this24.occupancyIsExcluded(occupancy, exclusions);
|
|
5261
5982
|
});
|
|
5262
5983
|
cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
|
|
5263
5984
|
preparedAt = this.getAvailabilityRuntimeDateTime();
|
|
@@ -5286,18 +6007,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5286
6007
|
prepareParams: normalizedPrepareParams,
|
|
5287
6008
|
durationCandidateAnchorAt: durationCandidateAnchorAt
|
|
5288
6009
|
});
|
|
5289
|
-
return
|
|
6010
|
+
return _context53.abrupt("return", {
|
|
5290
6011
|
projection: projection,
|
|
5291
6012
|
prepareParams: normalizedPrepareParams,
|
|
5292
6013
|
orderRevision: orderRevision
|
|
5293
6014
|
});
|
|
5294
6015
|
case 26:
|
|
5295
6016
|
case "end":
|
|
5296
|
-
return
|
|
6017
|
+
return _context53.stop();
|
|
5297
6018
|
}
|
|
5298
|
-
},
|
|
6019
|
+
}, _callee53, this);
|
|
5299
6020
|
}));
|
|
5300
|
-
function buildAvailabilityProjectionSnapshot(
|
|
6021
|
+
function buildAvailabilityProjectionSnapshot(_x41) {
|
|
5301
6022
|
return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
|
|
5302
6023
|
}
|
|
5303
6024
|
return buildAvailabilityProjectionSnapshot;
|
|
@@ -5305,10 +6026,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5305
6026
|
}, {
|
|
5306
6027
|
key: "getSharedPreparedAvailabilitySnapshot",
|
|
5307
6028
|
value: function () {
|
|
5308
|
-
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6029
|
+
var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(params) {
|
|
5309
6030
|
var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
|
|
5310
|
-
return _regeneratorRuntime().wrap(function
|
|
5311
|
-
while (1) switch (
|
|
6031
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
6032
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
5312
6033
|
case 0:
|
|
5313
6034
|
lifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
5314
6035
|
normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
|
|
@@ -5327,15 +6048,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5327
6048
|
}
|
|
5328
6049
|
})) : this.buildAvailabilityPrepareKey(normalizedParams);
|
|
5329
6050
|
if (!hasRawInputs) {
|
|
5330
|
-
|
|
6051
|
+
_context54.next = 11;
|
|
5331
6052
|
break;
|
|
5332
6053
|
}
|
|
5333
|
-
|
|
6054
|
+
_context54.next = 7;
|
|
5334
6055
|
return this.buildAvailabilityProjectionSnapshot(normalizedParams);
|
|
5335
6056
|
case 7:
|
|
5336
|
-
snapshot =
|
|
6057
|
+
snapshot = _context54.sent;
|
|
5337
6058
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
5338
|
-
|
|
6059
|
+
_context54.next = 10;
|
|
5339
6060
|
break;
|
|
5340
6061
|
}
|
|
5341
6062
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -5344,7 +6065,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5344
6065
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
5345
6066
|
});
|
|
5346
6067
|
case 10:
|
|
5347
|
-
return
|
|
6068
|
+
return _context54.abrupt("return", {
|
|
5348
6069
|
prepareKey: prepareKey,
|
|
5349
6070
|
snapshot: snapshot
|
|
5350
6071
|
});
|
|
@@ -5358,13 +6079,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5358
6079
|
promise: promise
|
|
5359
6080
|
});
|
|
5360
6081
|
}
|
|
5361
|
-
|
|
5362
|
-
|
|
6082
|
+
_context54.prev = 14;
|
|
6083
|
+
_context54.next = 17;
|
|
5363
6084
|
return promise;
|
|
5364
6085
|
case 17:
|
|
5365
|
-
_snapshot =
|
|
6086
|
+
_snapshot = _context54.sent;
|
|
5366
6087
|
if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
|
|
5367
|
-
|
|
6088
|
+
_context54.next = 20;
|
|
5368
6089
|
break;
|
|
5369
6090
|
}
|
|
5370
6091
|
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
|
|
@@ -5373,24 +6094,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5373
6094
|
currentLifecycleGeneration: this.availabilityLifecycleGeneration
|
|
5374
6095
|
});
|
|
5375
6096
|
case 20:
|
|
5376
|
-
return
|
|
6097
|
+
return _context54.abrupt("return", {
|
|
5377
6098
|
prepareKey: prepareKey,
|
|
5378
6099
|
snapshot: _snapshot
|
|
5379
6100
|
});
|
|
5380
6101
|
case 21:
|
|
5381
|
-
|
|
6102
|
+
_context54.prev = 21;
|
|
5382
6103
|
current = this.availabilityPrepareInFlight.get(prepareKey);
|
|
5383
6104
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
5384
6105
|
this.availabilityPrepareInFlight.delete(prepareKey);
|
|
5385
6106
|
}
|
|
5386
|
-
return
|
|
6107
|
+
return _context54.finish(21);
|
|
5387
6108
|
case 25:
|
|
5388
6109
|
case "end":
|
|
5389
|
-
return
|
|
6110
|
+
return _context54.stop();
|
|
5390
6111
|
}
|
|
5391
|
-
},
|
|
6112
|
+
}, _callee54, this, [[14,, 21, 25]]);
|
|
5392
6113
|
}));
|
|
5393
|
-
function getSharedPreparedAvailabilitySnapshot(
|
|
6114
|
+
function getSharedPreparedAvailabilitySnapshot(_x42) {
|
|
5394
6115
|
return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
|
|
5395
6116
|
}
|
|
5396
6117
|
return getSharedPreparedAvailabilitySnapshot;
|
|
@@ -5398,51 +6119,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5398
6119
|
}, {
|
|
5399
6120
|
key: "refreshAvailabilityContextProjection",
|
|
5400
6121
|
value: function () {
|
|
5401
|
-
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5402
|
-
var
|
|
6122
|
+
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
|
|
6123
|
+
var _this25 = this;
|
|
5403
6124
|
var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
|
|
5404
|
-
return _regeneratorRuntime().wrap(function
|
|
5405
|
-
while (1) switch (
|
|
6125
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
6126
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
5406
6127
|
case 0:
|
|
5407
6128
|
existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
5408
6129
|
if (!existingInFlight) {
|
|
5409
|
-
|
|
6130
|
+
_context56.next = 5;
|
|
5410
6131
|
break;
|
|
5411
6132
|
}
|
|
5412
|
-
|
|
6133
|
+
_context56.next = 4;
|
|
5413
6134
|
return existingInFlight;
|
|
5414
6135
|
case 4:
|
|
5415
|
-
return
|
|
6136
|
+
return _context56.abrupt("return", _context56.sent);
|
|
5416
6137
|
case 5:
|
|
5417
6138
|
context = this.getAvailabilityContextEntry(params.contextId);
|
|
5418
6139
|
expectedVersion = context.activeVersion;
|
|
5419
6140
|
expectedRefreshNonce = context.refreshNonce;
|
|
5420
6141
|
expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
|
|
5421
|
-
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6142
|
+
refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
|
|
5422
6143
|
var snapshot, currentContext, projectionEntry;
|
|
5423
|
-
return _regeneratorRuntime().wrap(function
|
|
5424
|
-
while (1) switch (
|
|
6144
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
6145
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
5425
6146
|
case 0:
|
|
5426
|
-
|
|
5427
|
-
return
|
|
6147
|
+
_context55.next = 2;
|
|
6148
|
+
return _this25.buildAvailabilityProjectionSnapshot(_this25.cloneAvailabilityPrepareParams(context.prepareParams), {
|
|
5428
6149
|
durationCandidateAnchorAt: context.durationCandidateAnchorAt
|
|
5429
6150
|
});
|
|
5430
6151
|
case 2:
|
|
5431
|
-
snapshot =
|
|
5432
|
-
currentContext =
|
|
6152
|
+
snapshot = _context55.sent;
|
|
6153
|
+
currentContext = _this25.availabilityContextRegistry.get(params.contextId);
|
|
5433
6154
|
if (currentContext) {
|
|
5434
|
-
|
|
6155
|
+
_context55.next = 6;
|
|
5435
6156
|
break;
|
|
5436
6157
|
}
|
|
5437
|
-
return
|
|
6158
|
+
return _context55.abrupt("return", null);
|
|
5438
6159
|
case 6:
|
|
5439
|
-
if (!(expectedLifecycleGeneration !==
|
|
5440
|
-
|
|
6160
|
+
if (!(expectedLifecycleGeneration !== _this25.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
|
|
6161
|
+
_context55.next = 8;
|
|
5441
6162
|
break;
|
|
5442
6163
|
}
|
|
5443
|
-
return
|
|
6164
|
+
return _context55.abrupt("return", null);
|
|
5444
6165
|
case 8:
|
|
5445
|
-
projectionEntry =
|
|
6166
|
+
projectionEntry = _this25.storeAvailabilityProjectionEntry({
|
|
5446
6167
|
contextId: currentContext.contextId,
|
|
5447
6168
|
prepareParams: snapshot.prepareParams,
|
|
5448
6169
|
prepareKey: currentContext.prepareKey,
|
|
@@ -5450,8 +6171,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5450
6171
|
orderRevision: snapshot.orderRevision,
|
|
5451
6172
|
incrementVersion: true
|
|
5452
6173
|
});
|
|
5453
|
-
|
|
5454
|
-
return
|
|
6174
|
+
_context55.next = 11;
|
|
6175
|
+
return _this25.emitAvailabilityDiagnostic({
|
|
5455
6176
|
action: 'refresh',
|
|
5456
6177
|
contextId: currentContext.contextId,
|
|
5457
6178
|
contextVersion: projectionEntry.contextVersion,
|
|
@@ -5462,33 +6183,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5462
6183
|
reason: params.reason
|
|
5463
6184
|
});
|
|
5464
6185
|
case 11:
|
|
5465
|
-
return
|
|
6186
|
+
return _context55.abrupt("return", projectionEntry);
|
|
5466
6187
|
case 12:
|
|
5467
6188
|
case "end":
|
|
5468
|
-
return
|
|
6189
|
+
return _context55.stop();
|
|
5469
6190
|
}
|
|
5470
|
-
},
|
|
6191
|
+
}, _callee55);
|
|
5471
6192
|
}))();
|
|
5472
6193
|
this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
|
|
5473
|
-
|
|
5474
|
-
|
|
6194
|
+
_context56.prev = 11;
|
|
6195
|
+
_context56.next = 14;
|
|
5475
6196
|
return refreshPromise;
|
|
5476
6197
|
case 14:
|
|
5477
|
-
return
|
|
6198
|
+
return _context56.abrupt("return", _context56.sent);
|
|
5478
6199
|
case 15:
|
|
5479
|
-
|
|
6200
|
+
_context56.prev = 15;
|
|
5480
6201
|
current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
|
|
5481
6202
|
if (current === refreshPromise) {
|
|
5482
6203
|
this.availabilityProjectionRefreshInFlight.delete(params.contextId);
|
|
5483
6204
|
}
|
|
5484
|
-
return
|
|
6205
|
+
return _context56.finish(15);
|
|
5485
6206
|
case 19:
|
|
5486
6207
|
case "end":
|
|
5487
|
-
return
|
|
6208
|
+
return _context56.stop();
|
|
5488
6209
|
}
|
|
5489
|
-
},
|
|
6210
|
+
}, _callee56, this, [[11,, 15, 19]]);
|
|
5490
6211
|
}));
|
|
5491
|
-
function refreshAvailabilityContextProjection(
|
|
6212
|
+
function refreshAvailabilityContextProjection(_x43) {
|
|
5492
6213
|
return _refreshAvailabilityContextProjection.apply(this, arguments);
|
|
5493
6214
|
}
|
|
5494
6215
|
return refreshAvailabilityContextProjection;
|
|
@@ -5496,53 +6217,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5496
6217
|
}, {
|
|
5497
6218
|
key: "ensureAvailabilityContextProjection",
|
|
5498
6219
|
value: function () {
|
|
5499
|
-
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6220
|
+
var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(contextId, reason) {
|
|
5500
6221
|
var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
|
|
5501
|
-
return _regeneratorRuntime().wrap(function
|
|
5502
|
-
while (1) switch (
|
|
6222
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
|
6223
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
5503
6224
|
case 0:
|
|
5504
6225
|
retries = 0;
|
|
5505
6226
|
case 1:
|
|
5506
6227
|
if (!(retries < 3)) {
|
|
5507
|
-
|
|
6228
|
+
_context57.next = 19;
|
|
5508
6229
|
break;
|
|
5509
6230
|
}
|
|
5510
6231
|
context = this.getAvailabilityContextEntry(contextId);
|
|
5511
6232
|
currentOrderRevision = this.getCurrentOrderRevision();
|
|
5512
6233
|
projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
|
|
5513
6234
|
if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
|
|
5514
|
-
|
|
6235
|
+
_context57.next = 7;
|
|
5515
6236
|
break;
|
|
5516
6237
|
}
|
|
5517
|
-
return
|
|
6238
|
+
return _context57.abrupt("return", {
|
|
5518
6239
|
context: context,
|
|
5519
6240
|
projectionEntry: projectionEntry,
|
|
5520
6241
|
refreshed: false
|
|
5521
6242
|
});
|
|
5522
6243
|
case 7:
|
|
5523
|
-
|
|
6244
|
+
_context57.next = 9;
|
|
5524
6245
|
return this.refreshAvailabilityContextProjection({
|
|
5525
6246
|
contextId: contextId,
|
|
5526
6247
|
reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
|
|
5527
6248
|
previousOrderRevision: context.lastKnownOrderRevision
|
|
5528
6249
|
});
|
|
5529
6250
|
case 9:
|
|
5530
|
-
refreshedProjectionEntry =
|
|
6251
|
+
refreshedProjectionEntry = _context57.sent;
|
|
5531
6252
|
if (refreshedProjectionEntry) {
|
|
5532
|
-
|
|
6253
|
+
_context57.next = 13;
|
|
5533
6254
|
break;
|
|
5534
6255
|
}
|
|
5535
6256
|
retries += 1;
|
|
5536
|
-
return
|
|
6257
|
+
return _context57.abrupt("continue", 1);
|
|
5537
6258
|
case 13:
|
|
5538
6259
|
if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
5539
|
-
|
|
6260
|
+
_context57.next = 16;
|
|
5540
6261
|
break;
|
|
5541
6262
|
}
|
|
5542
6263
|
retries += 1;
|
|
5543
|
-
return
|
|
6264
|
+
return _context57.abrupt("continue", 1);
|
|
5544
6265
|
case 16:
|
|
5545
|
-
return
|
|
6266
|
+
return _context57.abrupt("return", {
|
|
5546
6267
|
context: this.getAvailabilityContextEntry(contextId),
|
|
5547
6268
|
projectionEntry: refreshedProjectionEntry,
|
|
5548
6269
|
refreshed: true
|
|
@@ -5554,11 +6275,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5554
6275
|
});
|
|
5555
6276
|
case 20:
|
|
5556
6277
|
case "end":
|
|
5557
|
-
return
|
|
6278
|
+
return _context57.stop();
|
|
5558
6279
|
}
|
|
5559
|
-
},
|
|
6280
|
+
}, _callee57, this);
|
|
5560
6281
|
}));
|
|
5561
|
-
function ensureAvailabilityContextProjection(
|
|
6282
|
+
function ensureAvailabilityContextProjection(_x44, _x45) {
|
|
5562
6283
|
return _ensureAvailabilityContextProjection.apply(this, arguments);
|
|
5563
6284
|
}
|
|
5564
6285
|
return ensureAvailabilityContextProjection;
|
|
@@ -5566,18 +6287,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5566
6287
|
}, {
|
|
5567
6288
|
key: "tryAcquireAvailabilityCommitLock",
|
|
5568
6289
|
value: function () {
|
|
5569
|
-
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6290
|
+
var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(contextId) {
|
|
5570
6291
|
var _currentContext$activ;
|
|
5571
6292
|
var _waitingContext$activ, waitingContext, currentContext;
|
|
5572
|
-
return _regeneratorRuntime().wrap(function
|
|
5573
|
-
while (1) switch (
|
|
6293
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
|
6294
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
5574
6295
|
case 0:
|
|
5575
6296
|
if (!this.availabilityCommitLocks.has(contextId)) {
|
|
5576
|
-
|
|
6297
|
+
_context58.next = 5;
|
|
5577
6298
|
break;
|
|
5578
6299
|
}
|
|
5579
6300
|
waitingContext = this.availabilityContextRegistry.get(contextId);
|
|
5580
|
-
|
|
6301
|
+
_context58.next = 4;
|
|
5581
6302
|
return this.emitAvailabilityDiagnostic({
|
|
5582
6303
|
action: 'commit_lock_wait',
|
|
5583
6304
|
contextId: contextId,
|
|
@@ -5594,7 +6315,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5594
6315
|
case 5:
|
|
5595
6316
|
this.availabilityCommitLocks.add(contextId);
|
|
5596
6317
|
currentContext = this.availabilityContextRegistry.get(contextId);
|
|
5597
|
-
|
|
6318
|
+
_context58.next = 9;
|
|
5598
6319
|
return this.emitAvailabilityDiagnostic({
|
|
5599
6320
|
action: 'commit_lock_acquired',
|
|
5600
6321
|
contextId: contextId,
|
|
@@ -5606,11 +6327,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5606
6327
|
});
|
|
5607
6328
|
case 9:
|
|
5608
6329
|
case "end":
|
|
5609
|
-
return
|
|
6330
|
+
return _context58.stop();
|
|
5610
6331
|
}
|
|
5611
|
-
},
|
|
6332
|
+
}, _callee58, this);
|
|
5612
6333
|
}));
|
|
5613
|
-
function tryAcquireAvailabilityCommitLock(
|
|
6334
|
+
function tryAcquireAvailabilityCommitLock(_x46) {
|
|
5614
6335
|
return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
|
|
5615
6336
|
}
|
|
5616
6337
|
return tryAcquireAvailabilityCommitLock;
|
|
@@ -5618,15 +6339,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5618
6339
|
}, {
|
|
5619
6340
|
key: "releaseAvailabilityCommitLock",
|
|
5620
6341
|
value: function () {
|
|
5621
|
-
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6342
|
+
var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(contextId) {
|
|
5622
6343
|
var _releasedContext$acti;
|
|
5623
6344
|
var releasedContext;
|
|
5624
|
-
return _regeneratorRuntime().wrap(function
|
|
5625
|
-
while (1) switch (
|
|
6345
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
|
6346
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
5626
6347
|
case 0:
|
|
5627
6348
|
this.availabilityCommitLocks.delete(contextId);
|
|
5628
6349
|
releasedContext = this.availabilityContextRegistry.get(contextId);
|
|
5629
|
-
|
|
6350
|
+
_context59.next = 4;
|
|
5630
6351
|
return this.emitAvailabilityDiagnostic({
|
|
5631
6352
|
action: 'commit_lock_released',
|
|
5632
6353
|
contextId: contextId,
|
|
@@ -5638,11 +6359,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5638
6359
|
});
|
|
5639
6360
|
case 4:
|
|
5640
6361
|
case "end":
|
|
5641
|
-
return
|
|
6362
|
+
return _context59.stop();
|
|
5642
6363
|
}
|
|
5643
|
-
},
|
|
6364
|
+
}, _callee59, this);
|
|
5644
6365
|
}));
|
|
5645
|
-
function releaseAvailabilityCommitLock(
|
|
6366
|
+
function releaseAvailabilityCommitLock(_x47) {
|
|
5646
6367
|
return _releaseAvailabilityCommitLock.apply(this, arguments);
|
|
5647
6368
|
}
|
|
5648
6369
|
return releaseAvailabilityCommitLock;
|
|
@@ -5650,20 +6371,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5650
6371
|
}, {
|
|
5651
6372
|
key: "prepareAvailabilityProjection",
|
|
5652
6373
|
value: (function () {
|
|
5653
|
-
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6374
|
+
var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
|
|
5654
6375
|
var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
|
|
5655
|
-
return _regeneratorRuntime().wrap(function
|
|
5656
|
-
while (1) switch (
|
|
6376
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
|
6377
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
5657
6378
|
case 0:
|
|
5658
6379
|
this.assertAvailabilityPrepareParams(params);
|
|
5659
|
-
|
|
6380
|
+
_context60.next = 3;
|
|
5660
6381
|
return this.resolveAvailabilityPrepareDefaults(params);
|
|
5661
6382
|
case 3:
|
|
5662
|
-
paramsWithDefaults =
|
|
5663
|
-
|
|
6383
|
+
paramsWithDefaults = _context60.sent;
|
|
6384
|
+
_context60.next = 6;
|
|
5664
6385
|
return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
|
|
5665
6386
|
case 6:
|
|
5666
|
-
_yield$this$getShared =
|
|
6387
|
+
_yield$this$getShared = _context60.sent;
|
|
5667
6388
|
prepareKey = _yield$this$getShared.prepareKey;
|
|
5668
6389
|
snapshot = _yield$this$getShared.snapshot;
|
|
5669
6390
|
contextId = this.createAvailabilityContextId();
|
|
@@ -5684,7 +6405,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5684
6405
|
refreshed: false,
|
|
5685
6406
|
reason: 'prepare'
|
|
5686
6407
|
};
|
|
5687
|
-
|
|
6408
|
+
_context60.next = 16;
|
|
5688
6409
|
return this.emitAvailabilityDiagnostic({
|
|
5689
6410
|
action: 'prepare',
|
|
5690
6411
|
contextId: contextId,
|
|
@@ -5695,17 +6416,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5695
6416
|
reason: 'prepare'
|
|
5696
6417
|
});
|
|
5697
6418
|
case 16:
|
|
5698
|
-
|
|
6419
|
+
_context60.next = 18;
|
|
5699
6420
|
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
|
|
5700
6421
|
case 18:
|
|
5701
|
-
return
|
|
6422
|
+
return _context60.abrupt("return", handle);
|
|
5702
6423
|
case 19:
|
|
5703
6424
|
case "end":
|
|
5704
|
-
return
|
|
6425
|
+
return _context60.stop();
|
|
5705
6426
|
}
|
|
5706
|
-
},
|
|
6427
|
+
}, _callee60, this);
|
|
5707
6428
|
}));
|
|
5708
|
-
function prepareAvailabilityProjection(
|
|
6429
|
+
function prepareAvailabilityProjection(_x48) {
|
|
5709
6430
|
return _prepareAvailabilityProjection.apply(this, arguments);
|
|
5710
6431
|
}
|
|
5711
6432
|
return prepareAvailabilityProjection;
|
|
@@ -5713,10 +6434,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5713
6434
|
}, {
|
|
5714
6435
|
key: "getProductTimeRanges",
|
|
5715
6436
|
value: (function () {
|
|
5716
|
-
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6437
|
+
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(contextId) {
|
|
5717
6438
|
var _this$otherParams$pla,
|
|
5718
|
-
_this$
|
|
5719
|
-
|
|
6439
|
+
_this$otherParams38,
|
|
6440
|
+
_this26 = this;
|
|
5720
6441
|
var request,
|
|
5721
6442
|
_yield$this$ensureAva,
|
|
5722
6443
|
context,
|
|
@@ -5725,24 +6446,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5725
6446
|
strictAvailability,
|
|
5726
6447
|
isPosAvailabilityRequest,
|
|
5727
6448
|
allowOutsideOperatingHoursForRequestedStartTimes,
|
|
5728
|
-
|
|
5729
|
-
return _regeneratorRuntime().wrap(function
|
|
5730
|
-
while (1) switch (
|
|
6449
|
+
_args61 = arguments;
|
|
6450
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
|
6451
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
5731
6452
|
case 0:
|
|
5732
|
-
request =
|
|
5733
|
-
|
|
6453
|
+
request = _args61.length > 1 && _args61[1] !== undefined ? _args61[1] : {};
|
|
6454
|
+
_context61.next = 3;
|
|
5734
6455
|
return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
|
|
5735
6456
|
case 3:
|
|
5736
|
-
_yield$this$ensureAva =
|
|
6457
|
+
_yield$this$ensureAva = _context61.sent;
|
|
5737
6458
|
context = _yield$this$ensureAva.context;
|
|
5738
6459
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
5739
6460
|
contextVersion = context.activeVersion;
|
|
5740
6461
|
strictAvailability = context.prepareParams.strictAvailability === true;
|
|
5741
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$
|
|
6462
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase() === 'pos';
|
|
5742
6463
|
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && !strictAvailability && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
5743
6464
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
5744
6465
|
});
|
|
5745
|
-
return
|
|
6466
|
+
return _context61.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), allowOutsideOperatingHoursForRequestedStartTimes ? {
|
|
5746
6467
|
allowOutsideOperatingHoursForRequestedStartTimes: true
|
|
5747
6468
|
} : {}), strictAvailability ? {
|
|
5748
6469
|
allowOutsideOperatingHoursForRequestedStartTimes: false
|
|
@@ -5754,17 +6475,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5754
6475
|
}).map(function (group) {
|
|
5755
6476
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
5756
6477
|
ranges: group.ranges.map(function (candidate) {
|
|
5757
|
-
return
|
|
6478
|
+
return _this26.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
|
|
5758
6479
|
})
|
|
5759
6480
|
});
|
|
5760
6481
|
}));
|
|
5761
6482
|
case 11:
|
|
5762
6483
|
case "end":
|
|
5763
|
-
return
|
|
6484
|
+
return _context61.stop();
|
|
5764
6485
|
}
|
|
5765
|
-
},
|
|
6486
|
+
}, _callee61, this);
|
|
5766
6487
|
}));
|
|
5767
|
-
function getProductTimeRanges(
|
|
6488
|
+
function getProductTimeRanges(_x49) {
|
|
5768
6489
|
return _getProductTimeRanges.apply(this, arguments);
|
|
5769
6490
|
}
|
|
5770
6491
|
return getProductTimeRanges;
|
|
@@ -5772,22 +6493,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5772
6493
|
}, {
|
|
5773
6494
|
key: "queryBookingAvailability",
|
|
5774
6495
|
value: (function () {
|
|
5775
|
-
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5776
|
-
var _this$otherParams$pla2, _this$
|
|
6496
|
+
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(contextId, request) {
|
|
6497
|
+
var _this$otherParams$pla2, _this$otherParams39;
|
|
5777
6498
|
var _yield$this$ensureAva2, context, projectionEntry, refreshed, strictAvailability, isPosAvailabilityRequest, result, contextVersion, contextualResult;
|
|
5778
|
-
return _regeneratorRuntime().wrap(function
|
|
5779
|
-
while (1) switch (
|
|
6499
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
6500
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
5780
6501
|
case 0:
|
|
5781
|
-
|
|
6502
|
+
_context62.next = 2;
|
|
5782
6503
|
return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
|
|
5783
6504
|
case 2:
|
|
5784
|
-
_yield$this$ensureAva2 =
|
|
6505
|
+
_yield$this$ensureAva2 = _context62.sent;
|
|
5785
6506
|
context = _yield$this$ensureAva2.context;
|
|
5786
6507
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
5787
6508
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
5788
6509
|
this.assertContextualQueryFreshness(context, request);
|
|
5789
6510
|
strictAvailability = context.prepareParams.strictAvailability === true;
|
|
5790
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$
|
|
6511
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
5791
6512
|
result = queryAvailabilityProjection(projectionEntry.projection, request, {
|
|
5792
6513
|
useExactDurationCandidateMinute: isPosAvailabilityRequest && !strictAvailability,
|
|
5793
6514
|
allowExcludedScheduleDateOverride: isPosAvailabilityRequest && !strictAvailability
|
|
@@ -5818,18 +6539,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5818
6539
|
});
|
|
5819
6540
|
})
|
|
5820
6541
|
}) : result;
|
|
5821
|
-
return
|
|
6542
|
+
return _context62.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
|
|
5822
6543
|
contextId: context.contextId,
|
|
5823
6544
|
contextVersion: contextVersion,
|
|
5824
6545
|
refreshed: refreshed
|
|
5825
6546
|
}));
|
|
5826
6547
|
case 13:
|
|
5827
6548
|
case "end":
|
|
5828
|
-
return
|
|
6549
|
+
return _context62.stop();
|
|
5829
6550
|
}
|
|
5830
|
-
},
|
|
6551
|
+
}, _callee62, this);
|
|
5831
6552
|
}));
|
|
5832
|
-
function queryBookingAvailability(
|
|
6553
|
+
function queryBookingAvailability(_x50, _x51) {
|
|
5833
6554
|
return _queryBookingAvailability.apply(this, arguments);
|
|
5834
6555
|
}
|
|
5835
6556
|
return queryBookingAvailability;
|
|
@@ -5900,9 +6621,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5900
6621
|
}, {
|
|
5901
6622
|
key: "findLinkedBooking",
|
|
5902
6623
|
value: function findLinkedBooking(product) {
|
|
5903
|
-
var
|
|
6624
|
+
var _ref59, _product$booking_uid3, _product$metadata7, _this$getTempOrder4;
|
|
5904
6625
|
var productUid = getProductLineUid(product);
|
|
5905
|
-
var bookingUid = String((
|
|
6626
|
+
var bookingUid = String((_ref59 = (_product$booking_uid3 = product.booking_uid) !== null && _product$booking_uid3 !== void 0 ? _product$booking_uid3 : (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.booking_uid) !== null && _ref59 !== void 0 ? _ref59 : '');
|
|
5906
6627
|
return (((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.bookings) || []).find(function (booking) {
|
|
5907
6628
|
var _booking$product_uid3;
|
|
5908
6629
|
return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
|
|
@@ -5913,19 +6634,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5913
6634
|
}, {
|
|
5914
6635
|
key: "commitAvailabilitySelection",
|
|
5915
6636
|
value: (function () {
|
|
5916
|
-
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6637
|
+
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(contextId, params) {
|
|
5917
6638
|
var _this$availabilityCon,
|
|
5918
6639
|
_params$availabilityC3,
|
|
5919
6640
|
_this$store$order11,
|
|
5920
6641
|
_this$store$order11$e,
|
|
5921
|
-
|
|
5922
|
-
var normalizedContextId, isEditingSelection, isPartyReplacement, strictAvailability, hasCommitGuard, guardedOrder, getGuardedCommitIdentity, guardedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount,
|
|
5923
|
-
return _regeneratorRuntime().wrap(function
|
|
5924
|
-
while (1) switch (
|
|
6642
|
+
_this27 = this;
|
|
6643
|
+
var normalizedContextId, isEditingSelection, isPartyReplacement, strictAvailability, hasCommitGuard, guardedOrder, getGuardedCommitIdentity, guardedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref60, _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$otherParams40, _params$orderProduct$3, _params$orderProduct6, _existingBooking$hold, _existingBooking$meta, _ref61, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$meta3, _existingBooking$hold2, _transformed$metadata, _nextContext$activeVe, 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, availabilityCommitGuard, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, relatedRetailProducts, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref62, _transformed$product_4, update, _this$getTempOrder5, _this$getTempOrder6, _params$salesNotes, _params$salesNotes2, _ref63, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
|
|
6644
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6645
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
5925
6646
|
case 0:
|
|
5926
6647
|
normalizedContextId = String(contextId || '').trim();
|
|
5927
6648
|
if (normalizedContextId) {
|
|
5928
|
-
|
|
6649
|
+
_context63.next = 3;
|
|
5929
6650
|
break;
|
|
5930
6651
|
}
|
|
5931
6652
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
|
|
@@ -5935,7 +6656,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5935
6656
|
isEditingSelection = params.mode === 'edit' || params.mode === 'replace';
|
|
5936
6657
|
isPartyReplacement = params.mode === 'replace' || params.relatedRetailProducts !== undefined;
|
|
5937
6658
|
if (!(isPartyReplacement && (!isEditingSelection || !Array.isArray(params.relatedRetailProducts)))) {
|
|
5938
|
-
|
|
6659
|
+
_context63.next = 7;
|
|
5939
6660
|
break;
|
|
5940
6661
|
}
|
|
5941
6662
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'Party replacement requires edit/replace mode and the confirmed complete extras array');
|
|
@@ -5947,27 +6668,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5947
6668
|
if (hasCommitGuard) (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$e = _this$store$order11.ensureTempOrder) === null || _this$store$order11$e === void 0 || _this$store$order11$e.call(_this$store$order11);
|
|
5948
6669
|
guardedOrder = hasCommitGuard ? this.getTempOrder() : null;
|
|
5949
6670
|
getGuardedCommitIdentity = function getGuardedCommitIdentity() {
|
|
5950
|
-
var
|
|
6671
|
+
var _this27$otherParams$s, _this27$otherParams, _this27$otherParams2, _this27$core, _this27$getTempOrder, _this27$getTempOrder2;
|
|
5951
6672
|
return JSON.stringify(stableValue({
|
|
5952
|
-
scope:
|
|
5953
|
-
shopId: (
|
|
5954
|
-
contextShopId: (
|
|
5955
|
-
orderId: (
|
|
5956
|
-
externalSaleNumber: (
|
|
6673
|
+
scope: _this27.getAvailabilityScopeDescriptor(),
|
|
6674
|
+
shopId: (_this27$otherParams$s = (_this27$otherParams = _this27.otherParams) === null || _this27$otherParams === void 0 ? void 0 : _this27$otherParams.shop_id) !== null && _this27$otherParams$s !== void 0 ? _this27$otherParams$s : (_this27$otherParams2 = _this27.otherParams) === null || _this27$otherParams2 === void 0 ? void 0 : _this27$otherParams2.shopId,
|
|
6675
|
+
contextShopId: (_this27$core = _this27.core) === null || _this27$core === void 0 || (_this27$core = _this27$core.context) === null || _this27$core === void 0 ? void 0 : _this27$core.shop_id,
|
|
6676
|
+
orderId: (_this27$getTempOrder = _this27.getTempOrder()) === null || _this27$getTempOrder === void 0 ? void 0 : _this27$getTempOrder.order_id,
|
|
6677
|
+
externalSaleNumber: (_this27$getTempOrder2 = _this27.getTempOrder()) === null || _this27$getTempOrder2 === void 0 ? void 0 : _this27$getTempOrder2.external_sale_number
|
|
5957
6678
|
}));
|
|
5958
6679
|
};
|
|
5959
6680
|
guardedCommitIdentity = hasCommitGuard ? getGuardedCommitIdentity() : '';
|
|
5960
6681
|
availabilityCommitTargetGuard = function availabilityCommitTargetGuard() {
|
|
5961
|
-
return
|
|
6682
|
+
return _this27.getTempOrder() === guardedOrder && getGuardedCommitIdentity() === guardedCommitIdentity;
|
|
5962
6683
|
};
|
|
5963
6684
|
guardedCommitPublished = false;
|
|
5964
|
-
|
|
6685
|
+
_context63.next = 18;
|
|
5965
6686
|
return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
|
|
5966
6687
|
case 18:
|
|
5967
|
-
|
|
6688
|
+
_context63.prev = 18;
|
|
5968
6689
|
bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
|
|
5969
6690
|
if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
|
|
5970
|
-
|
|
6691
|
+
_context63.next = 22;
|
|
5971
6692
|
break;
|
|
5972
6693
|
}
|
|
5973
6694
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
|
|
@@ -5975,16 +6696,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5975
6696
|
});
|
|
5976
6697
|
case 22:
|
|
5977
6698
|
if (!(isEditingSelection && bookingCount !== 1)) {
|
|
5978
|
-
|
|
6699
|
+
_context63.next = 24;
|
|
5979
6700
|
break;
|
|
5980
6701
|
}
|
|
5981
6702
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
|
|
5982
6703
|
bookingCount: bookingCount
|
|
5983
6704
|
});
|
|
5984
6705
|
case 24:
|
|
5985
|
-
orderProductQuantity = (
|
|
6706
|
+
orderProductQuantity = (_ref60 = (_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 && _ref60 !== void 0 ? _ref60 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
|
|
5986
6707
|
if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
|
|
5987
|
-
|
|
6708
|
+
_context63.next = 27;
|
|
5988
6709
|
break;
|
|
5989
6710
|
}
|
|
5990
6711
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
|
|
@@ -5994,22 +6715,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5994
6715
|
case 27:
|
|
5995
6716
|
partySize = Number(params.partySize);
|
|
5996
6717
|
if (!(!Number.isInteger(partySize) || partySize <= 0)) {
|
|
5997
|
-
|
|
6718
|
+
_context63.next = 30;
|
|
5998
6719
|
break;
|
|
5999
6720
|
}
|
|
6000
6721
|
throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
|
|
6001
6722
|
partySize: params.partySize
|
|
6002
6723
|
});
|
|
6003
6724
|
case 30:
|
|
6004
|
-
|
|
6725
|
+
_context63.next = 32;
|
|
6005
6726
|
return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
|
|
6006
6727
|
case 32:
|
|
6007
|
-
_yield$this$ensureAva3 =
|
|
6728
|
+
_yield$this$ensureAva3 = _context63.sent;
|
|
6008
6729
|
context = _yield$this$ensureAva3.context;
|
|
6009
6730
|
projectionEntry = _yield$this$ensureAva3.projectionEntry;
|
|
6010
6731
|
refreshed = _yield$this$ensureAva3.refreshed;
|
|
6011
6732
|
if (!refreshed) {
|
|
6012
|
-
|
|
6733
|
+
_context63.next = 38;
|
|
6013
6734
|
break;
|
|
6014
6735
|
}
|
|
6015
6736
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -6020,11 +6741,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6020
6741
|
case 38:
|
|
6021
6742
|
boundEditingUids = context.prepareParams.editingProductLineUids || [];
|
|
6022
6743
|
if (!isEditingSelection) {
|
|
6023
|
-
|
|
6744
|
+
_context63.next = 44;
|
|
6024
6745
|
break;
|
|
6025
6746
|
}
|
|
6026
6747
|
if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
|
|
6027
|
-
|
|
6748
|
+
_context63.next = 42;
|
|
6028
6749
|
break;
|
|
6029
6750
|
}
|
|
6030
6751
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
|
|
@@ -6033,11 +6754,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6033
6754
|
editingProductLineUids: boundEditingUids
|
|
6034
6755
|
});
|
|
6035
6756
|
case 42:
|
|
6036
|
-
|
|
6757
|
+
_context63.next = 46;
|
|
6037
6758
|
break;
|
|
6038
6759
|
case 44:
|
|
6039
6760
|
if (!(boundEditingUids.length > 0)) {
|
|
6040
|
-
|
|
6761
|
+
_context63.next = 46;
|
|
6041
6762
|
break;
|
|
6042
6763
|
}
|
|
6043
6764
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
|
|
@@ -6046,7 +6767,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6046
6767
|
});
|
|
6047
6768
|
case 46:
|
|
6048
6769
|
if (!(projectionEntry.contextVersion !== context.activeVersion)) {
|
|
6049
|
-
|
|
6770
|
+
_context63.next = 48;
|
|
6050
6771
|
break;
|
|
6051
6772
|
}
|
|
6052
6773
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
|
|
@@ -6056,7 +6777,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6056
6777
|
});
|
|
6057
6778
|
case 48:
|
|
6058
6779
|
if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
|
|
6059
|
-
|
|
6780
|
+
_context63.next = 50;
|
|
6060
6781
|
break;
|
|
6061
6782
|
}
|
|
6062
6783
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
|
|
@@ -6067,7 +6788,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6067
6788
|
});
|
|
6068
6789
|
case 50:
|
|
6069
6790
|
if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
|
|
6070
|
-
|
|
6791
|
+
_context63.next = 52;
|
|
6071
6792
|
break;
|
|
6072
6793
|
}
|
|
6073
6794
|
throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
|
|
@@ -6079,7 +6800,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6079
6800
|
this.assertAvailabilityCandidateFreshness(context, params.candidate);
|
|
6080
6801
|
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;
|
|
6081
6802
|
if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
|
|
6082
|
-
|
|
6803
|
+
_context63.next = 56;
|
|
6083
6804
|
break;
|
|
6084
6805
|
}
|
|
6085
6806
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
|
|
@@ -6088,14 +6809,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6088
6809
|
});
|
|
6089
6810
|
case 56:
|
|
6090
6811
|
if (!(isEditingSelection && !params.productLineUid)) {
|
|
6091
|
-
|
|
6812
|
+
_context63.next = 58;
|
|
6092
6813
|
break;
|
|
6093
6814
|
}
|
|
6094
6815
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
|
|
6095
6816
|
case 58:
|
|
6096
6817
|
editingLine = isEditingSelection ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
|
|
6097
6818
|
if (!(isEditingSelection && !editingLine)) {
|
|
6098
|
-
|
|
6819
|
+
_context63.next = 61;
|
|
6099
6820
|
break;
|
|
6100
6821
|
}
|
|
6101
6822
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
|
|
@@ -6103,7 +6824,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6103
6824
|
});
|
|
6104
6825
|
case 61:
|
|
6105
6826
|
if (!(editingLine && params.mode !== 'replace' && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
|
|
6106
|
-
|
|
6827
|
+
_context63.next = 63;
|
|
6107
6828
|
break;
|
|
6108
6829
|
}
|
|
6109
6830
|
throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
|
|
@@ -6113,7 +6834,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6113
6834
|
});
|
|
6114
6835
|
case 63:
|
|
6115
6836
|
if (Array.isArray(params.requirementSelections)) {
|
|
6116
|
-
|
|
6837
|
+
_context63.next = 65;
|
|
6117
6838
|
break;
|
|
6118
6839
|
}
|
|
6119
6840
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
|
|
@@ -6130,7 +6851,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6130
6851
|
};
|
|
6131
6852
|
prepareParams = baseProjection.meta.prepareParams;
|
|
6132
6853
|
if (prepareParams) {
|
|
6133
|
-
|
|
6854
|
+
_context63.next = 70;
|
|
6134
6855
|
break;
|
|
6135
6856
|
}
|
|
6136
6857
|
throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
|
|
@@ -6142,7 +6863,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6142
6863
|
})),
|
|
6143
6864
|
includesInjectedRawOccupancies: true
|
|
6144
6865
|
};
|
|
6145
|
-
|
|
6866
|
+
_context63.next = 73;
|
|
6146
6867
|
return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
|
|
6147
6868
|
editingProductLineUids: isEditingSelection && params.productLineUid ? [params.productLineUid] : []
|
|
6148
6869
|
}), {
|
|
@@ -6151,13 +6872,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6151
6872
|
durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
|
|
6152
6873
|
});
|
|
6153
6874
|
case 73:
|
|
6154
|
-
commitSnapshot =
|
|
6875
|
+
commitSnapshot = _context63.sent;
|
|
6155
6876
|
refreshedProjection = commitSnapshot.projection;
|
|
6156
6877
|
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 : ''))) {
|
|
6157
|
-
|
|
6878
|
+
_context63.next = 80;
|
|
6158
6879
|
break;
|
|
6159
6880
|
}
|
|
6160
|
-
|
|
6881
|
+
_context63.next = 78;
|
|
6161
6882
|
return this.refreshAvailabilityContextProjection({
|
|
6162
6883
|
contextId: normalizedContextId,
|
|
6163
6884
|
reason: 'commit_order_revision_changed',
|
|
@@ -6178,7 +6899,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6178
6899
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
6179
6900
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
6180
6901
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
6181
|
-
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$
|
|
6902
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$otherParams40 = this.otherParams) === null || _this$otherParams40 === void 0 ? void 0 : _this$otherParams40.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos' && !strictAvailability;
|
|
6182
6903
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
6183
6904
|
productIds: [params.candidate.productId],
|
|
6184
6905
|
dateRange: {
|
|
@@ -6204,7 +6925,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6204
6925
|
return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
|
|
6205
6926
|
});
|
|
6206
6927
|
if (refreshedCandidateBase) {
|
|
6207
|
-
|
|
6928
|
+
_context63.next = 88;
|
|
6208
6929
|
break;
|
|
6209
6930
|
}
|
|
6210
6931
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
|
|
@@ -6217,7 +6938,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6217
6938
|
return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
|
|
6218
6939
|
});
|
|
6219
6940
|
if (product) {
|
|
6220
|
-
|
|
6941
|
+
_context63.next = 91;
|
|
6221
6942
|
break;
|
|
6222
6943
|
}
|
|
6223
6944
|
throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
|
|
@@ -6254,7 +6975,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6254
6975
|
});
|
|
6255
6976
|
}
|
|
6256
6977
|
if (validation.ok) {
|
|
6257
|
-
|
|
6978
|
+
_context63.next = 96;
|
|
6258
6979
|
break;
|
|
6259
6980
|
}
|
|
6260
6981
|
capacityConflict = validation.conflicts.find(function (conflict) {
|
|
@@ -6277,7 +6998,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6277
6998
|
incrementVersion: true
|
|
6278
6999
|
});
|
|
6279
7000
|
revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
|
|
6280
|
-
|
|
7001
|
+
_context63.next = 100;
|
|
6281
7002
|
return this.emitAvailabilityDiagnostic({
|
|
6282
7003
|
action: 'refresh',
|
|
6283
7004
|
contextId: normalizedContextId,
|
|
@@ -6301,9 +7022,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6301
7022
|
availabilityCommitGuard = hasCommitGuard ? function () {
|
|
6302
7023
|
var _params$availabilityC4;
|
|
6303
7024
|
(_params$availabilityC4 = params.availabilityCommitGuard) === null || _params$availabilityC4 === void 0 || _params$availabilityC4.call(params);
|
|
6304
|
-
|
|
7025
|
+
_this27.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
6305
7026
|
if (!availabilityCommitTargetGuard()) {
|
|
6306
|
-
throw
|
|
7027
|
+
throw _this27.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '预约加购期间订单或业务已变化');
|
|
6307
7028
|
}
|
|
6308
7029
|
if (!strictAvailability) return;
|
|
6309
7030
|
var currentValidation = validateAvailabilitySelection(refreshedProjection, {
|
|
@@ -6321,7 +7042,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6321
7042
|
existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
|
|
6322
7043
|
existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
|
|
6323
7044
|
if (!(isEditingSelection && !existingBookingUid)) {
|
|
6324
|
-
|
|
7045
|
+
_context63.next = 107;
|
|
6325
7046
|
break;
|
|
6326
7047
|
}
|
|
6327
7048
|
throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
|
|
@@ -6336,7 +7057,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6336
7057
|
resources: refreshedProjection.resources,
|
|
6337
7058
|
bookingUid: existingBookingUid || undefined,
|
|
6338
7059
|
holder: (_params$orderProduct$3 = (_params$orderProduct6 = params.orderProduct) === null || _params$orderProduct6 === void 0 || (_params$orderProduct6 = _params$orderProduct6._extend) === null || _params$orderProduct6 === void 0 ? void 0 : _params$orderProduct6.holder) !== null && _params$orderProduct$3 !== void 0 ? _params$orderProduct$3 : params.mode === 'replace' ? undefined : (_existingBooking$hold = existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _existingBooking$hold !== void 0 ? _existingBooking$hold : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
|
|
6339
|
-
holderIds: (
|
|
7060
|
+
holderIds: (_ref61 = (_params$orderProduct$4 = (_params$orderProduct7 = params.orderProduct) === null || _params$orderProduct7 === void 0 || (_params$orderProduct7 = _params$orderProduct7._extend) === null || _params$orderProduct7 === void 0 ? void 0 : _params$orderProduct7.holder_id) !== null && _params$orderProduct$4 !== void 0 ? _params$orderProduct$4 : (_params$orderProduct8 = params.orderProduct) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8._extend) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8.holder) === null || _params$orderProduct8 === void 0 ? void 0 : _params$orderProduct8.form_record) !== null && _ref61 !== void 0 ? _ref61 : params.mode === 'replace' ? undefined : (_existingBooking$meta2 = existingBooking === null || existingBooking === void 0 || (_existingBooking$meta3 = existingBooking.metadata) === null || _existingBooking$meta3 === void 0 ? void 0 : _existingBooking$meta3.holder_id) !== null && _existingBooking$meta2 !== void 0 ? _existingBooking$meta2 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold2 = existingBooking.holder) === null || _existingBooking$hold2 === void 0 ? void 0 : _existingBooking$hold2.form_record
|
|
6340
7061
|
});
|
|
6341
7062
|
if (params.mode === 'replace') {
|
|
6342
7063
|
// A different product must not inherit the previous product/resource's completed forms.
|
|
@@ -6348,7 +7069,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6348
7069
|
quantity: bookingCount
|
|
6349
7070
|
}), 'unified_booking_sales', product);
|
|
6350
7071
|
if (transformed) {
|
|
6351
|
-
|
|
7072
|
+
_context63.next = 113;
|
|
6352
7073
|
break;
|
|
6353
7074
|
}
|
|
6354
7075
|
throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
|
|
@@ -6369,12 +7090,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6369
7090
|
productLineUids = [];
|
|
6370
7091
|
bookingUids = [];
|
|
6371
7092
|
if (!(isPartyReplacement && editingLine && params.productLineUid)) {
|
|
6372
|
-
|
|
7093
|
+
_context63.next = 130;
|
|
6373
7094
|
break;
|
|
6374
7095
|
}
|
|
6375
7096
|
relatedRetailProducts = params.relatedRetailProducts.map(function (source) {
|
|
6376
7097
|
var _line$metadata3;
|
|
6377
|
-
var line =
|
|
7098
|
+
var line = _this27.buildUnifiedOrderProduct(source, 'unified_booking_sales_retail');
|
|
6378
7099
|
if (!line) throw new AvailabilityError('INVALID_TARGET_FILTER', '无法生成附加商品订单行');
|
|
6379
7100
|
if (((_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.venue_booking_role) === 'party_extra') {
|
|
6380
7101
|
line.holder_config = {
|
|
@@ -6395,7 +7116,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6395
7116
|
}
|
|
6396
7117
|
return line;
|
|
6397
7118
|
});
|
|
6398
|
-
|
|
7119
|
+
_context63.next = 123;
|
|
6399
7120
|
return this.store.order.replaceBookingProductWithRelatedRetail({
|
|
6400
7121
|
productLineUid: params.productLineUid,
|
|
6401
7122
|
product: transformed,
|
|
@@ -6410,11 +7131,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6410
7131
|
bookingUid = existingBookingUid;
|
|
6411
7132
|
productLineUids = [productLineUid];
|
|
6412
7133
|
bookingUids = [bookingUid];
|
|
6413
|
-
|
|
7134
|
+
_context63.next = 164;
|
|
6414
7135
|
break;
|
|
6415
7136
|
case 130:
|
|
6416
7137
|
if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
|
|
6417
|
-
|
|
7138
|
+
_context63.next = 150;
|
|
6418
7139
|
break;
|
|
6419
7140
|
}
|
|
6420
7141
|
transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
|
|
@@ -6426,7 +7147,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6426
7147
|
});
|
|
6427
7148
|
update = _objectSpread(_objectSpread({
|
|
6428
7149
|
product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
|
|
6429
|
-
product_variant_id: (
|
|
7150
|
+
product_variant_id: (_ref62 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref62 !== void 0 ? _ref62 : 0,
|
|
6430
7151
|
unique_identification_number: params.productLineUid,
|
|
6431
7152
|
updates: transformed,
|
|
6432
7153
|
booking: booking
|
|
@@ -6436,27 +7157,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6436
7157
|
allow_booking_discount_reapply: params.allowBookingDiscountReapply
|
|
6437
7158
|
} : {});
|
|
6438
7159
|
if (!availabilityCommitGuard) {
|
|
6439
|
-
|
|
7160
|
+
_context63.next = 142;
|
|
6440
7161
|
break;
|
|
6441
7162
|
}
|
|
6442
|
-
|
|
7163
|
+
_context63.next = 139;
|
|
6443
7164
|
return this.updateOrderProducts([update], {
|
|
6444
7165
|
beforeApply: availabilityCommitGuard,
|
|
6445
7166
|
isCurrentOrder: availabilityCommitTargetGuard
|
|
6446
7167
|
});
|
|
6447
7168
|
case 139:
|
|
6448
7169
|
guardedCommitPublished = true;
|
|
6449
|
-
|
|
7170
|
+
_context63.next = 144;
|
|
6450
7171
|
break;
|
|
6451
7172
|
case 142:
|
|
6452
|
-
|
|
7173
|
+
_context63.next = 144;
|
|
6453
7174
|
return this.updateOrderProduct(update);
|
|
6454
7175
|
case 144:
|
|
6455
7176
|
productLineUid = params.productLineUid;
|
|
6456
7177
|
bookingUid = existingBookingUid;
|
|
6457
7178
|
productLineUids = [productLineUid];
|
|
6458
7179
|
bookingUids = [bookingUid];
|
|
6459
|
-
|
|
7180
|
+
_context63.next = 164;
|
|
6460
7181
|
break;
|
|
6461
7182
|
case 150:
|
|
6462
7183
|
beforeProductLineUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || []).map(function (line) {
|
|
@@ -6466,7 +7187,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6466
7187
|
return getBookingUid(item);
|
|
6467
7188
|
}).filter(Boolean));
|
|
6468
7189
|
availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
|
|
6469
|
-
|
|
7190
|
+
_context63.next = 155;
|
|
6470
7191
|
return this.addProductToOrder(transformed, booking, (_params$salesNotes = params.salesNotes) !== null && _params$salesNotes !== void 0 && _params$salesNotes.length || availabilityCommitGuard ? _objectSpread(_objectSpread({}, (_params$salesNotes2 = params.salesNotes) !== null && _params$salesNotes2 !== void 0 && _params$salesNotes2.length ? {
|
|
6471
7192
|
salesNotes: params.salesNotes
|
|
6472
7193
|
} : {}), availabilityCommitGuard ? {
|
|
@@ -6474,7 +7195,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6474
7195
|
availabilityCommitTargetGuard: availabilityCommitTargetGuard
|
|
6475
7196
|
} : {}) : undefined);
|
|
6476
7197
|
case 155:
|
|
6477
|
-
products =
|
|
7198
|
+
products = _context63.sent;
|
|
6478
7199
|
guardedCommitPublished = hasCommitGuard;
|
|
6479
7200
|
addedLines = products.filter(function (line) {
|
|
6480
7201
|
var _line$product_id, _line$metadata4;
|
|
@@ -6483,7 +7204,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6483
7204
|
productLineUids = addedLines.map(function (line) {
|
|
6484
7205
|
return getProductLineUid(line);
|
|
6485
7206
|
}).filter(Boolean);
|
|
6486
|
-
addedBookings = (((
|
|
7207
|
+
addedBookings = (((_ref63 = hasCommitGuard ? guardedOrder : this.getTempOrder()) === null || _ref63 === void 0 ? void 0 : _ref63.bookings) || []).filter(function (item) {
|
|
6487
7208
|
var _item$metadata;
|
|
6488
7209
|
return ((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.availability_candidate_key) === refreshedCandidate.key && !beforeBookingUids.has(getBookingUid(item));
|
|
6489
7210
|
});
|
|
@@ -6492,8 +7213,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6492
7213
|
}).filter(Boolean);
|
|
6493
7214
|
if (bookingUids.length === 0) {
|
|
6494
7215
|
bookingUids = addedLines.map(function (line) {
|
|
6495
|
-
var
|
|
6496
|
-
return String((
|
|
7216
|
+
var _ref64, _line$booking_uid, _line$metadata5;
|
|
7217
|
+
return String((_ref64 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata5 = line.metadata) === null || _line$metadata5 === void 0 ? void 0 : _line$metadata5.booking_uid) !== null && _ref64 !== void 0 ? _ref64 : '');
|
|
6497
7218
|
}).filter(Boolean);
|
|
6498
7219
|
}
|
|
6499
7220
|
productLineUid = productLineUids[productLineUids.length - 1] || '';
|
|
@@ -6514,60 +7235,60 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6514
7235
|
bookingUids: bookingUids
|
|
6515
7236
|
};
|
|
6516
7237
|
if (!targetStillCurrent) {
|
|
6517
|
-
|
|
7238
|
+
_context63.next = 182;
|
|
6518
7239
|
break;
|
|
6519
7240
|
}
|
|
6520
7241
|
// A notification failure after publication must not invite a duplicate add.
|
|
6521
7242
|
emit = function emit() {
|
|
6522
|
-
return
|
|
7243
|
+
return _this27.core.effects.emit("".concat(_this27.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
6523
7244
|
};
|
|
6524
7245
|
if (!guardedCommitPublished) {
|
|
6525
|
-
|
|
7246
|
+
_context63.next = 180;
|
|
6526
7247
|
break;
|
|
6527
7248
|
}
|
|
6528
|
-
|
|
6529
|
-
|
|
7249
|
+
_context63.prev = 171;
|
|
7250
|
+
_context63.next = 174;
|
|
6530
7251
|
return emit();
|
|
6531
7252
|
case 174:
|
|
6532
|
-
|
|
7253
|
+
_context63.next = 178;
|
|
6533
7254
|
break;
|
|
6534
7255
|
case 176:
|
|
6535
|
-
|
|
6536
|
-
|
|
7256
|
+
_context63.prev = 176;
|
|
7257
|
+
_context63.t0 = _context63["catch"](171);
|
|
6537
7258
|
case 178:
|
|
6538
|
-
|
|
7259
|
+
_context63.next = 182;
|
|
6539
7260
|
break;
|
|
6540
7261
|
case 180:
|
|
6541
|
-
|
|
7262
|
+
_context63.next = 182;
|
|
6542
7263
|
return emit();
|
|
6543
7264
|
case 182:
|
|
6544
|
-
return
|
|
7265
|
+
return _context63.abrupt("return", result);
|
|
6545
7266
|
case 183:
|
|
6546
|
-
|
|
7267
|
+
_context63.prev = 183;
|
|
6547
7268
|
release = this.releaseAvailabilityCommitLock(normalizedContextId);
|
|
6548
7269
|
if (!guardedCommitPublished) {
|
|
6549
|
-
|
|
7270
|
+
_context63.next = 190;
|
|
6550
7271
|
break;
|
|
6551
7272
|
}
|
|
6552
|
-
|
|
7273
|
+
_context63.next = 188;
|
|
6553
7274
|
return release.catch(function () {
|
|
6554
7275
|
return undefined;
|
|
6555
7276
|
});
|
|
6556
7277
|
case 188:
|
|
6557
|
-
|
|
7278
|
+
_context63.next = 192;
|
|
6558
7279
|
break;
|
|
6559
7280
|
case 190:
|
|
6560
|
-
|
|
7281
|
+
_context63.next = 192;
|
|
6561
7282
|
return release;
|
|
6562
7283
|
case 192:
|
|
6563
|
-
return
|
|
7284
|
+
return _context63.finish(183);
|
|
6564
7285
|
case 193:
|
|
6565
7286
|
case "end":
|
|
6566
|
-
return
|
|
7287
|
+
return _context63.stop();
|
|
6567
7288
|
}
|
|
6568
|
-
},
|
|
7289
|
+
}, _callee63, this, [[18,, 183, 193], [171, 176]]);
|
|
6569
7290
|
}));
|
|
6570
|
-
function commitAvailabilitySelection(
|
|
7291
|
+
function commitAvailabilitySelection(_x52, _x53) {
|
|
6571
7292
|
return _commitAvailabilitySelection.apply(this, arguments);
|
|
6572
7293
|
}
|
|
6573
7294
|
return commitAvailabilitySelection;
|