@pisell/pisellos 2.3.152 → 2.3.154

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.
@@ -36,6 +36,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
36
36
  import dayjs from 'dayjs';
37
37
  import { cloneDeep } from 'lodash-es';
38
38
  import { OpenDataModule } from "../../modules";
39
+ import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
39
40
  import { isProductFlexibleDuration } from "../../modules/BookingContext/utils";
40
41
  import { cacheItemToBookingInput } from "../../modules/BookingContext/utils/cacheItemToBookingInput";
41
42
  import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings } from "../../modules/OpenData";
@@ -940,6 +941,20 @@ function getProductLineUid(product) {
940
941
  var _ref18, _product$metadata$uni, _product$metadata2;
941
942
  return String((_ref18 = (_product$metadata$uni = product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.unique_identification_number) !== null && _product$metadata$uni !== void 0 ? _product$metadata$uni : product === null || product === void 0 ? void 0 : product.unique_identification_number) !== null && _ref18 !== void 0 ? _ref18 : '');
942
943
  }
944
+ function getVisibleCalendarDate(value) {
945
+ if (typeof value !== 'string') return null;
946
+ var raw = value.trim();
947
+ try {
948
+ if (/^\d{4}-\d{2}-\d{2}$/.test(raw)) {
949
+ parseLocalDate(raw);
950
+ } else {
951
+ parseLocalDateTime(raw);
952
+ }
953
+ return raw.slice(0, 10);
954
+ } catch (_error) {
955
+ return null;
956
+ }
957
+ }
943
958
  export function buildAvailabilityLineIdentity(product) {
944
959
  var _product$product_vari;
945
960
  return {
@@ -2033,17 +2048,112 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2033
2048
  (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$cle = _this$store$order.clearSessionStoragePersistedTempOrder) === null || _this$store$order$cle === void 0 || _this$store$order$cle.call(_this$store$order);
2034
2049
  }
2035
2050
 
2051
+ /** 在 Kiosk 拉起支付设备前补齐订单号,同一订单重试复用已分配的号码。 */
2052
+ }, {
2053
+ key: "ensureLocalOrderNumbersForCheckout",
2054
+ value: (function () {
2055
+ var _ensureLocalOrderNumbersForCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
2056
+ var _this$otherParams14, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2;
2057
+ var order, tempOrder, biz, idGenerator;
2058
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
2059
+ while (1) switch (_context7.prev = _context7.next) {
2060
+ case 0:
2061
+ if (!(normalizeRuntimePlatform((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform) !== 'kiosk')) {
2062
+ _context7.next = 2;
2063
+ break;
2064
+ }
2065
+ return _context7.abrupt("return");
2066
+ case 2:
2067
+ order = this.store.order;
2068
+ tempOrder = order === null || order === void 0 ? void 0 : order.getTempOrder();
2069
+ if (tempOrder) {
2070
+ _context7.next = 6;
2071
+ break;
2072
+ }
2073
+ throw new Error('当前订单不存在,无法生成订单编号');
2074
+ case 6:
2075
+ if (!(tempOrder.shop_order_number && tempOrder.shop_full_order_number)) {
2076
+ _context7.next = 8;
2077
+ break;
2078
+ }
2079
+ return _context7.abrupt("return");
2080
+ case 8:
2081
+ biz = this.getBookingTicketBusinessCode();
2082
+ if (biz) {
2083
+ _context7.next = 11;
2084
+ break;
2085
+ }
2086
+ throw new Error('当前订单缺少业务类型,无法生成订单编号');
2087
+ case 11:
2088
+ idGenerator = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getAp = _this$appPlugin.getApp) === null || _this$appPlugin$getAp === void 0 || (_this$appPlugin$getAp = _this$appPlugin$getAp.call(_this$appPlugin)) === null || _this$appPlugin$getAp === void 0 || (_this$appPlugin$getAp2 = _this$appPlugin$getAp.getPlugin) === null || _this$appPlugin$getAp2 === void 0 ? void 0 : _this$appPlugin$getAp2.call(_this$appPlugin$getAp, 'idGenerator');
2089
+ if (!(!tempOrder.shop_order_number && typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.generateShopOrderNumber) !== 'function' || !tempOrder.shop_full_order_number && typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.generateReceiptId) !== 'function')) {
2090
+ _context7.next = 14;
2091
+ break;
2092
+ }
2093
+ throw new Error('订单编号生成器不可用,请重启应用后重试');
2094
+ case 14:
2095
+ _context7.prev = 14;
2096
+ if (tempOrder.shop_order_number) {
2097
+ _context7.next = 19;
2098
+ break;
2099
+ }
2100
+ _context7.next = 18;
2101
+ return idGenerator.generateShopOrderNumber({
2102
+ biz: biz
2103
+ });
2104
+ case 18:
2105
+ tempOrder.shop_order_number = _context7.sent;
2106
+ case 19:
2107
+ if (tempOrder.shop_full_order_number) {
2108
+ _context7.next = 23;
2109
+ break;
2110
+ }
2111
+ _context7.next = 22;
2112
+ return idGenerator.generateReceiptId({
2113
+ biz: biz
2114
+ });
2115
+ case 22:
2116
+ tempOrder.shop_full_order_number = _context7.sent;
2117
+ case 23:
2118
+ if (!(order.getTempOrder() !== tempOrder)) {
2119
+ _context7.next = 25;
2120
+ break;
2121
+ }
2122
+ throw new Error('当前订单已切换,请重新发起支付');
2123
+ case 25:
2124
+ if (!(!tempOrder.shop_order_number || !tempOrder.shop_full_order_number)) {
2125
+ _context7.next = 27;
2126
+ break;
2127
+ }
2128
+ throw new Error('订单编号生成失败,请重试');
2129
+ case 27:
2130
+ _context7.prev = 27;
2131
+ // 部分生成成功时也保留号码,后续只补仍然缺失的字段。
2132
+ if (order.getTempOrder() === tempOrder) order.persistTempOrder();
2133
+ return _context7.finish(27);
2134
+ case 30:
2135
+ case "end":
2136
+ return _context7.stop();
2137
+ }
2138
+ }, _callee7, this, [[14,, 27, 30]]);
2139
+ }));
2140
+ function ensureLocalOrderNumbersForCheckout() {
2141
+ return _ensureLocalOrderNumbersForCheckout.apply(this, arguments);
2142
+ }
2143
+ return ensureLocalOrderNumbersForCheckout;
2144
+ }()
2036
2145
  /**
2037
2146
  * PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
2038
2147
  * 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
2039
2148
  */
2149
+ )
2040
2150
  }, {
2041
2151
  key: "shouldUseCheckoutSyncTask",
2042
2152
  value: function shouldUseCheckoutSyncTask() {
2043
- var _this$otherParams14, _this$otherParams15;
2044
- var configured = (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.checkoutSyncTaskEnabled;
2153
+ var _this$otherParams15, _this$otherParams16;
2154
+ var configured = (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.checkoutSyncTaskEnabled;
2045
2155
  if (configured === true) return true;
2046
- var platform = normalizeRuntimePlatform((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.platform);
2156
+ var platform = normalizeRuntimePlatform((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform);
2047
2157
  return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
2048
2158
  }
2049
2159
 
@@ -2069,77 +2179,77 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2069
2179
  }, {
2070
2180
  key: "addNewOrder",
2071
2181
  value: function () {
2072
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
2182
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
2073
2183
  var _this$store$order2, _this$store$order2$co, _this$store$order4;
2074
2184
  var sessionRecord, tempOrder, _this$store$order3, didSyncAuthenticatedCustomer;
2075
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
2076
- while (1) switch (_context7.prev = _context7.next) {
2185
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
2186
+ while (1) switch (_context8.prev = _context8.next) {
2077
2187
  case 0:
2078
2188
  sessionRecord = this.isSessionStoragePersistEnabled() ? (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$co = _this$store$order2.consumeSessionStorageRestore) === null || _this$store$order2$co === void 0 ? void 0 : _this$store$order2$co.call(_this$store$order2) : null;
2079
2189
  if (!sessionRecord) {
2080
- _context7.next = 4;
2190
+ _context8.next = 4;
2081
2191
  break;
2082
2192
  }
2083
- _context7.next = 4;
2193
+ _context8.next = 4;
2084
2194
  return this.loadSalesDetail({
2085
2195
  preloadedSalesDetail: sessionRecord,
2086
2196
  hydrateSource: 'sessionStorage'
2087
2197
  });
2088
2198
  case 4:
2089
- _context7.next = 6;
2199
+ _context8.next = 6;
2090
2200
  return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "addNewOrder", this).call(this);
2091
2201
  case 6:
2092
- tempOrder = _context7.sent;
2202
+ tempOrder = _context8.sent;
2093
2203
  if (sessionRecord) {
2094
2204
  (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || _this$store$order3.persistTempOrder();
2095
2205
  }
2096
2206
  if (!this.isAuthenticatedCustomerUserPlatform()) {
2097
- _context7.next = 23;
2207
+ _context8.next = 23;
2098
2208
  break;
2099
2209
  }
2100
- _context7.prev = 9;
2101
- _context7.next = 12;
2210
+ _context8.prev = 9;
2211
+ _context8.next = 12;
2102
2212
  return this.syncAuthenticatedOrderCustomer();
2103
2213
  case 12:
2104
- didSyncAuthenticatedCustomer = _context7.sent;
2214
+ didSyncAuthenticatedCustomer = _context8.sent;
2105
2215
  if (!(!didSyncAuthenticatedCustomer && sessionRecord)) {
2106
- _context7.next = 16;
2216
+ _context8.next = 16;
2107
2217
  break;
2108
2218
  }
2109
- _context7.next = 16;
2219
+ _context8.next = 16;
2110
2220
  return this.refreshLegacySessionCustomerDiscounts(tempOrder);
2111
2221
  case 16:
2112
- _context7.next = 21;
2222
+ _context8.next = 21;
2113
2223
  break;
2114
2224
  case 18:
2115
- _context7.prev = 18;
2116
- _context7.t0 = _context7["catch"](9);
2117
- console.warn('[UnifiedBookingSales] Failed to sync authenticated order customer after addNewOrder', _context7.t0);
2225
+ _context8.prev = 18;
2226
+ _context8.t0 = _context8["catch"](9);
2227
+ console.warn('[UnifiedBookingSales] Failed to sync authenticated order customer after addNewOrder', _context8.t0);
2118
2228
  case 21:
2119
- _context7.next = 32;
2229
+ _context8.next = 32;
2120
2230
  break;
2121
2231
  case 23:
2122
2232
  if (!sessionRecord) {
2123
- _context7.next = 32;
2233
+ _context8.next = 32;
2124
2234
  break;
2125
2235
  }
2126
- _context7.prev = 24;
2127
- _context7.next = 27;
2236
+ _context8.prev = 24;
2237
+ _context8.next = 27;
2128
2238
  return this.refreshLegacySessionCustomerDiscounts(tempOrder);
2129
2239
  case 27:
2130
- _context7.next = 32;
2240
+ _context8.next = 32;
2131
2241
  break;
2132
2242
  case 29:
2133
- _context7.prev = 29;
2134
- _context7.t1 = _context7["catch"](24);
2135
- console.warn('[UnifiedBookingSales] Failed to refresh cached customer discounts after addNewOrder', _context7.t1);
2243
+ _context8.prev = 29;
2244
+ _context8.t1 = _context8["catch"](24);
2245
+ console.warn('[UnifiedBookingSales] Failed to refresh cached customer discounts after addNewOrder', _context8.t1);
2136
2246
  case 32:
2137
- return _context7.abrupt("return", ((_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder()) || tempOrder);
2247
+ return _context8.abrupt("return", ((_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder()) || tempOrder);
2138
2248
  case 33:
2139
2249
  case "end":
2140
- return _context7.stop();
2250
+ return _context8.stop();
2141
2251
  }
2142
- }, _callee7, this, [[9, 18], [24, 29]]);
2252
+ }, _callee8, this, [[9, 18], [24, 29]]);
2143
2253
  }));
2144
2254
  function addNewOrder() {
2145
2255
  return _addNewOrder.apply(this, arguments);
@@ -2149,46 +2259,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2149
2259
  }, {
2150
2260
  key: "syncAuthenticatedOrderCustomer",
2151
2261
  value: function () {
2152
- var _syncAuthenticatedOrderCustomer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
2262
+ var _syncAuthenticatedOrderCustomer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
2153
2263
  var _this$core2, _this$core2$getPlugin, _this$core2$getPlugin2, _this$store$customer, _this$store$customer$;
2154
2264
  var authenticatedCustomer, authenticatedCustomerId, tempOrder, cachedCustomerId;
2155
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
2156
- while (1) switch (_context8.prev = _context8.next) {
2265
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
2266
+ while (1) switch (_context9.prev = _context9.next) {
2157
2267
  case 0:
2158
2268
  if (this.isAuthenticatedCustomerUserPlatform()) {
2159
- _context8.next = 2;
2269
+ _context9.next = 2;
2160
2270
  break;
2161
2271
  }
2162
- return _context8.abrupt("return", false);
2272
+ return _context9.abrupt("return", false);
2163
2273
  case 2:
2164
2274
  authenticatedCustomer = (_this$core2 = this.core) === null || _this$core2 === void 0 || (_this$core2$getPlugin = _this$core2.getPlugin) === null || _this$core2$getPlugin === void 0 || (_this$core2$getPlugin = _this$core2$getPlugin.call(_this$core2, 'user')) === null || _this$core2$getPlugin === void 0 || (_this$core2$getPlugin2 = _this$core2$getPlugin.get) === null || _this$core2$getPlugin2 === void 0 ? void 0 : _this$core2$getPlugin2.call(_this$core2$getPlugin);
2165
2275
  authenticatedCustomerId = toCustomerId(authenticatedCustomer === null || authenticatedCustomer === void 0 ? void 0 : authenticatedCustomer.id);
2166
2276
  if (authenticatedCustomerId) {
2167
- _context8.next = 6;
2277
+ _context9.next = 6;
2168
2278
  break;
2169
2279
  }
2170
- return _context8.abrupt("return", false);
2280
+ return _context9.abrupt("return", false);
2171
2281
  case 6:
2172
2282
  tempOrder = this.getTempOrder();
2173
2283
  cachedCustomerId = resolveTempOrderCustomerId(tempOrder);
2174
2284
  if (!(cachedCustomerId !== null && cachedCustomerId !== authenticatedCustomerId)) {
2175
- _context8.next = 11;
2285
+ _context9.next = 11;
2176
2286
  break;
2177
2287
  }
2178
- _context8.next = 11;
2288
+ _context9.next = 11;
2179
2289
  return this.resetCachedCustomerDiscountState();
2180
2290
  case 11:
2181
2291
  (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || (_this$store$customer$ = _this$store$customer.setSelectedCustomer) === null || _this$store$customer$ === void 0 || _this$store$customer$.call(_this$store$customer, authenticatedCustomer);
2182
2292
  this.setOrderCustomer(authenticatedCustomer);
2183
- _context8.next = 15;
2293
+ _context9.next = 15;
2184
2294
  return Promise.all([this.refreshDiscountConfigAfterOrderCustomerChange(authenticatedCustomerId), this.waitForOrderCustomerPromotionRefresh()]);
2185
2295
  case 15:
2186
- return _context8.abrupt("return", true);
2296
+ return _context9.abrupt("return", true);
2187
2297
  case 16:
2188
2298
  case "end":
2189
- return _context8.stop();
2299
+ return _context9.stop();
2190
2300
  }
2191
- }, _callee8, this);
2301
+ }, _callee9, this);
2192
2302
  }));
2193
2303
  function syncAuthenticatedOrderCustomer() {
2194
2304
  return _syncAuthenticatedOrderCustomer.apply(this, arguments);
@@ -2198,8 +2308,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2198
2308
  }, {
2199
2309
  key: "isAuthenticatedCustomerUserPlatform",
2200
2310
  value: function isAuthenticatedCustomerUserPlatform() {
2201
- var _this$otherParams16;
2202
- return isCustomerUserPlatform((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform);
2311
+ var _this$otherParams17;
2312
+ return isCustomerUserPlatform((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform);
2203
2313
  }
2204
2314
  }, {
2205
2315
  key: "resolveDiscountOrderIdentity",
@@ -2216,11 +2326,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2216
2326
  }, {
2217
2327
  key: "resetCachedCustomerDiscountState",
2218
2328
  value: function () {
2219
- var _resetCachedCustomerDiscountState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
2329
+ var _resetCachedCustomerDiscountState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
2220
2330
  var _this$store$order6, _this$store$order6$cl, _this$store$customer2, _this$store$customer3, _this$store$order7, _discountModule$getOr, _discountModule$getDi, _discountModule$setOr, _discountModule$setDi, _this$store$order8, _this$store$order8$ap, _this$store$order9, _this$store$order9$re, _this$store$order10, _this$store$order10$p;
2221
2331
  var orderStore, discountModule, filteredOriginalDiscounts, filteredCurrentDiscounts;
2222
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
2223
- while (1) switch (_context9.prev = _context9.next) {
2332
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
2333
+ while (1) switch (_context10.prev = _context10.next) {
2224
2334
  case 0:
2225
2335
  (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$cl = _this$store$order6.clearOrderCustomer) === null || _this$store$order6$cl === void 0 || _this$store$order6$cl.call(_this$store$order6);
2226
2336
  (_this$store$customer2 = this.store.customer) === null || _this$store$customer2 === void 0 || (_this$store$customer3 = _this$store$customer2.setSelectedCustomer) === null || _this$store$customer3 === void 0 || _this$store$customer3.call(_this$store$customer2, null);
@@ -2230,14 +2340,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2230
2340
  discountModule = orderStore.discount;
2231
2341
  filteredOriginalDiscounts = filterCustomerBoundDiscounts((discountModule === null || discountModule === void 0 || (_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || []);
2232
2342
  filteredCurrentDiscounts = filterCustomerBoundDiscounts((discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || []);
2233
- _context9.next = 10;
2343
+ _context10.next = 10;
2234
2344
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, filteredOriginalDiscounts);
2235
2345
  case 10:
2236
- _context9.next = 12;
2346
+ _context10.next = 12;
2237
2347
  return discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, filteredCurrentDiscounts);
2238
2348
  case 12:
2239
2349
  (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || (_this$store$order8$ap = _this$store$order8.applyDiscount) === null || _this$store$order8$ap === void 0 || _this$store$order8$ap.call(_this$store$order8);
2240
- _context9.next = 15;
2350
+ _context10.next = 15;
2241
2351
  return (_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 || (_this$store$order9$re = _this$store$order9.recalculateSummary) === null || _this$store$order9$re === void 0 ? void 0 : _this$store$order9$re.call(_this$store$order9, {
2242
2352
  createIfMissing: true
2243
2353
  });
@@ -2245,9 +2355,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2245
2355
  (_this$store$order10 = this.store.order) === null || _this$store$order10 === void 0 || (_this$store$order10$p = _this$store$order10.persistTempOrder) === null || _this$store$order10$p === void 0 || _this$store$order10$p.call(_this$store$order10);
2246
2356
  case 16:
2247
2357
  case "end":
2248
- return _context9.stop();
2358
+ return _context10.stop();
2249
2359
  }
2250
- }, _callee9, this);
2360
+ }, _callee10, this);
2251
2361
  }));
2252
2362
  function resetCachedCustomerDiscountState() {
2253
2363
  return _resetCachedCustomerDiscountState.apply(this, arguments);
@@ -2257,31 +2367,31 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2257
2367
  }, {
2258
2368
  key: "refreshLegacySessionCustomerDiscounts",
2259
2369
  value: function () {
2260
- var _refreshLegacySessionCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(tempOrder) {
2370
+ var _refreshLegacySessionCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(tempOrder) {
2261
2371
  var customerId, loadDiscountConfig;
2262
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
2263
- while (1) switch (_context10.prev = _context10.next) {
2372
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
2373
+ while (1) switch (_context11.prev = _context11.next) {
2264
2374
  case 0:
2265
2375
  customerId = resolveTempOrderCustomerId(tempOrder);
2266
2376
  if (customerId) {
2267
- _context10.next = 3;
2377
+ _context11.next = 3;
2268
2378
  break;
2269
2379
  }
2270
- return _context10.abrupt("return", undefined);
2380
+ return _context11.abrupt("return", undefined);
2271
2381
  case 3:
2272
2382
  loadDiscountConfig = _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "loadDiscountConfig", this).bind(this);
2273
- _context10.next = 6;
2383
+ _context11.next = 6;
2274
2384
  return loadDiscountConfig({
2275
2385
  customerId: customerId,
2276
2386
  action: this.resolveDiscountAction(this.resolveDiscountOrderIdentity(tempOrder))
2277
2387
  });
2278
2388
  case 6:
2279
- return _context10.abrupt("return", _context10.sent);
2389
+ return _context11.abrupt("return", _context11.sent);
2280
2390
  case 7:
2281
2391
  case "end":
2282
- return _context10.stop();
2392
+ return _context11.stop();
2283
2393
  }
2284
- }, _callee10, this);
2394
+ }, _callee11, this);
2285
2395
  }));
2286
2396
  function refreshLegacySessionCustomerDiscounts(_x6) {
2287
2397
  return _refreshLegacySessionCustomerDiscounts.apply(this, arguments);
@@ -2326,37 +2436,37 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2326
2436
  }, {
2327
2437
  key: "prepareInvoiceTemplateAtSolutionReady",
2328
2438
  value: function () {
2329
- var _prepareInvoiceTemplateAtSolutionReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(injectedOpenData) {
2439
+ var _prepareInvoiceTemplateAtSolutionReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(injectedOpenData) {
2330
2440
  var businessCode;
2331
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
2332
- while (1) switch (_context11.prev = _context11.next) {
2441
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
2442
+ while (1) switch (_context12.prev = _context12.next) {
2333
2443
  case 0:
2334
2444
  businessCode = this.getBookingTicketBusinessCode();
2335
2445
  if (!(!businessCode || !this.store.openData)) {
2336
- _context11.next = 3;
2446
+ _context12.next = 3;
2337
2447
  break;
2338
2448
  }
2339
- return _context11.abrupt("return");
2449
+ return _context12.abrupt("return");
2340
2450
  case 3:
2341
2451
  if (injectedOpenData) {
2342
2452
  this.otherParams.openData = injectedOpenData;
2343
2453
  this.openDataTarget = "".concat(businessCode, "+").concat(this.getSubmitOrderSalesChannel());
2344
2454
  }
2345
- _context11.prev = 4;
2346
- _context11.next = 7;
2455
+ _context12.prev = 4;
2456
+ _context12.next = 7;
2347
2457
  return this.loadOpenDataConfig();
2348
2458
  case 7:
2349
- _context11.next = 12;
2459
+ _context12.next = 12;
2350
2460
  break;
2351
2461
  case 9:
2352
- _context11.prev = 9;
2353
- _context11.t0 = _context11["catch"](4);
2354
- console.warn('[UnifiedBookingSales] Invoice 模板预加载失败,使用默认配置', _context11.t0);
2462
+ _context12.prev = 9;
2463
+ _context12.t0 = _context12["catch"](4);
2464
+ console.warn('[UnifiedBookingSales] Invoice 模板预加载失败,使用默认配置', _context12.t0);
2355
2465
  case 12:
2356
2466
  case "end":
2357
- return _context11.stop();
2467
+ return _context12.stop();
2358
2468
  }
2359
- }, _callee11, this, [[4, 9]]);
2469
+ }, _callee12, this, [[4, 9]]);
2360
2470
  }));
2361
2471
  function prepareInvoiceTemplateAtSolutionReady(_x7) {
2362
2472
  return _prepareInvoiceTemplateAtSolutionReady.apply(this, arguments);
@@ -2366,27 +2476,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2366
2476
  }, {
2367
2477
  key: "loadOpenDataConfig",
2368
2478
  value: function () {
2369
- var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
2479
+ var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
2370
2480
  var businessCode;
2371
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
2372
- while (1) switch (_context12.prev = _context12.next) {
2481
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2482
+ while (1) switch (_context13.prev = _context13.next) {
2373
2483
  case 0:
2374
2484
  businessCode = this.getBookingTicketBusinessCode();
2375
2485
  if (businessCode) {
2376
- _context12.next = 3;
2486
+ _context13.next = 3;
2377
2487
  break;
2378
2488
  }
2379
- return _context12.abrupt("return", null);
2489
+ return _context13.abrupt("return", null);
2380
2490
  case 3:
2381
- return _context12.abrupt("return", this.loadOpenData({
2491
+ return _context13.abrupt("return", this.loadOpenData({
2382
2492
  businessCode: businessCode,
2383
2493
  channel: this.getSubmitOrderSalesChannel()
2384
2494
  }));
2385
2495
  case 4:
2386
2496
  case "end":
2387
- return _context12.stop();
2497
+ return _context13.stop();
2388
2498
  }
2389
- }, _callee12, this);
2499
+ }, _callee13, this);
2390
2500
  }));
2391
2501
  function loadOpenDataConfig() {
2392
2502
  return _loadOpenDataConfig.apply(this, arguments);
@@ -2396,21 +2506,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2396
2506
  }, {
2397
2507
  key: "loadOpenData",
2398
2508
  value: (function () {
2399
- var _loadOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
2509
+ var _loadOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
2400
2510
  var _this5 = this;
2401
2511
  var module, businessCode, channel, target, scope, injectedOpenData, generation, core, request;
2402
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2403
- while (1) switch (_context14.prev = _context14.next) {
2512
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2513
+ while (1) switch (_context15.prev = _context15.next) {
2404
2514
  case 0:
2405
2515
  module = this.store.openData;
2406
2516
  if (module) {
2407
- _context14.next = 3;
2517
+ _context15.next = 3;
2408
2518
  break;
2409
2519
  }
2410
2520
  throw new Error('[UnifiedBookingSales] openData 模块未初始化');
2411
2521
  case 3:
2412
2522
  if (!this.runtimeOpenDataDestroyed) {
2413
- _context14.next = 5;
2523
+ _context15.next = 5;
2414
2524
  break;
2415
2525
  }
2416
2526
  throw new Error('Store settings changed. Please try again.');
@@ -2418,7 +2528,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2418
2528
  businessCode = String(params.businessCode || '').trim();
2419
2529
  channel = String(params.channel || '').trim();
2420
2530
  if (!(!businessCode || !channel)) {
2421
- _context14.next = 9;
2531
+ _context15.next = 9;
2422
2532
  break;
2423
2533
  }
2424
2534
  throw new Error('[UnifiedBookingSales] OpenData 需要 businessCode 与 channel');
@@ -2443,40 +2553,40 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2443
2553
  this.runtimeOpenDataSnapshot = injectedOpenData;
2444
2554
  }
2445
2555
  if (!this.loadOpenDataInFlight) {
2446
- _context14.next = 17;
2556
+ _context15.next = 17;
2447
2557
  break;
2448
2558
  }
2449
- return _context14.abrupt("return", this.loadOpenDataInFlight);
2559
+ return _context15.abrupt("return", this.loadOpenDataInFlight);
2450
2560
  case 17:
2451
2561
  generation = this.runtimeOpenDataGeneration;
2452
2562
  core = this.core;
2453
- request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
2563
+ request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
2454
2564
  var openData, _module$ensureInvoice;
2455
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2456
- while (1) switch (_context13.prev = _context13.next) {
2565
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2566
+ while (1) switch (_context14.prev = _context14.next) {
2457
2567
  case 0:
2458
2568
  openData = _this5.runtimeOpenDataSnapshot;
2459
2569
  if (!openData) {
2460
- _context13.next = 6;
2570
+ _context14.next = 6;
2461
2571
  break;
2462
2572
  }
2463
- _context13.next = 4;
2573
+ _context14.next = 4;
2464
2574
  return (_module$ensureInvoice = module.ensureInvoiceTemplateSettings) === null || _module$ensureInvoice === void 0 ? void 0 : _module$ensureInvoice.call(module, target, openData);
2465
2575
  case 4:
2466
- _context13.next = 9;
2576
+ _context14.next = 9;
2467
2577
  break;
2468
2578
  case 6:
2469
- _context13.next = 8;
2579
+ _context14.next = 8;
2470
2580
  return module.fetchOpenData({
2471
2581
  scope: 'board',
2472
2582
  target: target,
2473
2583
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
2474
2584
  });
2475
2585
  case 8:
2476
- openData = _context13.sent;
2586
+ openData = _context14.sent;
2477
2587
  case 9:
2478
2588
  if (!(_this5.runtimeOpenDataDestroyed || generation !== _this5.runtimeOpenDataGeneration || scope !== _this5.getRuntimeOpenDataScope() || module !== _this5.store.openData || core !== _this5.core)) {
2479
- _context13.next = 11;
2589
+ _context14.next = 11;
2480
2590
  break;
2481
2591
  }
2482
2592
  throw new Error('Store settings changed. Please try again.');
@@ -2484,32 +2594,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2484
2594
  _this5.runtimeOpenDataSnapshot = openData;
2485
2595
  _this5.openDataTarget = target;
2486
2596
  _this5.otherParams.openData = openData;
2487
- return _context13.abrupt("return", openData);
2597
+ return _context14.abrupt("return", openData);
2488
2598
  case 15:
2489
2599
  case "end":
2490
- return _context13.stop();
2600
+ return _context14.stop();
2491
2601
  }
2492
- }, _callee13);
2602
+ }, _callee14);
2493
2603
  }))();
2494
2604
  this.loadOpenDataInFlightTarget = target;
2495
2605
  this.loadOpenDataInFlight = request;
2496
- _context14.prev = 22;
2497
- _context14.next = 25;
2606
+ _context15.prev = 22;
2607
+ _context15.next = 25;
2498
2608
  return request;
2499
2609
  case 25:
2500
- return _context14.abrupt("return", _context14.sent);
2610
+ return _context15.abrupt("return", _context15.sent);
2501
2611
  case 26:
2502
- _context14.prev = 26;
2612
+ _context15.prev = 26;
2503
2613
  if (this.loadOpenDataInFlight === request) {
2504
2614
  this.loadOpenDataInFlight = null;
2505
2615
  this.loadOpenDataInFlightTarget = null;
2506
2616
  }
2507
- return _context14.finish(26);
2617
+ return _context15.finish(26);
2508
2618
  case 29:
2509
2619
  case "end":
2510
- return _context14.stop();
2620
+ return _context15.stop();
2511
2621
  }
2512
- }, _callee14, this, [[22,, 26, 29]]);
2622
+ }, _callee15, this, [[22,, 26, 29]]);
2513
2623
  }));
2514
2624
  function loadOpenData(_x8) {
2515
2625
  return _loadOpenData.apply(this, arguments);
@@ -2519,16 +2629,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2519
2629
  }, {
2520
2630
  key: "getOpenData",
2521
2631
  value: function () {
2522
- var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
2523
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2524
- while (1) switch (_context15.prev = _context15.next) {
2632
+ var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
2633
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2634
+ while (1) switch (_context16.prev = _context16.next) {
2525
2635
  case 0:
2526
- return _context15.abrupt("return", this.loadOpenDataConfig());
2636
+ return _context16.abrupt("return", this.loadOpenDataConfig());
2527
2637
  case 1:
2528
2638
  case "end":
2529
- return _context15.stop();
2639
+ return _context16.stop();
2530
2640
  }
2531
- }, _callee15, this);
2641
+ }, _callee16, this);
2532
2642
  }));
2533
2643
  function getOpenData() {
2534
2644
  return _getOpenData.apply(this, arguments);
@@ -2538,33 +2648,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2538
2648
  }, {
2539
2649
  key: "loadPickupTimingOpenData",
2540
2650
  value: function () {
2541
- var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_force) {
2542
- var _ref34, _this$otherParams$bus2, _this$otherParams17, _this$otherParams18;
2651
+ var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_force) {
2652
+ var _ref34, _this$otherParams$bus2, _this$otherParams18, _this$otherParams19;
2543
2653
  var scope, businessCode, config;
2544
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2545
- while (1) switch (_context16.prev = _context16.next) {
2654
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2655
+ while (1) switch (_context17.prev = _context17.next) {
2546
2656
  case 0:
2547
2657
  scope = this.getPickupTimingScope();
2548
- businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.business_code) !== null && _ref34 !== void 0 ? _ref34 : '').trim();
2549
- _context16.next = 4;
2658
+ businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code) !== null && _ref34 !== void 0 ? _ref34 : '').trim();
2659
+ _context17.next = 4;
2550
2660
  return this.loadOpenData({
2551
2661
  businessCode: businessCode,
2552
2662
  channel: this.getSubmitOrderSalesChannel()
2553
2663
  });
2554
2664
  case 4:
2555
- config = _context16.sent;
2665
+ config = _context17.sent;
2556
2666
  if (!(scope !== this.getPickupTimingScope())) {
2557
- _context16.next = 7;
2667
+ _context17.next = 7;
2558
2668
  break;
2559
2669
  }
2560
2670
  throw new Error('Store settings changed. Please try again.');
2561
2671
  case 7:
2562
- return _context16.abrupt("return", config);
2672
+ return _context17.abrupt("return", config);
2563
2673
  case 8:
2564
2674
  case "end":
2565
- return _context16.stop();
2675
+ return _context17.stop();
2566
2676
  }
2567
- }, _callee16, this);
2677
+ }, _callee17, this);
2568
2678
  }));
2569
2679
  function loadPickupTimingOpenData(_x9) {
2570
2680
  return _loadPickupTimingOpenData.apply(this, arguments);
@@ -2581,19 +2691,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2581
2691
  }, {
2582
2692
  key: "fetchAllergyItemRuleConfigs",
2583
2693
  value: function () {
2584
- var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(strategyModelIds) {
2694
+ var _fetchAllergyItemRuleConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(strategyModelIds) {
2585
2695
  var _response$data, response, list;
2586
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2587
- while (1) switch (_context17.prev = _context17.next) {
2696
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2697
+ while (1) switch (_context18.prev = _context18.next) {
2588
2698
  case 0:
2589
2699
  if (strategyModelIds.length) {
2590
- _context17.next = 2;
2700
+ _context18.next = 2;
2591
2701
  break;
2592
2702
  }
2593
- return _context17.abrupt("return", []);
2703
+ return _context18.abrupt("return", []);
2594
2704
  case 2:
2595
- _context17.prev = 2;
2596
- _context17.next = 5;
2705
+ _context18.prev = 2;
2706
+ _context18.next = 5;
2597
2707
  return this.request.get('/promotion', {
2598
2708
  skip: 1,
2599
2709
  num: 99,
@@ -2601,26 +2711,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2601
2711
  ids: strategyModelIds
2602
2712
  });
2603
2713
  case 5:
2604
- response = _context17.sent;
2714
+ response = _context18.sent;
2605
2715
  if (!((response === null || response === void 0 ? void 0 : response.code) !== 200 || !Array.isArray(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list))) {
2606
- _context17.next = 8;
2716
+ _context18.next = 8;
2607
2717
  break;
2608
2718
  }
2609
2719
  throw new Error('[UnifiedBookingSales] 商品过敏策略加载失败');
2610
2720
  case 8:
2611
2721
  list = response.data.list;
2612
- return _context17.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
2722
+ return _context18.abrupt("return", normalizeItemRuleStrategyConfigs(list.map(function (item) {
2613
2723
  return item === null || item === void 0 ? void 0 : item.metadata;
2614
2724
  })));
2615
2725
  case 12:
2616
- _context17.prev = 12;
2617
- _context17.t0 = _context17["catch"](2);
2618
- throw _context17.t0;
2726
+ _context18.prev = 12;
2727
+ _context18.t0 = _context18["catch"](2);
2728
+ throw _context18.t0;
2619
2729
  case 15:
2620
2730
  case "end":
2621
- return _context17.stop();
2731
+ return _context18.stop();
2622
2732
  }
2623
- }, _callee17, this, [[2, 12]]);
2733
+ }, _callee18, this, [[2, 12]]);
2624
2734
  }));
2625
2735
  function fetchAllergyItemRuleConfigs(_x10) {
2626
2736
  return _fetchAllergyItemRuleConfigs.apply(this, arguments);
@@ -2630,72 +2740,72 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2630
2740
  }, {
2631
2741
  key: "ensureAllergyItemRuleConfigsLoaded",
2632
2742
  value: function () {
2633
- var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2743
+ var _ensureAllergyItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
2634
2744
  var _this6 = this;
2635
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2636
- while (1) switch (_context19.prev = _context19.next) {
2745
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2746
+ while (1) switch (_context20.prev = _context20.next) {
2637
2747
  case 0:
2638
2748
  if (!(this.allergyItemRuleConfigs.length > 0)) {
2639
- _context19.next = 2;
2749
+ _context20.next = 2;
2640
2750
  break;
2641
2751
  }
2642
- return _context19.abrupt("return", this.allergyItemRuleConfigs);
2752
+ return _context20.abrupt("return", this.allergyItemRuleConfigs);
2643
2753
  case 2:
2644
2754
  if (!this.allergyItemRuleConfigsPromise) {
2645
- _context19.next = 4;
2755
+ _context20.next = 4;
2646
2756
  break;
2647
2757
  }
2648
- return _context19.abrupt("return", this.allergyItemRuleConfigsPromise);
2758
+ return _context20.abrupt("return", this.allergyItemRuleConfigsPromise);
2649
2759
  case 4:
2650
- this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2760
+ this.allergyItemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2651
2761
  var _this6$otherParams;
2652
2762
  var staticConfigs, openData, enabled, strategyModelIds, loaded;
2653
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2654
- while (1) switch (_context18.prev = _context18.next) {
2763
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2764
+ while (1) switch (_context19.prev = _context19.next) {
2655
2765
  case 0:
2656
2766
  staticConfigs = normalizeItemRuleStrategyConfigs((_this6$otherParams = _this6.otherParams) === null || _this6$otherParams === void 0 || (_this6$otherParams = _this6$otherParams.itemRule) === null || _this6$otherParams === void 0 ? void 0 : _this6$otherParams.strategyConfigs);
2657
2767
  if (!(staticConfigs.length > 0)) {
2658
- _context18.next = 5;
2768
+ _context19.next = 5;
2659
2769
  break;
2660
2770
  }
2661
2771
  _this6.allergyItemRuleConfigs = staticConfigs;
2662
2772
  _this6.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
2663
- return _context18.abrupt("return", staticConfigs);
2773
+ return _context19.abrupt("return", staticConfigs);
2664
2774
  case 5:
2665
- _context18.next = 7;
2775
+ _context19.next = 7;
2666
2776
  return _this6.getOpenData();
2667
2777
  case 7:
2668
- openData = _context18.sent;
2778
+ openData = _context19.sent;
2669
2779
  enabled = toConfiguredBoolean(openData === null || openData === void 0 ? void 0 : openData['sale.enable_item_rules']);
2670
2780
  strategyModelIds = normalizePositiveIntegerList(openData === null || openData === void 0 ? void 0 : openData['sale.enabled_item_rules']);
2671
2781
  if (!(!enabled || !strategyModelIds.length)) {
2672
- _context18.next = 13;
2782
+ _context19.next = 13;
2673
2783
  break;
2674
2784
  }
2675
2785
  _this6.allergyItemRuleEvaluator.setStrategyConfigs([]);
2676
- return _context18.abrupt("return", []);
2786
+ return _context19.abrupt("return", []);
2677
2787
  case 13:
2678
- _context18.next = 15;
2788
+ _context19.next = 15;
2679
2789
  return _this6.fetchAllergyItemRuleConfigs(strategyModelIds);
2680
2790
  case 15:
2681
- loaded = _context18.sent;
2791
+ loaded = _context19.sent;
2682
2792
  _this6.allergyItemRuleConfigs = loaded;
2683
2793
  _this6.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
2684
- return _context18.abrupt("return", loaded);
2794
+ return _context19.abrupt("return", loaded);
2685
2795
  case 19:
2686
2796
  case "end":
2687
- return _context18.stop();
2797
+ return _context19.stop();
2688
2798
  }
2689
- }, _callee18);
2799
+ }, _callee19);
2690
2800
  }))().catch(function () {
2691
2801
  return [];
2692
2802
  });
2693
- return _context19.abrupt("return", this.allergyItemRuleConfigsPromise);
2803
+ return _context20.abrupt("return", this.allergyItemRuleConfigsPromise);
2694
2804
  case 6:
2695
2805
  case "end":
2696
- return _context19.stop();
2806
+ return _context20.stop();
2697
2807
  }
2698
- }, _callee19, this);
2808
+ }, _callee20, this);
2699
2809
  }));
2700
2810
  function ensureAllergyItemRuleConfigsLoaded() {
2701
2811
  return _ensureAllergyItemRuleConfigsLoaded.apply(this, arguments);
@@ -2709,31 +2819,31 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2709
2819
  }, {
2710
2820
  key: "resolveProductAllergyRequirement",
2711
2821
  value: (function () {
2712
- var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
2713
- var _this$otherParams19, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref37, _runtimeConfig$servic, _this$otherParams20, _ref38, _ref39, _params$channel, _this$otherParams21, _this$otherParams22, _runtimeConfig$submis;
2822
+ var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
2823
+ var _this$otherParams20, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref37, _runtimeConfig$servic, _this$otherParams21, _ref38, _ref39, _params$channel, _this$otherParams22, _this$otherParams23, _runtimeConfig$submis;
2714
2824
  var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
2715
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2716
- while (1) switch (_context20.prev = _context20.next) {
2825
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2826
+ while (1) switch (_context21.prev = _context21.next) {
2717
2827
  case 0:
2718
2828
  productId = normalizePositiveInteger(params.productId);
2719
2829
  if (productId) {
2720
- _context20.next = 3;
2830
+ _context21.next = 3;
2721
2831
  break;
2722
2832
  }
2723
- return _context20.abrupt("return", null);
2833
+ return _context21.abrupt("return", null);
2724
2834
  case 3:
2725
- _context20.next = 5;
2835
+ _context21.next = 5;
2726
2836
  return this.ensureAllergyItemRuleConfigsLoaded();
2727
2837
  case 5:
2728
- strategyConfigs = _context20.sent;
2838
+ strategyConfigs = _context21.sent;
2729
2839
  if (strategyConfigs.length) {
2730
- _context20.next = 8;
2840
+ _context21.next = 8;
2731
2841
  break;
2732
2842
  }
2733
- return _context20.abrupt("return", null);
2843
+ return _context21.abrupt("return", null);
2734
2844
  case 8:
2735
2845
  productVariantId = normalizePositiveInteger(params.productVariantId);
2736
- runtimeConfig = ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.itemRule) || {};
2846
+ runtimeConfig = ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.itemRule) || {};
2737
2847
  runtimePax = runtimeConfig.pax || {};
2738
2848
  cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
2739
2849
  var _item$product_id, _item$product_variant, _ref36, _item$num;
@@ -2745,15 +2855,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2745
2855
  }).filter(function (item) {
2746
2856
  return Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0;
2747
2857
  });
2748
- return _context20.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
2858
+ return _context21.abrupt("return", this.allergyItemRuleEvaluator.getAllergyRequirement({
2749
2859
  pax: {
2750
2860
  total: Number((_runtimePax$total = runtimePax.total) !== null && _runtimePax$total !== void 0 ? _runtimePax$total : 0) || 0,
2751
2861
  adult: Number((_runtimePax$adult = runtimePax.adult) !== null && _runtimePax$adult !== void 0 ? _runtimePax$adult : 0) || 0,
2752
2862
  child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
2753
2863
  },
2754
2864
  cartItems: cartItems,
2755
- serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.serviceType) !== null && _ref37 !== void 0 ? _ref37 : ''),
2756
- channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.channel) !== null && _ref39 !== void 0 ? _ref39 : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.platform) !== null && _ref38 !== void 0 ? _ref38 : ''),
2865
+ serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.serviceType) !== null && _ref37 !== void 0 ? _ref37 : ''),
2866
+ channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.channel) !== null && _ref39 !== void 0 ? _ref39 : (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.platform) !== null && _ref38 !== void 0 ? _ref38 : ''),
2757
2867
  currentProduct: _objectSpread({
2758
2868
  product_id: productId
2759
2869
  }, productVariantId ? {
@@ -2765,9 +2875,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2765
2875
  }));
2766
2876
  case 13:
2767
2877
  case "end":
2768
- return _context20.stop();
2878
+ return _context21.stop();
2769
2879
  }
2770
- }, _callee20, this);
2880
+ }, _callee21, this);
2771
2881
  }));
2772
2882
  function resolveProductAllergyRequirement(_x11) {
2773
2883
  return _resolveProductAllergyRequirement.apply(this, arguments);
@@ -2783,27 +2893,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2783
2893
  }, {
2784
2894
  key: "getInvoiceLayoutConfig",
2785
2895
  value: function () {
2786
- var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2896
+ var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2787
2897
  var openData;
2788
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2789
- while (1) switch (_context21.prev = _context21.next) {
2898
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2899
+ while (1) switch (_context22.prev = _context22.next) {
2790
2900
  case 0:
2791
- _context21.next = 2;
2901
+ _context22.next = 2;
2792
2902
  return this.getOpenData();
2793
2903
  case 2:
2794
- openData = _context21.sent;
2904
+ openData = _context22.sent;
2795
2905
  if (!(!openData || !this.store.openData)) {
2796
- _context21.next = 5;
2906
+ _context22.next = 5;
2797
2907
  break;
2798
2908
  }
2799
- return _context21.abrupt("return", getDefaultInvoiceLayoutConfig());
2909
+ return _context22.abrupt("return", getDefaultInvoiceLayoutConfig());
2800
2910
  case 5:
2801
- return _context21.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
2911
+ return _context22.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
2802
2912
  case 6:
2803
2913
  case "end":
2804
- return _context21.stop();
2914
+ return _context22.stop();
2805
2915
  }
2806
- }, _callee21, this);
2916
+ }, _callee22, this);
2807
2917
  }));
2808
2918
  function getInvoiceLayoutConfig() {
2809
2919
  return _getInvoiceLayoutConfig.apply(this, arguments);
@@ -2813,27 +2923,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2813
2923
  }, {
2814
2924
  key: "getInvoiceTemplateSettings",
2815
2925
  value: function () {
2816
- var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2926
+ var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2817
2927
  var openData;
2818
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2819
- while (1) switch (_context22.prev = _context22.next) {
2928
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2929
+ while (1) switch (_context23.prev = _context23.next) {
2820
2930
  case 0:
2821
- _context22.next = 2;
2931
+ _context23.next = 2;
2822
2932
  return this.getOpenData();
2823
2933
  case 2:
2824
- openData = _context22.sent;
2934
+ openData = _context23.sent;
2825
2935
  if (!(!openData || !this.store.openData)) {
2826
- _context22.next = 5;
2936
+ _context23.next = 5;
2827
2937
  break;
2828
2938
  }
2829
- return _context22.abrupt("return", getDefaultInvoiceTemplateSettings());
2939
+ return _context23.abrupt("return", getDefaultInvoiceTemplateSettings());
2830
2940
  case 5:
2831
- return _context22.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
2941
+ return _context23.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
2832
2942
  case 6:
2833
2943
  case "end":
2834
- return _context22.stop();
2944
+ return _context23.stop();
2835
2945
  }
2836
- }, _callee22, this);
2946
+ }, _callee23, this);
2837
2947
  }));
2838
2948
  function getInvoiceTemplateSettings() {
2839
2949
  return _getInvoiceTemplateSettings.apply(this, arguments);
@@ -2843,9 +2953,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2843
2953
  }, {
2844
2954
  key: "isInvoiceOpenDataCacheCurrent",
2845
2955
  value: function isInvoiceOpenDataCacheCurrent() {
2846
- var _this$otherParams23, _this$otherParams24;
2847
- var businessCode = String(((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.businessCode) || '').trim();
2848
- var channel = String(((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.channel) || '').trim();
2956
+ var _this$otherParams24, _this$otherParams25;
2957
+ var businessCode = String(((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.businessCode) || '').trim();
2958
+ var channel = String(((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.channel) || '').trim();
2849
2959
  if (!businessCode || !channel) return false;
2850
2960
  return this.openDataTarget === "".concat(businessCode, "+").concat(channel) && this.runtimeOpenDataScope === this.getRuntimeOpenDataScope();
2851
2961
  }
@@ -2856,14 +2966,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2856
2966
  }, {
2857
2967
  key: "getProtocol",
2858
2968
  value: (function () {
2859
- var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(policyId) {
2969
+ var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(policyId) {
2860
2970
  var normalizedPolicyId, policyUrl;
2861
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2862
- while (1) switch (_context23.prev = _context23.next) {
2971
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2972
+ while (1) switch (_context24.prev = _context24.next) {
2863
2973
  case 0:
2864
2974
  normalizedPolicyId = String(policyId !== null && policyId !== void 0 ? policyId : '').trim();
2865
2975
  if (normalizedPolicyId) {
2866
- _context23.next = 3;
2976
+ _context24.next = 3;
2867
2977
  break;
2868
2978
  }
2869
2979
  throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
@@ -2872,12 +2982,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2872
2982
  if (this.otherParams.platform === 'kiosk' || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
2873
2983
  policyUrl = 'policy';
2874
2984
  }
2875
- return _context23.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
2985
+ return _context24.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
2876
2986
  case 6:
2877
2987
  case "end":
2878
- return _context23.stop();
2988
+ return _context24.stop();
2879
2989
  }
2880
- }, _callee23, this);
2990
+ }, _callee24, this);
2881
2991
  }));
2882
2992
  function getProtocol(_x12) {
2883
2993
  return _getProtocol.apply(this, arguments);
@@ -2892,27 +3002,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2892
3002
  }, {
2893
3003
  key: "loadProducts",
2894
3004
  value: (function () {
2895
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
3005
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2896
3006
  var params,
2897
3007
  options,
2898
3008
  schedule_date,
2899
3009
  schedule_datetime,
2900
3010
  result,
2901
- _args24 = arguments;
2902
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2903
- while (1) switch (_context24.prev = _context24.next) {
3011
+ _args25 = arguments;
3012
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3013
+ while (1) switch (_context25.prev = _context25.next) {
2904
3014
  case 0:
2905
- params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
2906
- options = _args24.length > 1 ? _args24[1] : undefined;
3015
+ params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
3016
+ options = _args25.length > 1 ? _args25[1] : undefined;
2907
3017
  if (this.store.products) {
2908
- _context24.next = 4;
3018
+ _context25.next = 4;
2909
3019
  break;
2910
3020
  }
2911
3021
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
2912
3022
  case 4:
2913
3023
  schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
2914
3024
  schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
2915
- _context24.next = 8;
3025
+ _context25.next = 8;
2916
3026
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
2917
3027
  with_count: ['bundleGroup', 'optionGroup'],
2918
3028
  with_schedule: 1
@@ -2922,17 +3032,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2922
3032
  cacheId: this.cacheId
2923
3033
  }), options);
2924
3034
  case 8:
2925
- result = _context24.sent;
3035
+ result = _context25.sent;
2926
3036
  this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
2927
- _context24.next = 12;
3037
+ _context25.next = 12;
2928
3038
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
2929
3039
  case 12:
2930
- return _context24.abrupt("return", result);
3040
+ return _context25.abrupt("return", result);
2931
3041
  case 13:
2932
3042
  case "end":
2933
- return _context24.stop();
3043
+ return _context25.stop();
2934
3044
  }
2935
- }, _callee24, this);
3045
+ }, _callee25, this);
2936
3046
  }));
2937
3047
  function loadProducts() {
2938
3048
  return _loadProducts.apply(this, arguments);
@@ -2942,25 +3052,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2942
3052
  }, {
2943
3053
  key: "queryProducts",
2944
3054
  value: function () {
2945
- var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
3055
+ var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2946
3056
  var params,
2947
- _args25 = arguments;
2948
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2949
- while (1) switch (_context25.prev = _context25.next) {
3057
+ _args26 = arguments;
3058
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3059
+ while (1) switch (_context26.prev = _context26.next) {
2950
3060
  case 0:
2951
- params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
3061
+ params = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {};
2952
3062
  if (this.store.products) {
2953
- _context25.next = 3;
3063
+ _context26.next = 3;
2954
3064
  break;
2955
3065
  }
2956
3066
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
2957
3067
  case 3:
2958
- return _context25.abrupt("return", this.store.products.queryProducts(params));
3068
+ return _context26.abrupt("return", this.store.products.queryProducts(params));
2959
3069
  case 4:
2960
3070
  case "end":
2961
- return _context25.stop();
3071
+ return _context26.stop();
2962
3072
  }
2963
- }, _callee25, this);
3073
+ }, _callee26, this);
2964
3074
  }));
2965
3075
  function queryProducts() {
2966
3076
  return _queryProducts.apply(this, arguments);
@@ -2970,22 +3080,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2970
3080
  }, {
2971
3081
  key: "loadScheduleAvailableDate",
2972
3082
  value: (function () {
2973
- var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2974
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2975
- while (1) switch (_context26.prev = _context26.next) {
3083
+ var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3084
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3085
+ while (1) switch (_context27.prev = _context27.next) {
2976
3086
  case 0:
2977
3087
  if (this.store.schedule) {
2978
- _context26.next = 2;
3088
+ _context27.next = 2;
2979
3089
  break;
2980
3090
  }
2981
3091
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
2982
3092
  case 2:
2983
- return _context26.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
3093
+ return _context27.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
2984
3094
  case 3:
2985
3095
  case "end":
2986
- return _context26.stop();
3096
+ return _context27.stop();
2987
3097
  }
2988
- }, _callee26, this);
3098
+ }, _callee27, this);
2989
3099
  }));
2990
3100
  function loadScheduleAvailableDate(_x13) {
2991
3101
  return _loadScheduleAvailableDate.apply(this, arguments);
@@ -3001,15 +3111,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3001
3111
  }, {
3002
3112
  key: "loadProductsByScheduleDate",
3003
3113
  value: (function () {
3004
- var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
3114
+ var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
3005
3115
  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;
3006
3116
  var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
3007
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3008
- while (1) switch (_context27.prev = _context27.next) {
3117
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3118
+ while (1) switch (_context28.prev = _context28.next) {
3009
3119
  case 0:
3010
3120
  date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
3011
3121
  if (this.store.schedule) {
3012
- _context27.next = 3;
3122
+ _context28.next = 3;
3013
3123
  break;
3014
3124
  }
3015
3125
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
@@ -3020,10 +3130,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3020
3130
  });
3021
3131
  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;
3022
3132
  if (!(!hasCachedDate && !hasOtherProducts)) {
3023
- _context27.next = 9;
3133
+ _context28.next = 9;
3024
3134
  break;
3025
3135
  }
3026
- _context27.next = 9;
3136
+ _context28.next = 9;
3027
3137
  return this.loadScheduleAvailableDate({
3028
3138
  startDate: date,
3029
3139
  endDate: date,
@@ -3043,45 +3153,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3043
3153
  return !productIdFilter || productIdFilter.has(String(id));
3044
3154
  });
3045
3155
  if (availableProductIds.length) {
3046
- _context27.next = 17;
3156
+ _context28.next = 17;
3047
3157
  break;
3048
3158
  }
3049
3159
  this.unifiedProductCatalog = [];
3050
- _context27.next = 16;
3160
+ _context28.next = 16;
3051
3161
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
3052
3162
  case 16:
3053
- return _context27.abrupt("return", []);
3163
+ return _context28.abrupt("return", []);
3054
3164
  case 17:
3055
- _context27.next = 19;
3165
+ _context28.next = 19;
3056
3166
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
3057
3167
  product_ids: availableProductIds,
3058
3168
  schedule_date: date
3059
3169
  }));
3060
3170
  case 19:
3061
- products = _context27.sent;
3171
+ products = _context28.sent;
3062
3172
  if (!(products.length || availableProductIds.length <= 1)) {
3063
- _context27.next = 22;
3173
+ _context28.next = 22;
3064
3174
  break;
3065
3175
  }
3066
- return _context27.abrupt("return", products);
3176
+ return _context28.abrupt("return", products);
3067
3177
  case 22:
3068
3178
  fallbackProducts = [];
3069
3179
  _iterator = _createForOfIteratorHelper(availableProductIds);
3070
- _context27.prev = 24;
3180
+ _context28.prev = 24;
3071
3181
  _iterator.s();
3072
3182
  case 26:
3073
3183
  if ((_step = _iterator.n()).done) {
3074
- _context27.next = 34;
3184
+ _context28.next = 34;
3075
3185
  break;
3076
3186
  }
3077
3187
  productId = _step.value;
3078
- _context27.next = 30;
3188
+ _context28.next = 30;
3079
3189
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
3080
3190
  product_ids: [productId],
3081
3191
  schedule_date: date
3082
3192
  }));
3083
3193
  case 30:
3084
- result = _context27.sent;
3194
+ result = _context28.sent;
3085
3195
  result.forEach(function (product) {
3086
3196
  var _id;
3087
3197
  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;
@@ -3093,30 +3203,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3093
3203
  }
3094
3204
  });
3095
3205
  case 32:
3096
- _context27.next = 26;
3206
+ _context28.next = 26;
3097
3207
  break;
3098
3208
  case 34:
3099
- _context27.next = 39;
3209
+ _context28.next = 39;
3100
3210
  break;
3101
3211
  case 36:
3102
- _context27.prev = 36;
3103
- _context27.t0 = _context27["catch"](24);
3104
- _iterator.e(_context27.t0);
3212
+ _context28.prev = 36;
3213
+ _context28.t0 = _context28["catch"](24);
3214
+ _iterator.e(_context28.t0);
3105
3215
  case 39:
3106
- _context27.prev = 39;
3216
+ _context28.prev = 39;
3107
3217
  _iterator.f();
3108
- return _context27.finish(39);
3218
+ return _context28.finish(39);
3109
3219
  case 42:
3110
3220
  this.unifiedProductCatalog = [].concat(fallbackProducts);
3111
- _context27.next = 45;
3221
+ _context28.next = 45;
3112
3222
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
3113
3223
  case 45:
3114
- return _context27.abrupt("return", fallbackProducts);
3224
+ return _context28.abrupt("return", fallbackProducts);
3115
3225
  case 46:
3116
3226
  case "end":
3117
- return _context27.stop();
3227
+ return _context28.stop();
3118
3228
  }
3119
- }, _callee27, this, [[24, 36, 39, 42]]);
3229
+ }, _callee28, this, [[24, 36, 39, 42]]);
3120
3230
  }));
3121
3231
  function loadProductsByScheduleDate(_x14) {
3122
3232
  return _loadProductsByScheduleDate.apply(this, arguments);
@@ -3171,7 +3281,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3171
3281
  }, {
3172
3282
  key: "applyPlannerDiscounts",
3173
3283
  value: (function () {
3174
- var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
3284
+ var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
3175
3285
  var _params$customerId;
3176
3286
  var params,
3177
3287
  tempOrder,
@@ -3188,24 +3298,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3188
3298
  discount,
3189
3299
  discountId,
3190
3300
  nextTempOrder,
3191
- _args28 = arguments;
3192
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3193
- while (1) switch (_context28.prev = _context28.next) {
3301
+ _args29 = arguments;
3302
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3303
+ while (1) switch (_context29.prev = _context29.next) {
3194
3304
  case 0:
3195
- params = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {};
3305
+ params = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
3196
3306
  tempOrder = this.getTempOrder();
3197
3307
  requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
3198
3308
  parsedCustomerId = Number(requestedCustomerId);
3199
3309
  customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
3200
- _context28.next = 7;
3310
+ _context29.next = 7;
3201
3311
  return this.getSummary();
3202
3312
  case 7:
3203
- summaryBefore = _context28.sent;
3313
+ summaryBefore = _context29.sent;
3204
3314
  if (customerId) {
3205
- _context28.next = 10;
3315
+ _context29.next = 10;
3206
3316
  break;
3207
3317
  }
3208
- return _context28.abrupt("return", buildPlannerDiscountResult({
3318
+ return _context29.abrupt("return", buildPlannerDiscountResult({
3209
3319
  customerId: null,
3210
3320
  discountList: this.getDiscountList(),
3211
3321
  products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
@@ -3214,7 +3324,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3214
3324
  status: 'no_customer'
3215
3325
  }));
3216
3326
  case 10:
3217
- _context28.next = 12;
3327
+ _context29.next = 12;
3218
3328
  return this.loadDiscountConfig({
3219
3329
  customerId: customerId,
3220
3330
  action: 'create'
@@ -3226,7 +3336,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3226
3336
  return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
3227
3337
  });
3228
3338
  if (!preferredDiscount) {
3229
- _context28.next = 40;
3339
+ _context29.next = 40;
3230
3340
  break;
3231
3341
  }
3232
3342
  // A requested card is an explicit UI choice, not a best-effort preference. Clear prior
@@ -3238,98 +3348,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3238
3348
  return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
3239
3349
  });
3240
3350
  _iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
3241
- _context28.prev = 18;
3351
+ _context29.prev = 18;
3242
3352
  _iterator2.s();
3243
3353
  case 20:
3244
3354
  if ((_step2 = _iterator2.n()).done) {
3245
- _context28.next = 28;
3355
+ _context29.next = 28;
3246
3356
  break;
3247
3357
  }
3248
3358
  discount = _step2.value;
3249
3359
  discountId = Number(resolvePlannerDiscountId(discount));
3250
3360
  if (!Number.isFinite(discountId)) {
3251
- _context28.next = 26;
3361
+ _context29.next = 26;
3252
3362
  break;
3253
3363
  }
3254
- _context28.next = 26;
3364
+ _context29.next = 26;
3255
3365
  return this.setDiscountSelected({
3256
3366
  discountId: discountId,
3257
3367
  isSelected: false
3258
3368
  });
3259
3369
  case 26:
3260
- _context28.next = 20;
3370
+ _context29.next = 20;
3261
3371
  break;
3262
3372
  case 28:
3263
- _context28.next = 33;
3373
+ _context29.next = 33;
3264
3374
  break;
3265
3375
  case 30:
3266
- _context28.prev = 30;
3267
- _context28.t0 = _context28["catch"](18);
3268
- _iterator2.e(_context28.t0);
3376
+ _context29.prev = 30;
3377
+ _context29.t0 = _context29["catch"](18);
3378
+ _iterator2.e(_context29.t0);
3269
3379
  case 33:
3270
- _context28.prev = 33;
3380
+ _context29.prev = 33;
3271
3381
  _iterator2.f();
3272
- return _context28.finish(33);
3382
+ return _context29.finish(33);
3273
3383
  case 36:
3274
- _context28.next = 38;
3384
+ _context29.next = 38;
3275
3385
  return this.setDiscountSelected({
3276
3386
  discountId: Number(preferredId),
3277
3387
  isSelected: true
3278
3388
  });
3279
3389
  case 38:
3280
- _context28.next = 49;
3390
+ _context29.next = 49;
3281
3391
  break;
3282
3392
  case 40:
3283
3393
  if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
3284
- _context28.next = 46;
3394
+ _context29.next = 46;
3285
3395
  break;
3286
3396
  }
3287
3397
  if (!(params.applyBestDiscount !== false)) {
3288
- _context28.next = 44;
3398
+ _context29.next = 44;
3289
3399
  break;
3290
3400
  }
3291
- _context28.next = 44;
3401
+ _context29.next = 44;
3292
3402
  return this.bestDiscount();
3293
3403
  case 44:
3294
- _context28.next = 49;
3404
+ _context29.next = 49;
3295
3405
  break;
3296
3406
  case 46:
3297
3407
  if (!(params.applyBestDiscount !== false)) {
3298
- _context28.next = 49;
3408
+ _context29.next = 49;
3299
3409
  break;
3300
3410
  }
3301
- _context28.next = 49;
3411
+ _context29.next = 49;
3302
3412
  return this.bestDiscount();
3303
3413
  case 49:
3304
3414
  nextTempOrder = this.getTempOrder();
3305
- _context28.t1 = buildPlannerDiscountResult;
3306
- _context28.t2 = customerId;
3307
- _context28.t3 = this.getDiscountList();
3308
- _context28.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
3309
- _context28.t5 = summaryBefore;
3310
- _context28.next = 57;
3415
+ _context29.t1 = buildPlannerDiscountResult;
3416
+ _context29.t2 = customerId;
3417
+ _context29.t3 = this.getDiscountList();
3418
+ _context29.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
3419
+ _context29.t5 = summaryBefore;
3420
+ _context29.next = 57;
3311
3421
  return this.getSummary();
3312
3422
  case 57:
3313
- _context28.t6 = _context28.sent;
3314
- _context28.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
3315
- _context28.t8 = preferredDiscountId;
3316
- _context28.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
3317
- _context28.t10 = {
3318
- customerId: _context28.t2,
3319
- discountList: _context28.t3,
3320
- products: _context28.t4,
3321
- summaryBefore: _context28.t5,
3322
- summaryAfter: _context28.t6,
3323
- status: _context28.t7,
3324
- preferredDiscountId: _context28.t8,
3325
- preferredDiscountFound: _context28.t9
3423
+ _context29.t6 = _context29.sent;
3424
+ _context29.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
3425
+ _context29.t8 = preferredDiscountId;
3426
+ _context29.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
3427
+ _context29.t10 = {
3428
+ customerId: _context29.t2,
3429
+ discountList: _context29.t3,
3430
+ products: _context29.t4,
3431
+ summaryBefore: _context29.t5,
3432
+ summaryAfter: _context29.t6,
3433
+ status: _context29.t7,
3434
+ preferredDiscountId: _context29.t8,
3435
+ preferredDiscountFound: _context29.t9
3326
3436
  };
3327
- return _context28.abrupt("return", (0, _context28.t1)(_context28.t10));
3437
+ return _context29.abrupt("return", (0, _context29.t1)(_context29.t10));
3328
3438
  case 63:
3329
3439
  case "end":
3330
- return _context28.stop();
3440
+ return _context29.stop();
3331
3441
  }
3332
- }, _callee28, this, [[18, 30, 33, 36]]);
3442
+ }, _callee29, this, [[18, 30, 33, 36]]);
3333
3443
  }));
3334
3444
  function applyPlannerDiscounts() {
3335
3445
  return _applyPlannerDiscounts.apply(this, arguments);
@@ -3367,27 +3477,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3367
3477
  }, {
3368
3478
  key: "removeExistingStagedLines",
3369
3479
  value: (function () {
3370
- var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(ownershipKey) {
3480
+ var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(ownershipKey) {
3371
3481
  var _this$getTempOrder;
3372
3482
  var existingLines;
3373
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3374
- while (1) switch (_context29.prev = _context29.next) {
3483
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3484
+ while (1) switch (_context30.prev = _context30.next) {
3375
3485
  case 0:
3376
3486
  existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
3377
3487
  var _product$metadata4;
3378
3488
  return (product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4[ownershipKey]) === true;
3379
3489
  });
3380
3490
  if (!(existingLines.length > 0)) {
3381
- _context29.next = 4;
3491
+ _context30.next = 4;
3382
3492
  break;
3383
3493
  }
3384
- _context29.next = 4;
3494
+ _context30.next = 4;
3385
3495
  return this.removeProductsFromOrder(existingLines.map(buildAvailabilityLineIdentity));
3386
3496
  case 4:
3387
3497
  case "end":
3388
- return _context29.stop();
3498
+ return _context30.stop();
3389
3499
  }
3390
- }, _callee29, this);
3500
+ }, _callee30, this);
3391
3501
  }));
3392
3502
  function removeExistingStagedLines(_x15) {
3393
3503
  return _removeExistingStagedLines.apply(this, arguments);
@@ -3397,25 +3507,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3397
3507
  }, {
3398
3508
  key: "stageProducts",
3399
3509
  value: function () {
3400
- var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params, ownershipKey) {
3510
+ var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params, ownershipKey) {
3401
3511
  var _params$rawProducts;
3402
3512
  var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
3403
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3404
- while (1) switch (_context30.prev = _context30.next) {
3513
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3514
+ while (1) switch (_context31.prev = _context31.next) {
3405
3515
  case 0:
3406
3516
  productIds = params.productIds || [];
3407
3517
  if (productIds.length) {
3408
- _context30.next = 3;
3518
+ _context31.next = 3;
3409
3519
  break;
3410
3520
  }
3411
- return _context30.abrupt("return", this.getTempOrder());
3521
+ return _context31.abrupt("return", this.getTempOrder());
3412
3522
  case 3:
3413
3523
  if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
3414
- _context30.next = 7;
3524
+ _context31.next = 7;
3415
3525
  break;
3416
3526
  }
3417
3527
  this.unifiedProductCatalog = params.rawProducts;
3418
- _context30.next = 12;
3528
+ _context31.next = 12;
3419
3529
  break;
3420
3530
  case 7:
3421
3531
  existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
@@ -3426,15 +3536,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3426
3536
  return !existingIds.has(String(id));
3427
3537
  });
3428
3538
  if (!(missingIds.length || params.productLoadParams)) {
3429
- _context30.next = 12;
3539
+ _context31.next = 12;
3430
3540
  break;
3431
3541
  }
3432
- _context30.next = 12;
3542
+ _context31.next = 12;
3433
3543
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
3434
3544
  product_ids: productIds.map(Number).filter(Number.isFinite)
3435
3545
  }));
3436
3546
  case 12:
3437
- _context30.next = 14;
3547
+ _context31.next = 14;
3438
3548
  return this.removeExistingStagedLines(ownershipKey);
3439
3549
  case 14:
3440
3550
  productIdSet = new Set(productIds.map(function (id) {
@@ -3447,28 +3557,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3447
3557
  _i = 0, _arr = selectedProducts;
3448
3558
  case 17:
3449
3559
  if (!(_i < _arr.length)) {
3450
- _context30.next = 26;
3560
+ _context31.next = 26;
3451
3561
  break;
3452
3562
  }
3453
3563
  sourceProduct = _arr[_i];
3454
3564
  productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
3455
3565
  if (!productInput) {
3456
- _context30.next = 23;
3566
+ _context31.next = 23;
3457
3567
  break;
3458
3568
  }
3459
- _context30.next = 23;
3569
+ _context31.next = 23;
3460
3570
  return this.addProductToOrder(productInput);
3461
3571
  case 23:
3462
3572
  _i++;
3463
- _context30.next = 17;
3573
+ _context31.next = 17;
3464
3574
  break;
3465
3575
  case 26:
3466
- return _context30.abrupt("return", this.getTempOrder());
3576
+ return _context31.abrupt("return", this.getTempOrder());
3467
3577
  case 27:
3468
3578
  case "end":
3469
- return _context30.stop();
3579
+ return _context31.stop();
3470
3580
  }
3471
- }, _callee30, this);
3581
+ }, _callee31, this);
3472
3582
  }));
3473
3583
  function stageProducts(_x16, _x17) {
3474
3584
  return _stageProducts.apply(this, arguments);
@@ -3482,16 +3592,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3482
3592
  }, {
3483
3593
  key: "stageRetailProducts",
3484
3594
  value: (function () {
3485
- var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
3486
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3487
- while (1) switch (_context31.prev = _context31.next) {
3595
+ var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3596
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3597
+ while (1) switch (_context32.prev = _context32.next) {
3488
3598
  case 0:
3489
- return _context31.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
3599
+ return _context32.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
3490
3600
  case 1:
3491
3601
  case "end":
3492
- return _context31.stop();
3602
+ return _context32.stop();
3493
3603
  }
3494
- }, _callee31, this);
3604
+ }, _callee32, this);
3495
3605
  }));
3496
3606
  function stageRetailProducts(_x18) {
3497
3607
  return _stageRetailProducts.apply(this, arguments);
@@ -3507,15 +3617,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3507
3617
  }, {
3508
3618
  key: "addRetailProduct",
3509
3619
  value: (function () {
3510
- var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
3620
+ var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3511
3621
  var _params$quantity, _ref46, _params$productId, _params$product, _params$product2;
3512
3622
  var quantity, productId, sourceProduct, products, orderProduct;
3513
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3514
- while (1) switch (_context32.prev = _context32.next) {
3623
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3624
+ while (1) switch (_context33.prev = _context33.next) {
3515
3625
  case 0:
3516
3626
  quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
3517
3627
  if (!(!Number.isFinite(quantity) || quantity <= 0)) {
3518
- _context32.next = 3;
3628
+ _context33.next = 3;
3519
3629
  break;
3520
3630
  }
3521
3631
  throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
@@ -3529,22 +3639,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3529
3639
  });
3530
3640
  }
3531
3641
  if (!(!sourceProduct && productId !== undefined && productId !== null)) {
3532
- _context32.next = 11;
3642
+ _context33.next = 11;
3533
3643
  break;
3534
3644
  }
3535
- _context32.next = 9;
3645
+ _context33.next = 9;
3536
3646
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
3537
3647
  product_ids: [Number(productId)].filter(Number.isFinite)
3538
3648
  }));
3539
3649
  case 9:
3540
- products = _context32.sent;
3650
+ products = _context33.sent;
3541
3651
  sourceProduct = products.find(function (product) {
3542
3652
  var _product$id4;
3543
3653
  return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
3544
3654
  });
3545
3655
  case 11:
3546
3656
  if (sourceProduct) {
3547
- _context32.next = 13;
3657
+ _context33.next = 13;
3548
3658
  break;
3549
3659
  }
3550
3660
  throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
@@ -3553,17 +3663,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3553
3663
  quantity: quantity
3554
3664
  }), 'unified_booking_sales_retail');
3555
3665
  if (orderProduct) {
3556
- _context32.next = 16;
3666
+ _context33.next = 16;
3557
3667
  break;
3558
3668
  }
3559
3669
  throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
3560
3670
  case 16:
3561
- return _context32.abrupt("return", this.addProductToOrder(orderProduct));
3671
+ return _context33.abrupt("return", this.addProductToOrder(orderProduct));
3562
3672
  case 17:
3563
3673
  case "end":
3564
- return _context32.stop();
3674
+ return _context33.stop();
3565
3675
  }
3566
- }, _callee32, this);
3676
+ }, _callee33, this);
3567
3677
  }));
3568
3678
  function addRetailProduct(_x19) {
3569
3679
  return _addRetailProduct.apply(this, arguments);
@@ -3767,46 +3877,46 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3767
3877
  }, {
3768
3878
  key: "loadAvailabilityProducts",
3769
3879
  value: function () {
3770
- var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
3880
+ var _loadAvailabilityProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
3771
3881
  var _prepare$catalogScope,
3772
3882
  _prepare$catalogScope2,
3773
3883
  _this8 = this,
3774
3884
  _prepare$resourceIds;
3775
3885
  var prepare, dateRange, explicitProductIds, rawProducts, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7, dateSet, scheduleProductIds, productIds, normalized, productIdSet;
3776
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3777
- while (1) switch (_context33.prev = _context33.next) {
3886
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3887
+ while (1) switch (_context34.prev = _context34.next) {
3778
3888
  case 0:
3779
3889
  prepare = params.prepare, dateRange = params.dateRange;
3780
3890
  explicitProductIds = prepare.productIds || [];
3781
3891
  rawProducts = [];
3782
3892
  if (!Array.isArray(prepare.rawProducts)) {
3783
- _context33.next = 8;
3893
+ _context34.next = 8;
3784
3894
  break;
3785
3895
  }
3786
3896
  rawProducts = prepare.rawProducts;
3787
3897
  this.unifiedProductCatalog = _toConsumableArray(rawProducts);
3788
- _context33.next = 34;
3898
+ _context34.next = 34;
3789
3899
  break;
3790
3900
  case 8:
3791
3901
  if (!(explicitProductIds.length > 0)) {
3792
- _context33.next = 14;
3902
+ _context34.next = 14;
3793
3903
  break;
3794
3904
  }
3795
- _context33.next = 11;
3905
+ _context34.next = 11;
3796
3906
  return this.loadProducts({
3797
3907
  product_ids: explicitProductIds,
3798
3908
  schedule_date: dateRange.startDate
3799
3909
  });
3800
3910
  case 11:
3801
- rawProducts = _context33.sent;
3802
- _context33.next = 34;
3911
+ rawProducts = _context34.sent;
3912
+ _context34.next = 34;
3803
3913
  break;
3804
3914
  case 14:
3805
3915
  if (!(((_prepare$catalogScope = prepare.catalogScope) === null || _prepare$catalogScope === void 0 ? void 0 : _prepare$catalogScope.type) === 'schedule')) {
3806
- _context33.next = 30;
3916
+ _context34.next = 30;
3807
3917
  break;
3808
3918
  }
3809
- _context33.next = 17;
3919
+ _context34.next = 17;
3810
3920
  return this.loadScheduleAvailableDate({
3811
3921
  startDate: dateRange.startDate,
3812
3922
  endDate: dateRange.endDate,
@@ -3822,44 +3932,44 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3822
3932
  });
3823
3933
  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)) || [])));
3824
3934
  if (!(productIds.length > 0)) {
3825
- _context33.next = 27;
3935
+ _context34.next = 27;
3826
3936
  break;
3827
3937
  }
3828
3938
  assertAvailabilityCatalogProductIds(productIds, 'prepare.catalogScope.scheduleProductIds');
3829
- _context33.next = 24;
3939
+ _context34.next = 24;
3830
3940
  return this.loadProducts({
3831
3941
  product_ids: productIds,
3832
3942
  schedule_date: dateRange.startDate
3833
3943
  });
3834
3944
  case 24:
3835
- rawProducts = _context33.sent;
3836
- _context33.next = 28;
3945
+ rawProducts = _context34.sent;
3946
+ _context34.next = 28;
3837
3947
  break;
3838
3948
  case 27:
3839
3949
  this.unifiedProductCatalog = [];
3840
3950
  case 28:
3841
- _context33.next = 34;
3951
+ _context34.next = 34;
3842
3952
  break;
3843
3953
  case 30:
3844
3954
  if (!(((_prepare$catalogScope2 = prepare.catalogScope) === null || _prepare$catalogScope2 === void 0 ? void 0 : _prepare$catalogScope2.type) === 'productList')) {
3845
- _context33.next = 34;
3955
+ _context34.next = 34;
3846
3956
  break;
3847
3957
  }
3848
- _context33.next = 33;
3958
+ _context34.next = 33;
3849
3959
  return this.loadProducts(_objectSpread(_objectSpread({}, prepare.catalogScope.params), {}, {
3850
3960
  schedule_date: prepare.catalogScope.params.schedule_date || dateRange.startDate
3851
3961
  }));
3852
3962
  case 33:
3853
- rawProducts = _context33.sent;
3963
+ rawProducts = _context34.sent;
3854
3964
  case 34:
3855
3965
  normalized = rawProducts.map(function (product) {
3856
3966
  return normalizeProductForAvailability(product, params.scheduleList, _this8.getAvailabilityRuntimeOffsetMinutes());
3857
3967
  });
3858
3968
  if (!(!explicitProductIds.length && (_prepare$resourceIds = prepare.resourceIds) !== null && _prepare$resourceIds !== void 0 && _prepare$resourceIds.length)) {
3859
- _context33.next = 37;
3969
+ _context34.next = 37;
3860
3970
  break;
3861
3971
  }
3862
- return _context33.abrupt("return", normalized.filter(function (product) {
3972
+ return _context34.abrupt("return", normalized.filter(function (product) {
3863
3973
  var _product$requirementG2;
3864
3974
  return (_product$requirementG2 = product.requirementGroups) === null || _product$requirementG2 === void 0 ? void 0 : _product$requirementG2.some(function (group) {
3865
3975
  var _group$resourceIds3;
@@ -3872,14 +3982,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3872
3982
  }));
3873
3983
  case 37:
3874
3984
  productIdSet = explicitProductIds.length ? new Set(explicitProductIds.map(String)) : null;
3875
- return _context33.abrupt("return", productIdSet ? normalized.filter(function (product) {
3985
+ return _context34.abrupt("return", productIdSet ? normalized.filter(function (product) {
3876
3986
  return productIdSet.has(String(product.id));
3877
3987
  }) : normalized);
3878
3988
  case 39:
3879
3989
  case "end":
3880
- return _context33.stop();
3990
+ return _context34.stop();
3881
3991
  }
3882
- }, _callee33, this);
3992
+ }, _callee34, this);
3883
3993
  }));
3884
3994
  function loadAvailabilityProducts(_x20) {
3885
3995
  return _loadAvailabilityProducts.apply(this, arguments);
@@ -3894,12 +4004,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3894
4004
  }, {
3895
4005
  key: "fetchAvailabilityResourcesV2",
3896
4006
  value: (function () {
3897
- var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
4007
+ var _fetchAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
3898
4008
  var response, data;
3899
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3900
- while (1) switch (_context34.prev = _context34.next) {
4009
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4010
+ while (1) switch (_context35.prev = _context35.next) {
3901
4011
  case 0:
3902
- _context34.next = 2;
4012
+ _context35.next = 2;
3903
4013
  return this.request.get('/schedule/resource/list/v2', {
3904
4014
  start_date: params.dateRange.startDate,
3905
4015
  end_date: params.dateRange.endDate,
@@ -3909,26 +4019,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3909
4019
  useCache: false
3910
4020
  });
3911
4021
  case 2:
3912
- response = _context34.sent;
4022
+ response = _context35.sent;
3913
4023
  data = response === null || response === void 0 ? void 0 : response.data;
3914
4024
  if (!Array.isArray(data)) {
3915
- _context34.next = 6;
4025
+ _context35.next = 6;
3916
4026
  break;
3917
4027
  }
3918
- return _context34.abrupt("return", data);
4028
+ return _context35.abrupt("return", data);
3919
4029
  case 6:
3920
4030
  if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
3921
- _context34.next = 8;
4031
+ _context35.next = 8;
3922
4032
  break;
3923
4033
  }
3924
- return _context34.abrupt("return", data.list);
4034
+ return _context35.abrupt("return", data.list);
3925
4035
  case 8:
3926
- return _context34.abrupt("return", []);
4036
+ return _context35.abrupt("return", []);
3927
4037
  case 9:
3928
4038
  case "end":
3929
- return _context34.stop();
4039
+ return _context35.stop();
3930
4040
  }
3931
- }, _callee34, this);
4041
+ }, _callee35, this);
3932
4042
  }));
3933
4043
  function fetchAvailabilityResourcesV2(_x21) {
3934
4044
  return _fetchAvailabilityResourcesV.apply(this, arguments);
@@ -3938,17 +4048,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3938
4048
  }, {
3939
4049
  key: "fetchAndPublishAvailabilityResourcesV2",
3940
4050
  value: function () {
3941
- var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
4051
+ var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
3942
4052
  var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
3943
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3944
- while (1) switch (_context35.prev = _context35.next) {
4053
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4054
+ while (1) switch (_context36.prev = _context36.next) {
3945
4055
  case 0:
3946
4056
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
3947
4057
  if (!(normalizedResourceIds.length === 0)) {
3948
- _context35.next = 3;
4058
+ _context36.next = 3;
3949
4059
  break;
3950
4060
  }
3951
- return _context35.abrupt("return", []);
4061
+ return _context36.abrupt("return", []);
3952
4062
  case 3:
3953
4063
  scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
3954
4064
  cacheParams = {
@@ -3958,7 +4068,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3958
4068
  };
3959
4069
  cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
3960
4070
  if (!cachedRawResources) {
3961
- _context35.next = 9;
4071
+ _context36.next = 9;
3962
4072
  break;
3963
4073
  }
3964
4074
  if (params.useCacheOnHit) {
@@ -3970,21 +4080,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3970
4080
  console.warn('[UnifiedBookingSales] Remote occupancy background refresh failed', error);
3971
4081
  });
3972
4082
  }
3973
- return _context35.abrupt("return", cachedRawResources);
4083
+ return _context36.abrupt("return", cachedRawResources);
3974
4084
  case 9:
3975
- _context35.next = 11;
4085
+ _context36.next = 11;
3976
4086
  return this.refreshAvailabilityRemoteResourceQuery({
3977
4087
  timezone: params.timezone,
3978
4088
  dateRange: params.dateRange,
3979
4089
  resourceIds: normalizedResourceIds
3980
4090
  });
3981
4091
  case 11:
3982
- return _context35.abrupt("return", _context35.sent);
4092
+ return _context36.abrupt("return", _context36.sent);
3983
4093
  case 12:
3984
4094
  case "end":
3985
- return _context35.stop();
4095
+ return _context36.stop();
3986
4096
  }
3987
- }, _callee35, this);
4097
+ }, _callee36, this);
3988
4098
  }));
3989
4099
  function fetchAndPublishAvailabilityResourcesV2(_x22) {
3990
4100
  return _fetchAndPublishAvailabilityResourcesV.apply(this, arguments);
@@ -3994,17 +4104,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3994
4104
  }, {
3995
4105
  key: "refreshAvailabilityRemoteResourceQuery",
3996
4106
  value: function () {
3997
- var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
4107
+ var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
3998
4108
  var normalizedResourceIds, queryKey, epoch, existing, writeVersion, promise, rawResources, current;
3999
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4000
- while (1) switch (_context36.prev = _context36.next) {
4109
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4110
+ while (1) switch (_context37.prev = _context37.next) {
4001
4111
  case 0:
4002
4112
  normalizedResourceIds = this.normalizeAvailabilityIdList(params.resourceIds) || [];
4003
4113
  if (!(normalizedResourceIds.length === 0)) {
4004
- _context36.next = 3;
4114
+ _context37.next = 3;
4005
4115
  break;
4006
4116
  }
4007
- return _context36.abrupt("return", []);
4117
+ return _context37.abrupt("return", []);
4008
4118
  case 3:
4009
4119
  queryKey = this.buildAvailabilityRemoteResourceQueryKey({
4010
4120
  timezone: params.timezone,
@@ -4014,13 +4124,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4014
4124
  epoch = this.availabilityRemoteResourceEpoch;
4015
4125
  existing = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
4016
4126
  if (!((existing === null || existing === void 0 ? void 0 : existing.epoch) === epoch)) {
4017
- _context36.next = 10;
4127
+ _context37.next = 10;
4018
4128
  break;
4019
4129
  }
4020
- _context36.next = 9;
4130
+ _context37.next = 9;
4021
4131
  return existing.promise;
4022
4132
  case 9:
4023
- return _context36.abrupt("return", _context36.sent);
4133
+ return _context37.abrupt("return", _context37.sent);
4024
4134
  case 10:
4025
4135
  this.availabilityRemoteResourceQuerySequence += 1;
4026
4136
  writeVersion = this.availabilityRemoteResourceQuerySequence;
@@ -4032,11 +4142,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4032
4142
  epoch: epoch,
4033
4143
  promise: promise
4034
4144
  });
4035
- _context36.prev = 14;
4036
- _context36.next = 17;
4145
+ _context37.prev = 14;
4146
+ _context37.next = 17;
4037
4147
  return promise;
4038
4148
  case 17:
4039
- rawResources = _context36.sent;
4149
+ rawResources = _context37.sent;
4040
4150
  if (epoch === this.availabilityRemoteResourceEpoch) {
4041
4151
  this.availabilityRemoteOccupancyCache.publish({
4042
4152
  scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
@@ -4047,19 +4157,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4047
4157
  version: writeVersion
4048
4158
  });
4049
4159
  }
4050
- return _context36.abrupt("return", rawResources);
4160
+ return _context37.abrupt("return", rawResources);
4051
4161
  case 20:
4052
- _context36.prev = 20;
4162
+ _context37.prev = 20;
4053
4163
  current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
4054
4164
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
4055
4165
  this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
4056
4166
  }
4057
- return _context36.finish(20);
4167
+ return _context37.finish(20);
4058
4168
  case 24:
4059
4169
  case "end":
4060
- return _context36.stop();
4170
+ return _context37.stop();
4061
4171
  }
4062
- }, _callee36, this, [[14,, 20, 24]]);
4172
+ }, _callee37, this, [[14,, 20, 24]]);
4063
4173
  }));
4064
4174
  function refreshAvailabilityRemoteResourceQuery(_x23) {
4065
4175
  return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
@@ -4069,26 +4179,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4069
4179
  }, {
4070
4180
  key: "loadAvailabilityResources",
4071
4181
  value: function () {
4072
- var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
4182
+ var _loadAvailabilityResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4073
4183
  var resourceIds, cachedRawResources, rawResources;
4074
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4075
- while (1) switch (_context37.prev = _context37.next) {
4184
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4185
+ while (1) switch (_context38.prev = _context38.next) {
4076
4186
  case 0:
4077
4187
  resourceIds = collectAvailabilityResourceIds(params.products, params.resourceIds || []);
4078
4188
  if (!(resourceIds.length === 0)) {
4079
- _context37.next = 3;
4189
+ _context38.next = 3;
4080
4190
  break;
4081
4191
  }
4082
- return _context37.abrupt("return", {
4192
+ return _context38.abrupt("return", {
4083
4193
  resources: [],
4084
4194
  resourceOccupancies: []
4085
4195
  });
4086
4196
  case 3:
4087
4197
  if (!Array.isArray(params.rawResources)) {
4088
- _context37.next = 5;
4198
+ _context38.next = 5;
4089
4199
  break;
4090
4200
  }
4091
- return _context37.abrupt("return", buildAvailabilityResourcesFromV2({
4201
+ return _context38.abrupt("return", buildAvailabilityResourcesFromV2({
4092
4202
  rawResources: params.rawResources,
4093
4203
  scheduleList: params.scheduleList,
4094
4204
  dateRange: params.dateRange,
@@ -4096,7 +4206,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4096
4206
  }));
4097
4207
  case 5:
4098
4208
  if (!(params.fetchPolicy === 'cache_only')) {
4099
- _context37.next = 10;
4209
+ _context38.next = 10;
4100
4210
  break;
4101
4211
  }
4102
4212
  cachedRawResources = this.availabilityRemoteOccupancyCache.read({
@@ -4105,22 +4215,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4105
4215
  dateRange: params.dateRange
4106
4216
  });
4107
4217
  if (!cachedRawResources) {
4108
- _context37.next = 9;
4218
+ _context38.next = 9;
4109
4219
  break;
4110
4220
  }
4111
- return _context37.abrupt("return", buildAvailabilityResourcesFromV2({
4221
+ return _context38.abrupt("return", buildAvailabilityResourcesFromV2({
4112
4222
  rawResources: cachedRawResources,
4113
4223
  scheduleList: params.scheduleList,
4114
4224
  dateRange: params.dateRange,
4115
4225
  fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes()
4116
4226
  }));
4117
4227
  case 9:
4118
- return _context37.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
4228
+ return _context38.abrupt("return", params.fallbackResources ? cloneDeep(params.fallbackResources) : {
4119
4229
  resources: [],
4120
4230
  resourceOccupancies: []
4121
4231
  });
4122
4232
  case 10:
4123
- _context37.next = 12;
4233
+ _context38.next = 12;
4124
4234
  return this.fetchAndPublishAvailabilityResourcesV2({
4125
4235
  timezone: params.timezone,
4126
4236
  dateRange: params.dateRange,
@@ -4128,8 +4238,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4128
4238
  useCacheOnHit: true
4129
4239
  });
4130
4240
  case 12:
4131
- rawResources = _context37.sent;
4132
- return _context37.abrupt("return", buildAvailabilityResourcesFromV2({
4241
+ rawResources = _context38.sent;
4242
+ return _context38.abrupt("return", buildAvailabilityResourcesFromV2({
4133
4243
  rawResources: rawResources,
4134
4244
  scheduleList: params.scheduleList,
4135
4245
  dateRange: params.dateRange,
@@ -4137,9 +4247,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4137
4247
  }));
4138
4248
  case 14:
4139
4249
  case "end":
4140
- return _context37.stop();
4250
+ return _context38.stop();
4141
4251
  }
4142
- }, _callee37, this);
4252
+ }, _callee38, this);
4143
4253
  }));
4144
4254
  function loadAvailabilityResources(_x24) {
4145
4255
  return _loadAvailabilityResources.apply(this, arguments);
@@ -4372,7 +4482,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4372
4482
  }, {
4373
4483
  key: "buildAvailabilityProjectionSnapshot",
4374
4484
  value: function () {
4375
- var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
4485
+ var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
4376
4486
  var _this11 = this;
4377
4487
  var options,
4378
4488
  normalizedPrepareParams,
@@ -4396,23 +4506,23 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4396
4506
  durationCandidateAnchorAt,
4397
4507
  orderRevision,
4398
4508
  projection,
4399
- _args38 = arguments;
4400
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4401
- while (1) switch (_context38.prev = _context38.next) {
4509
+ _args39 = arguments;
4510
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4511
+ while (1) switch (_context39.prev = _context39.next) {
4402
4512
  case 0:
4403
- options = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : {};
4513
+ options = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : {};
4404
4514
  normalizedPrepareParams = this.normalizeAvailabilityPrepareDescriptor(params);
4405
4515
  timezoneLabel = String(normalizedPrepareParams.timezone);
4406
4516
  dateRange = normalizedPrepareParams.dateRange;
4407
4517
  scheduleList = this.getAvailabilityScheduleCatalog();
4408
- _context38.next = 7;
4518
+ _context39.next = 7;
4409
4519
  return this.loadAvailabilityProducts({
4410
4520
  prepare: normalizedPrepareParams,
4411
4521
  dateRange: dateRange,
4412
4522
  scheduleList: scheduleList
4413
4523
  });
4414
4524
  case 7:
4415
- products = _context38.sent;
4525
+ products = _context39.sent;
4416
4526
  // Coverage is physical local time; the caller's date range remains business
4417
4527
  // dates. Keep yesterday's opening and the last business day's overnight tail.
4418
4528
  useDurationTimeGrid = this.usesDurationTimeGrid() && products.some(function (product) {
@@ -4434,7 +4544,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4434
4544
  scheduleList: scheduleList,
4435
4545
  businessHours: businessHours
4436
4546
  });
4437
- _context38.next = 16;
4547
+ _context39.next = 16;
4438
4548
  return this.loadAvailabilityResources({
4439
4549
  timezone: timezoneLabel,
4440
4550
  dateRange: coverageDateRange,
@@ -4446,7 +4556,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4446
4556
  fallbackResources: options.fallbackResources
4447
4557
  });
4448
4558
  case 16:
4449
- loadedResources = _context38.sent;
4559
+ loadedResources = _context39.sent;
4450
4560
  tempOrder = this.getTempOrder();
4451
4561
  exclusions = this.resolveEditingOccupancyExclusions(tempOrder, normalizedPrepareParams.editingProductLineUids);
4452
4562
  injectedRawOccupancies = (normalizedPrepareParams.rawOccupancies || []).flatMap(function (occupancy) {
@@ -4492,16 +4602,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4492
4602
  prepareParams: normalizedPrepareParams,
4493
4603
  durationCandidateAnchorAt: durationCandidateAnchorAt
4494
4604
  });
4495
- return _context38.abrupt("return", {
4605
+ return _context39.abrupt("return", {
4496
4606
  projection: projection,
4497
4607
  prepareParams: normalizedPrepareParams,
4498
4608
  orderRevision: orderRevision
4499
4609
  });
4500
4610
  case 28:
4501
4611
  case "end":
4502
- return _context38.stop();
4612
+ return _context39.stop();
4503
4613
  }
4504
- }, _callee38, this);
4614
+ }, _callee39, this);
4505
4615
  }));
4506
4616
  function buildAvailabilityProjectionSnapshot(_x25) {
4507
4617
  return _buildAvailabilityProjectionSnapshot.apply(this, arguments);
@@ -4511,10 +4621,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4511
4621
  }, {
4512
4622
  key: "getSharedPreparedAvailabilitySnapshot",
4513
4623
  value: function () {
4514
- var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
4624
+ var _getSharedPreparedAvailabilitySnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
4515
4625
  var lifecycleGeneration, normalizedParams, hasRawInputs, prepareKey, snapshot, existing, promise, _snapshot, current;
4516
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4517
- while (1) switch (_context39.prev = _context39.next) {
4626
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4627
+ while (1) switch (_context40.prev = _context40.next) {
4518
4628
  case 0:
4519
4629
  lifecycleGeneration = this.availabilityLifecycleGeneration;
4520
4630
  normalizedParams = this.normalizeAvailabilityPrepareDescriptor(params);
@@ -4533,15 +4643,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4533
4643
  }
4534
4644
  })) : this.buildAvailabilityPrepareKey(normalizedParams);
4535
4645
  if (!hasRawInputs) {
4536
- _context39.next = 11;
4646
+ _context40.next = 11;
4537
4647
  break;
4538
4648
  }
4539
- _context39.next = 7;
4649
+ _context40.next = 7;
4540
4650
  return this.buildAvailabilityProjectionSnapshot(normalizedParams);
4541
4651
  case 7:
4542
- snapshot = _context39.sent;
4652
+ snapshot = _context40.sent;
4543
4653
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
4544
- _context39.next = 10;
4654
+ _context40.next = 10;
4545
4655
  break;
4546
4656
  }
4547
4657
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -4550,7 +4660,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4550
4660
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
4551
4661
  });
4552
4662
  case 10:
4553
- return _context39.abrupt("return", {
4663
+ return _context40.abrupt("return", {
4554
4664
  prepareKey: prepareKey,
4555
4665
  snapshot: snapshot
4556
4666
  });
@@ -4564,13 +4674,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4564
4674
  promise: promise
4565
4675
  });
4566
4676
  }
4567
- _context39.prev = 14;
4568
- _context39.next = 17;
4677
+ _context40.prev = 14;
4678
+ _context40.next = 17;
4569
4679
  return promise;
4570
4680
  case 17:
4571
- _snapshot = _context39.sent;
4681
+ _snapshot = _context40.sent;
4572
4682
  if (!(lifecycleGeneration !== this.availabilityLifecycleGeneration)) {
4573
- _context39.next = 20;
4683
+ _context40.next = 20;
4574
4684
  break;
4575
4685
  }
4576
4686
  throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'prepare 期间业务作用域或实例生命周期已变化,请重新 prepare', {
@@ -4579,22 +4689,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4579
4689
  currentLifecycleGeneration: this.availabilityLifecycleGeneration
4580
4690
  });
4581
4691
  case 20:
4582
- return _context39.abrupt("return", {
4692
+ return _context40.abrupt("return", {
4583
4693
  prepareKey: prepareKey,
4584
4694
  snapshot: _snapshot
4585
4695
  });
4586
4696
  case 21:
4587
- _context39.prev = 21;
4697
+ _context40.prev = 21;
4588
4698
  current = this.availabilityPrepareInFlight.get(prepareKey);
4589
4699
  if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
4590
4700
  this.availabilityPrepareInFlight.delete(prepareKey);
4591
4701
  }
4592
- return _context39.finish(21);
4702
+ return _context40.finish(21);
4593
4703
  case 25:
4594
4704
  case "end":
4595
- return _context39.stop();
4705
+ return _context40.stop();
4596
4706
  }
4597
- }, _callee39, this, [[14,, 21, 25]]);
4707
+ }, _callee40, this, [[14,, 21, 25]]);
4598
4708
  }));
4599
4709
  function getSharedPreparedAvailabilitySnapshot(_x26) {
4600
4710
  return _getSharedPreparedAvailabilitySnapshot.apply(this, arguments);
@@ -4604,49 +4714,49 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4604
4714
  }, {
4605
4715
  key: "refreshAvailabilityContextProjection",
4606
4716
  value: function () {
4607
- var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
4717
+ var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
4608
4718
  var _this12 = this;
4609
4719
  var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
4610
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4611
- while (1) switch (_context41.prev = _context41.next) {
4720
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4721
+ while (1) switch (_context42.prev = _context42.next) {
4612
4722
  case 0:
4613
4723
  existingInFlight = this.availabilityProjectionRefreshInFlight.get(params.contextId);
4614
4724
  if (!existingInFlight) {
4615
- _context41.next = 5;
4725
+ _context42.next = 5;
4616
4726
  break;
4617
4727
  }
4618
- _context41.next = 4;
4728
+ _context42.next = 4;
4619
4729
  return existingInFlight;
4620
4730
  case 4:
4621
- return _context41.abrupt("return", _context41.sent);
4731
+ return _context42.abrupt("return", _context42.sent);
4622
4732
  case 5:
4623
4733
  context = this.getAvailabilityContextEntry(params.contextId);
4624
4734
  expectedVersion = context.activeVersion;
4625
4735
  expectedRefreshNonce = context.refreshNonce;
4626
4736
  expectedLifecycleGeneration = this.availabilityLifecycleGeneration;
4627
- refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
4737
+ refreshPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
4628
4738
  var snapshot, currentContext, projectionEntry;
4629
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
4630
- while (1) switch (_context40.prev = _context40.next) {
4739
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
4740
+ while (1) switch (_context41.prev = _context41.next) {
4631
4741
  case 0:
4632
- _context40.next = 2;
4742
+ _context41.next = 2;
4633
4743
  return _this12.buildAvailabilityProjectionSnapshot(_this12.cloneAvailabilityPrepareParams(context.prepareParams), {
4634
4744
  durationCandidateAnchorAt: context.durationCandidateAnchorAt
4635
4745
  });
4636
4746
  case 2:
4637
- snapshot = _context40.sent;
4747
+ snapshot = _context41.sent;
4638
4748
  currentContext = _this12.availabilityContextRegistry.get(params.contextId);
4639
4749
  if (currentContext) {
4640
- _context40.next = 6;
4750
+ _context41.next = 6;
4641
4751
  break;
4642
4752
  }
4643
- return _context40.abrupt("return", null);
4753
+ return _context41.abrupt("return", null);
4644
4754
  case 6:
4645
4755
  if (!(expectedLifecycleGeneration !== _this12.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
4646
- _context40.next = 8;
4756
+ _context41.next = 8;
4647
4757
  break;
4648
4758
  }
4649
- return _context40.abrupt("return", null);
4759
+ return _context41.abrupt("return", null);
4650
4760
  case 8:
4651
4761
  projectionEntry = _this12.storeAvailabilityProjectionEntry({
4652
4762
  contextId: currentContext.contextId,
@@ -4656,7 +4766,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4656
4766
  orderRevision: snapshot.orderRevision,
4657
4767
  incrementVersion: true
4658
4768
  });
4659
- _context40.next = 11;
4769
+ _context41.next = 11;
4660
4770
  return _this12.emitAvailabilityDiagnostic({
4661
4771
  action: 'refresh',
4662
4772
  contextId: currentContext.contextId,
@@ -4668,31 +4778,31 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4668
4778
  reason: params.reason
4669
4779
  });
4670
4780
  case 11:
4671
- return _context40.abrupt("return", projectionEntry);
4781
+ return _context41.abrupt("return", projectionEntry);
4672
4782
  case 12:
4673
4783
  case "end":
4674
- return _context40.stop();
4784
+ return _context41.stop();
4675
4785
  }
4676
- }, _callee40);
4786
+ }, _callee41);
4677
4787
  }))();
4678
4788
  this.availabilityProjectionRefreshInFlight.set(params.contextId, refreshPromise);
4679
- _context41.prev = 11;
4680
- _context41.next = 14;
4789
+ _context42.prev = 11;
4790
+ _context42.next = 14;
4681
4791
  return refreshPromise;
4682
4792
  case 14:
4683
- return _context41.abrupt("return", _context41.sent);
4793
+ return _context42.abrupt("return", _context42.sent);
4684
4794
  case 15:
4685
- _context41.prev = 15;
4795
+ _context42.prev = 15;
4686
4796
  current = this.availabilityProjectionRefreshInFlight.get(params.contextId);
4687
4797
  if (current === refreshPromise) {
4688
4798
  this.availabilityProjectionRefreshInFlight.delete(params.contextId);
4689
4799
  }
4690
- return _context41.finish(15);
4800
+ return _context42.finish(15);
4691
4801
  case 19:
4692
4802
  case "end":
4693
- return _context41.stop();
4803
+ return _context42.stop();
4694
4804
  }
4695
- }, _callee41, this, [[11,, 15, 19]]);
4805
+ }, _callee42, this, [[11,, 15, 19]]);
4696
4806
  }));
4697
4807
  function refreshAvailabilityContextProjection(_x27) {
4698
4808
  return _refreshAvailabilityContextProjection.apply(this, arguments);
@@ -4702,53 +4812,53 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4702
4812
  }, {
4703
4813
  key: "ensureAvailabilityContextProjection",
4704
4814
  value: function () {
4705
- var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(contextId, reason) {
4815
+ var _ensureAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(contextId, reason) {
4706
4816
  var retries, context, currentOrderRevision, projectionEntry, refreshedProjectionEntry;
4707
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4708
- while (1) switch (_context42.prev = _context42.next) {
4817
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4818
+ while (1) switch (_context43.prev = _context43.next) {
4709
4819
  case 0:
4710
4820
  retries = 0;
4711
4821
  case 1:
4712
4822
  if (!(retries < 3)) {
4713
- _context42.next = 19;
4823
+ _context43.next = 19;
4714
4824
  break;
4715
4825
  }
4716
4826
  context = this.getAvailabilityContextEntry(contextId);
4717
4827
  currentOrderRevision = this.getCurrentOrderRevision();
4718
4828
  projectionEntry = this.getActiveAvailabilityProjectionEntry(context);
4719
4829
  if (!(projectionEntry && projectionEntry.orderRevision === currentOrderRevision)) {
4720
- _context42.next = 7;
4830
+ _context43.next = 7;
4721
4831
  break;
4722
4832
  }
4723
- return _context42.abrupt("return", {
4833
+ return _context43.abrupt("return", {
4724
4834
  context: context,
4725
4835
  projectionEntry: projectionEntry,
4726
4836
  refreshed: false
4727
4837
  });
4728
4838
  case 7:
4729
- _context42.next = 9;
4839
+ _context43.next = 9;
4730
4840
  return this.refreshAvailabilityContextProjection({
4731
4841
  contextId: contextId,
4732
4842
  reason: projectionEntry ? reason : "".concat(reason, ":projection_cache_miss"),
4733
4843
  previousOrderRevision: context.lastKnownOrderRevision
4734
4844
  });
4735
4845
  case 9:
4736
- refreshedProjectionEntry = _context42.sent;
4846
+ refreshedProjectionEntry = _context43.sent;
4737
4847
  if (refreshedProjectionEntry) {
4738
- _context42.next = 13;
4848
+ _context43.next = 13;
4739
4849
  break;
4740
4850
  }
4741
4851
  retries += 1;
4742
- return _context42.abrupt("continue", 1);
4852
+ return _context43.abrupt("continue", 1);
4743
4853
  case 13:
4744
4854
  if (!(refreshedProjectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
4745
- _context42.next = 16;
4855
+ _context43.next = 16;
4746
4856
  break;
4747
4857
  }
4748
4858
  retries += 1;
4749
- return _context42.abrupt("continue", 1);
4859
+ return _context43.abrupt("continue", 1);
4750
4860
  case 16:
4751
- return _context42.abrupt("return", {
4861
+ return _context43.abrupt("return", {
4752
4862
  context: this.getAvailabilityContextEntry(contextId),
4753
4863
  projectionEntry: refreshedProjectionEntry,
4754
4864
  refreshed: true
@@ -4760,9 +4870,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4760
4870
  });
4761
4871
  case 20:
4762
4872
  case "end":
4763
- return _context42.stop();
4873
+ return _context43.stop();
4764
4874
  }
4765
- }, _callee42, this);
4875
+ }, _callee43, this);
4766
4876
  }));
4767
4877
  function ensureAvailabilityContextProjection(_x28, _x29) {
4768
4878
  return _ensureAvailabilityContextProjection.apply(this, arguments);
@@ -4772,18 +4882,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4772
4882
  }, {
4773
4883
  key: "tryAcquireAvailabilityCommitLock",
4774
4884
  value: function () {
4775
- var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(contextId) {
4885
+ var _tryAcquireAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(contextId) {
4776
4886
  var _currentContext$activ;
4777
4887
  var _waitingContext$activ, waitingContext, currentContext;
4778
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4779
- while (1) switch (_context43.prev = _context43.next) {
4888
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4889
+ while (1) switch (_context44.prev = _context44.next) {
4780
4890
  case 0:
4781
4891
  if (!this.availabilityCommitLocks.has(contextId)) {
4782
- _context43.next = 5;
4892
+ _context44.next = 5;
4783
4893
  break;
4784
4894
  }
4785
4895
  waitingContext = this.availabilityContextRegistry.get(contextId);
4786
- _context43.next = 4;
4896
+ _context44.next = 4;
4787
4897
  return this.emitAvailabilityDiagnostic({
4788
4898
  action: 'commit_lock_wait',
4789
4899
  contextId: contextId,
@@ -4800,7 +4910,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4800
4910
  case 5:
4801
4911
  this.availabilityCommitLocks.add(contextId);
4802
4912
  currentContext = this.availabilityContextRegistry.get(contextId);
4803
- _context43.next = 9;
4913
+ _context44.next = 9;
4804
4914
  return this.emitAvailabilityDiagnostic({
4805
4915
  action: 'commit_lock_acquired',
4806
4916
  contextId: contextId,
@@ -4812,9 +4922,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4812
4922
  });
4813
4923
  case 9:
4814
4924
  case "end":
4815
- return _context43.stop();
4925
+ return _context44.stop();
4816
4926
  }
4817
- }, _callee43, this);
4927
+ }, _callee44, this);
4818
4928
  }));
4819
4929
  function tryAcquireAvailabilityCommitLock(_x30) {
4820
4930
  return _tryAcquireAvailabilityCommitLock.apply(this, arguments);
@@ -4824,15 +4934,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4824
4934
  }, {
4825
4935
  key: "releaseAvailabilityCommitLock",
4826
4936
  value: function () {
4827
- var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(contextId) {
4937
+ var _releaseAvailabilityCommitLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(contextId) {
4828
4938
  var _releasedContext$acti;
4829
4939
  var releasedContext;
4830
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4831
- while (1) switch (_context44.prev = _context44.next) {
4940
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4941
+ while (1) switch (_context45.prev = _context45.next) {
4832
4942
  case 0:
4833
4943
  this.availabilityCommitLocks.delete(contextId);
4834
4944
  releasedContext = this.availabilityContextRegistry.get(contextId);
4835
- _context44.next = 4;
4945
+ _context45.next = 4;
4836
4946
  return this.emitAvailabilityDiagnostic({
4837
4947
  action: 'commit_lock_released',
4838
4948
  contextId: contextId,
@@ -4844,9 +4954,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4844
4954
  });
4845
4955
  case 4:
4846
4956
  case "end":
4847
- return _context44.stop();
4957
+ return _context45.stop();
4848
4958
  }
4849
- }, _callee44, this);
4959
+ }, _callee45, this);
4850
4960
  }));
4851
4961
  function releaseAvailabilityCommitLock(_x31) {
4852
4962
  return _releaseAvailabilityCommitLock.apply(this, arguments);
@@ -4856,20 +4966,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4856
4966
  }, {
4857
4967
  key: "prepareAvailabilityProjection",
4858
4968
  value: (function () {
4859
- var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
4969
+ var _prepareAvailabilityProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
4860
4970
  var paramsWithDefaults, _yield$this$getShared, prepareKey, snapshot, contextId, projectionEntry, context, handle, payload;
4861
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4862
- while (1) switch (_context45.prev = _context45.next) {
4971
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4972
+ while (1) switch (_context46.prev = _context46.next) {
4863
4973
  case 0:
4864
4974
  this.assertAvailabilityPrepareParams(params);
4865
- _context45.next = 3;
4975
+ _context46.next = 3;
4866
4976
  return this.resolveAvailabilityPrepareDefaults(params);
4867
4977
  case 3:
4868
- paramsWithDefaults = _context45.sent;
4869
- _context45.next = 6;
4978
+ paramsWithDefaults = _context46.sent;
4979
+ _context46.next = 6;
4870
4980
  return this.getSharedPreparedAvailabilitySnapshot(paramsWithDefaults);
4871
4981
  case 6:
4872
- _yield$this$getShared = _context45.sent;
4982
+ _yield$this$getShared = _context46.sent;
4873
4983
  prepareKey = _yield$this$getShared.prepareKey;
4874
4984
  snapshot = _yield$this$getShared.snapshot;
4875
4985
  contextId = this.createAvailabilityContextId();
@@ -4890,7 +5000,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4890
5000
  refreshed: false,
4891
5001
  reason: 'prepare'
4892
5002
  };
4893
- _context45.next = 16;
5003
+ _context46.next = 16;
4894
5004
  return this.emitAvailabilityDiagnostic({
4895
5005
  action: 'prepare',
4896
5006
  contextId: contextId,
@@ -4901,15 +5011,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4901
5011
  reason: 'prepare'
4902
5012
  });
4903
5013
  case 16:
4904
- _context45.next = 18;
5014
+ _context46.next = 18;
4905
5015
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilityProjectionPrepared), payload);
4906
5016
  case 18:
4907
- return _context45.abrupt("return", handle);
5017
+ return _context46.abrupt("return", handle);
4908
5018
  case 19:
4909
5019
  case "end":
4910
- return _context45.stop();
5020
+ return _context46.stop();
4911
5021
  }
4912
- }, _callee45, this);
5022
+ }, _callee46, this);
4913
5023
  }));
4914
5024
  function prepareAvailabilityProjection(_x32) {
4915
5025
  return _prepareAvailabilityProjection.apply(this, arguments);
@@ -4919,9 +5029,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4919
5029
  }, {
4920
5030
  key: "getProductTimeRanges",
4921
5031
  value: (function () {
4922
- var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(contextId) {
5032
+ var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(contextId) {
4923
5033
  var _this$otherParams$pla2,
4924
- _this$otherParams25,
5034
+ _this$otherParams26,
4925
5035
  _context$prepareParam,
4926
5036
  _extractFixedOffsetMi,
4927
5037
  _this13 = this;
@@ -4939,19 +5049,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4939
5049
  businessDate,
4940
5050
  rememberedStartAtByProductId,
4941
5051
  allowOutsideOperatingHoursForRequestedStartTimes,
4942
- _args46 = arguments;
4943
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4944
- while (1) switch (_context46.prev = _context46.next) {
5052
+ _args47 = arguments;
5053
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5054
+ while (1) switch (_context47.prev = _context47.next) {
4945
5055
  case 0:
4946
- request = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {};
4947
- _context46.next = 3;
5056
+ request = _args47.length > 1 && _args47[1] !== undefined ? _args47[1] : {};
5057
+ _context47.next = 3;
4948
5058
  return this.ensureAvailabilityContextProjection(contextId, 'get_product_time_ranges');
4949
5059
  case 3:
4950
- _yield$this$ensureAva = _context46.sent;
5060
+ _yield$this$ensureAva = _context47.sent;
4951
5061
  context = _yield$this$ensureAva.context;
4952
5062
  projectionEntry = _yield$this$ensureAva.projectionEntry;
4953
5063
  contextVersion = context.activeVersion;
4954
- isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
5064
+ isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
4955
5065
  isEditingContext = Boolean((_context$prepareParam = context.prepareParams.editingProductLineUids) === null || _context$prepareParam === void 0 ? void 0 : _context$prepareParam.length);
4956
5066
  editingOffset = (_extractFixedOffsetMi = extractFixedOffsetMinutes(projectionEntry.projection.meta.now)) !== null && _extractFixedOffsetMi !== void 0 ? _extractFixedOffsetMi : this.getAvailabilityRuntimeOffsetMinutes(); // This new editing input represents an absolute instant. Normalize it once
4957
5067
  // to the projection's fixed business clock before the wall-clock planner.
@@ -4982,7 +5092,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4982
5092
  allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && !rememberedStartAtByProductId && (editingStarts.length > 0 || Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
4983
5093
  return Array.isArray(startTimes) && startTimes.length > 0;
4984
5094
  }));
4985
- return _context46.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), {}, {
5095
+ return _context47.abrupt("return", getProjectionProductTimeRanges(projectionEntry.projection, _objectSpread(_objectSpread(_objectSpread({}, request), {}, {
4986
5096
  dateRange: dateRange,
4987
5097
  editingStartAtByProductId: editingStartAtByProductId,
4988
5098
  rememberedStartAtByProductId: rememberedStartAtByProductId
@@ -5006,9 +5116,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5006
5116
  }));
5007
5117
  case 17:
5008
5118
  case "end":
5009
- return _context46.stop();
5119
+ return _context47.stop();
5010
5120
  }
5011
- }, _callee46, this);
5121
+ }, _callee47, this);
5012
5122
  }));
5013
5123
  function getProductTimeRanges(_x33) {
5014
5124
  return _getProductTimeRanges.apply(this, arguments);
@@ -5018,21 +5128,21 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5018
5128
  }, {
5019
5129
  key: "queryBookingAvailability",
5020
5130
  value: (function () {
5021
- var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(contextId, request) {
5022
- var _this$otherParams$pla3, _this$otherParams26, _context$prepareParam2;
5131
+ var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId, request) {
5132
+ var _this$otherParams$pla3, _this$otherParams27, _context$prepareParam2;
5023
5133
  var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, queryRequest, result, contextVersion, contextualResult;
5024
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5025
- while (1) switch (_context47.prev = _context47.next) {
5134
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5135
+ while (1) switch (_context48.prev = _context48.next) {
5026
5136
  case 0:
5027
- _context47.next = 2;
5137
+ _context48.next = 2;
5028
5138
  return this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
5029
5139
  case 2:
5030
- _yield$this$ensureAva2 = _context47.sent;
5140
+ _yield$this$ensureAva2 = _context48.sent;
5031
5141
  context = _yield$this$ensureAva2.context;
5032
5142
  projectionEntry = _yield$this$ensureAva2.projectionEntry;
5033
5143
  refreshed = _yield$this$ensureAva2.refreshed;
5034
5144
  this.assertContextualQueryFreshness(context, request);
5035
- isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
5145
+ isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
5036
5146
  queryRequest = request.target === 'date' || request.target === 'product' ? _objectSpread(_objectSpread({}, request), {}, {
5037
5147
  dateRange: request.dateRange || this.getAvailabilityBusinessDateRange(projectionEntry.projection)
5038
5148
  }) : request;
@@ -5068,16 +5178,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5068
5178
  });
5069
5179
  })
5070
5180
  }) : result;
5071
- return _context47.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
5181
+ return _context48.abrupt("return", _objectSpread(_objectSpread({}, contextualResult), {}, {
5072
5182
  contextId: context.contextId,
5073
5183
  contextVersion: contextVersion,
5074
5184
  refreshed: refreshed
5075
5185
  }));
5076
5186
  case 13:
5077
5187
  case "end":
5078
- return _context47.stop();
5188
+ return _context48.stop();
5079
5189
  }
5080
- }, _callee47, this);
5190
+ }, _callee48, this);
5081
5191
  }));
5082
5192
  function queryBookingAvailability(_x34, _x35) {
5083
5193
  return _queryBookingAvailability.apply(this, arguments);
@@ -5144,25 +5254,70 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5144
5254
  return bookingUid && getBookingUid(booking) === bookingUid || productUid && String((_booking$product_uid3 = booking.product_uid) !== null && _booking$product_uid3 !== void 0 ? _booking$product_uid3 : '') === productUid;
5145
5255
  });
5146
5256
  }
5147
-
5148
- /** Revalidates against the latest landed occupancy cache, then mutates exactly one product line. */
5257
+ }, {
5258
+ key: "removeBookingProductsOutsideStartDate",
5259
+ value: function () {
5260
+ var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(startDate) {
5261
+ var _this$getTempOrder4,
5262
+ _this$otherParams28,
5263
+ _this14 = this;
5264
+ var products, targetDate, identities;
5265
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5266
+ while (1) switch (_context49.prev = _context49.next) {
5267
+ case 0:
5268
+ products = ((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || [];
5269
+ if (!(((_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.enforceSingleBookingStartDate) !== true)) {
5270
+ _context49.next = 3;
5271
+ break;
5272
+ }
5273
+ return _context49.abrupt("return", products);
5274
+ case 3:
5275
+ targetDate = getVisibleCalendarDate(startDate);
5276
+ if (targetDate) {
5277
+ _context49.next = 6;
5278
+ break;
5279
+ }
5280
+ return _context49.abrupt("return", products);
5281
+ case 6:
5282
+ identities = products.flatMap(function (product) {
5283
+ var _product$metadata7;
5284
+ if (!getProductLineUid(product) || (product === null || product === void 0 || (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.product_add_schedule_time) != null) {
5285
+ return [];
5286
+ }
5287
+ var booking = _this14.findLinkedBooking(product);
5288
+ if (!booking || isFulfillmentTimingBooking(booking)) return [];
5289
+ var bookingDate = getVisibleCalendarDate(booking.start_date);
5290
+ return bookingDate && bookingDate !== targetDate ? [buildAvailabilityLineIdentity(product)] : [];
5291
+ });
5292
+ return _context49.abrupt("return", identities.length ? this.removeProductsFromOrder(identities) : products);
5293
+ case 8:
5294
+ case "end":
5295
+ return _context49.stop();
5296
+ }
5297
+ }, _callee49, this);
5298
+ }));
5299
+ function removeBookingProductsOutsideStartDate(_x36) {
5300
+ return _removeBookingProductsOutsideStartDate.apply(this, arguments);
5301
+ }
5302
+ return removeBookingProductsOutsideStartDate;
5303
+ }() /** Revalidates against the latest landed occupancy cache, then mutates exactly one product line. */
5149
5304
  }, {
5150
5305
  key: "commitAvailabilitySelection",
5151
5306
  value: (function () {
5152
- var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId, params) {
5307
+ var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(contextId, params) {
5153
5308
  var _this$otherParams$pla4,
5154
- _this$otherParams27,
5309
+ _this$otherParams29,
5155
5310
  _params$availabilityC,
5156
5311
  _this$store$order11,
5157
5312
  _this$store$order11$e,
5158
- _this14 = this;
5159
- var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref55, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla5, _this$otherParams28, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla6, _this$otherParams29, _ref56, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref57, _ref58, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, _params$orderProduct9, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, selectedProduct, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, candidateBusinessDate, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, legacyBooking, legacyResources, selectedResources, resourceKeys, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref59, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _params$salesNotes, _params$salesNotes2, _ref60, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
5160
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5161
- while (1) switch (_context48.prev = _context48.next) {
5313
+ _this15 = this;
5314
+ var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref55, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla5, _this$otherParams30, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla6, _this$otherParams31, _ref56, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref57, _ref58, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, _params$orderProduct9, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, selectedProduct, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, candidateBusinessDate, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, legacyBooking, legacyResources, selectedResources, resourceKeys, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref59, _transformed$product_4, _this$getTempOrder5, _this$getTempOrder6, _params$salesNotes, _params$salesNotes2, _ref60, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
5315
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5316
+ while (1) switch (_context50.prev = _context50.next) {
5162
5317
  case 0:
5163
5318
  normalizedContextId = String(contextId || '').trim();
5164
5319
  if (normalizedContextId) {
5165
- _context48.next = 3;
5320
+ _context50.next = 3;
5166
5321
  break;
5167
5322
  }
5168
5323
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'commitAvailabilitySelection 缺少 contextId', {
@@ -5170,8 +5325,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5170
5325
  });
5171
5326
  case 3:
5172
5327
  isRememberedSelection = params.selectionIntent === 'remembered';
5173
- if (!(isRememberedSelection && (String((_this$otherParams$pla4 = (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add'))) {
5174
- _context48.next = 6;
5328
+ if (!(isRememberedSelection && (String((_this$otherParams$pla4 = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add'))) {
5329
+ _context50.next = 6;
5175
5330
  break;
5176
5331
  }
5177
5332
  throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
@@ -5182,27 +5337,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5182
5337
  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);
5183
5338
  rememberedOrder = hasCommitGuard ? this.getTempOrder() : null;
5184
5339
  getRememberedCommitIdentity = function getRememberedCommitIdentity() {
5185
- var _this14$otherParams$s, _this14$otherParams, _this14$otherParams2, _this14$core, _this14$getTempOrder, _this14$getTempOrder2;
5340
+ var _this15$otherParams$s, _this15$otherParams, _this15$otherParams2, _this15$core, _this15$getTempOrder, _this15$getTempOrder2;
5186
5341
  return JSON.stringify(stableValue({
5187
- scope: _this14.getAvailabilityScopeDescriptor(),
5188
- shopId: (_this14$otherParams$s = (_this14$otherParams = _this14.otherParams) === null || _this14$otherParams === void 0 ? void 0 : _this14$otherParams.shop_id) !== null && _this14$otherParams$s !== void 0 ? _this14$otherParams$s : (_this14$otherParams2 = _this14.otherParams) === null || _this14$otherParams2 === void 0 ? void 0 : _this14$otherParams2.shopId,
5189
- contextShopId: (_this14$core = _this14.core) === null || _this14$core === void 0 || (_this14$core = _this14$core.context) === null || _this14$core === void 0 ? void 0 : _this14$core.shop_id,
5190
- orderId: (_this14$getTempOrder = _this14.getTempOrder()) === null || _this14$getTempOrder === void 0 ? void 0 : _this14$getTempOrder.order_id,
5191
- externalSaleNumber: (_this14$getTempOrder2 = _this14.getTempOrder()) === null || _this14$getTempOrder2 === void 0 ? void 0 : _this14$getTempOrder2.external_sale_number
5342
+ scope: _this15.getAvailabilityScopeDescriptor(),
5343
+ shopId: (_this15$otherParams$s = (_this15$otherParams = _this15.otherParams) === null || _this15$otherParams === void 0 ? void 0 : _this15$otherParams.shop_id) !== null && _this15$otherParams$s !== void 0 ? _this15$otherParams$s : (_this15$otherParams2 = _this15.otherParams) === null || _this15$otherParams2 === void 0 ? void 0 : _this15$otherParams2.shopId,
5344
+ contextShopId: (_this15$core = _this15.core) === null || _this15$core === void 0 || (_this15$core = _this15$core.context) === null || _this15$core === void 0 ? void 0 : _this15$core.shop_id,
5345
+ orderId: (_this15$getTempOrder = _this15.getTempOrder()) === null || _this15$getTempOrder === void 0 ? void 0 : _this15$getTempOrder.order_id,
5346
+ externalSaleNumber: (_this15$getTempOrder2 = _this15.getTempOrder()) === null || _this15$getTempOrder2 === void 0 ? void 0 : _this15$getTempOrder2.external_sale_number
5192
5347
  }));
5193
5348
  };
5194
5349
  rememberedCommitIdentity = hasCommitGuard ? getRememberedCommitIdentity() : '';
5195
5350
  availabilityCommitTargetGuard = function availabilityCommitTargetGuard() {
5196
- return _this14.getTempOrder() === rememberedOrder && getRememberedCommitIdentity() === rememberedCommitIdentity;
5351
+ return _this15.getTempOrder() === rememberedOrder && getRememberedCommitIdentity() === rememberedCommitIdentity;
5197
5352
  };
5198
5353
  guardedCommitPublished = false;
5199
- _context48.next = 16;
5354
+ _context50.next = 16;
5200
5355
  return this.tryAcquireAvailabilityCommitLock(normalizedContextId);
5201
5356
  case 16:
5202
- _context48.prev = 16;
5357
+ _context50.prev = 16;
5203
5358
  bookingCount = Number((_params$bookingCount = params.bookingCount) !== null && _params$bookingCount !== void 0 ? _params$bookingCount : 1);
5204
5359
  if (!(!Number.isInteger(bookingCount) || bookingCount <= 0)) {
5205
- _context48.next = 20;
5360
+ _context50.next = 20;
5206
5361
  break;
5207
5362
  }
5208
5363
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'bookingCount 必须是正整数', {
@@ -5210,7 +5365,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5210
5365
  });
5211
5366
  case 20:
5212
5367
  if (!(params.mode === 'edit' && bookingCount !== 1)) {
5213
- _context48.next = 22;
5368
+ _context50.next = 22;
5214
5369
  break;
5215
5370
  }
5216
5371
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', '编辑预约商品时 bookingCount 必须为 1', {
@@ -5219,7 +5374,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5219
5374
  case 22:
5220
5375
  orderProductQuantity = (_ref55 = (_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 && _ref55 !== void 0 ? _ref55 : (_params$orderProduct3 = params.orderProduct) === null || _params$orderProduct3 === void 0 || (_params$orderProduct3 = _params$orderProduct3._extend) === null || _params$orderProduct3 === void 0 ? void 0 : _params$orderProduct3.quantity;
5221
5376
  if (!(orderProductQuantity !== undefined && orderProductQuantity !== null && Number(orderProductQuantity) !== bookingCount)) {
5222
- _context48.next = 25;
5377
+ _context50.next = 25;
5223
5378
  break;
5224
5379
  }
5225
5380
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'orderProduct 数量与 bookingCount 不一致', {
@@ -5229,22 +5384,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5229
5384
  case 25:
5230
5385
  partySize = Number(params.partySize);
5231
5386
  if (!(!Number.isInteger(partySize) || partySize <= 0)) {
5232
- _context48.next = 28;
5387
+ _context50.next = 28;
5233
5388
  break;
5234
5389
  }
5235
5390
  throw new AvailabilityError('INVALID_RESERVATION_QUANTITY', 'partySize 必须是正整数', {
5236
5391
  partySize: params.partySize
5237
5392
  });
5238
5393
  case 28:
5239
- _context48.next = 30;
5394
+ _context50.next = 30;
5240
5395
  return this.ensureAvailabilityContextProjection(normalizedContextId, 'commit_precheck');
5241
5396
  case 30:
5242
- _yield$this$ensureAva3 = _context48.sent;
5397
+ _yield$this$ensureAva3 = _context50.sent;
5243
5398
  context = _yield$this$ensureAva3.context;
5244
5399
  projectionEntry = _yield$this$ensureAva3.projectionEntry;
5245
5400
  refreshed = _yield$this$ensureAva3.refreshed;
5246
5401
  if (!refreshed) {
5247
- _context48.next = 36;
5402
+ _context50.next = 36;
5248
5403
  break;
5249
5404
  }
5250
5405
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -5255,11 +5410,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5255
5410
  case 36:
5256
5411
  boundEditingUids = context.prepareParams.editingProductLineUids || [];
5257
5412
  if (!(params.mode === 'edit')) {
5258
- _context48.next = 42;
5413
+ _context50.next = 42;
5259
5414
  break;
5260
5415
  }
5261
5416
  if (!(!params.productLineUid || !boundEditingUids.includes(String(params.productLineUid)))) {
5262
- _context48.next = 40;
5417
+ _context50.next = 40;
5263
5418
  break;
5264
5419
  }
5265
5420
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 与当前商品行不匹配,请重新 prepare 编辑上下文', {
@@ -5268,11 +5423,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5268
5423
  editingProductLineUids: boundEditingUids
5269
5424
  });
5270
5425
  case 40:
5271
- _context48.next = 44;
5426
+ _context50.next = 44;
5272
5427
  break;
5273
5428
  case 42:
5274
5429
  if (!(boundEditingUids.length > 0)) {
5275
- _context48.next = 44;
5430
+ _context50.next = 44;
5276
5431
  break;
5277
5432
  }
5278
5433
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'edit context 不能用于 add,请重新 prepare 新增上下文', {
@@ -5281,7 +5436,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5281
5436
  });
5282
5437
  case 44:
5283
5438
  if (!(projectionEntry.contextVersion !== context.activeVersion)) {
5284
- _context48.next = 46;
5439
+ _context50.next = 46;
5285
5440
  break;
5286
5441
  }
5287
5442
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', 'availability context 已刷新,请重新获取候选', {
@@ -5291,7 +5446,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5291
5446
  });
5292
5447
  case 46:
5293
5448
  if (!(projectionEntry.orderRevision !== this.getCurrentOrderRevision())) {
5294
- _context48.next = 48;
5449
+ _context50.next = 48;
5295
5450
  break;
5296
5451
  }
5297
5452
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '购物车已变化,请重新获取候选', {
@@ -5302,7 +5457,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5302
5457
  });
5303
5458
  case 48:
5304
5459
  if (!(projectionEntry.contextVersion !== params.candidate.availabilityContextVersion)) {
5305
- _context48.next = 50;
5460
+ _context50.next = 50;
5306
5461
  break;
5307
5462
  }
5308
5463
  throw this.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '候选已过期,请重新获取最新时间段', {
@@ -5314,7 +5469,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5314
5469
  this.assertAvailabilityCandidateFreshness(context, params.candidate);
5315
5470
  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;
5316
5471
  if (sameAvailabilityId(orderProductId, params.candidate.productId)) {
5317
- _context48.next = 54;
5472
+ _context50.next = 54;
5318
5473
  break;
5319
5474
  }
5320
5475
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 与 candidate 商品不一致', {
@@ -5323,14 +5478,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5323
5478
  });
5324
5479
  case 54:
5325
5480
  if (!(params.mode === 'edit' && !params.productLineUid)) {
5326
- _context48.next = 56;
5481
+ _context50.next = 56;
5327
5482
  break;
5328
5483
  }
5329
5484
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', 'edit 模式必须提供 productLineUid');
5330
5485
  case 56:
5331
5486
  editingLine = params.mode === 'edit' ? this.findProductLineByUid(String(params.productLineUid)) : undefined;
5332
5487
  if (!(params.mode === 'edit' && !editingLine)) {
5333
- _context48.next = 59;
5488
+ _context50.next = 59;
5334
5489
  break;
5335
5490
  }
5336
5491
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '找不到要编辑的预约商品行', {
@@ -5338,7 +5493,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5338
5493
  });
5339
5494
  case 59:
5340
5495
  if (!(editingLine && !sameAvailabilityId((_editingLine$product_ = editingLine.product_id) !== null && _editingLine$product_ !== void 0 ? _editingLine$product_ : editingLine.id, params.candidate.productId))) {
5341
- _context48.next = 61;
5496
+ _context50.next = 61;
5342
5497
  break;
5343
5498
  }
5344
5499
  throw new AvailabilityError('INVALID_TARGET_FILTER', '编辑商品行与 candidate 商品不一致', {
@@ -5348,7 +5503,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5348
5503
  });
5349
5504
  case 61:
5350
5505
  if (Array.isArray(params.requirementSelections)) {
5351
- _context48.next = 63;
5506
+ _context50.next = 63;
5352
5507
  break;
5353
5508
  }
5354
5509
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'requirementSelections 必须是数组', {
@@ -5359,8 +5514,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5359
5514
  selectedProduct = baseProjection.products.find(function (item) {
5360
5515
  return sameAvailabilityId(item.id, params.candidate.productId);
5361
5516
  });
5362
- if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform) !== null && _this$otherParams$pla5 !== void 0 ? _this$otherParams$pla5 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add' || (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) !== 'duration'))) {
5363
- _context48.next = 67;
5517
+ if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform) !== null && _this$otherParams$pla5 !== void 0 ? _this$otherParams$pla5 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add' || (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) !== 'duration'))) {
5518
+ _context50.next = 67;
5364
5519
  break;
5365
5520
  }
5366
5521
  throw new AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
@@ -5374,7 +5529,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5374
5529
  };
5375
5530
  prepareParams = baseProjection.meta.prepareParams;
5376
5531
  if (prepareParams) {
5377
- _context48.next = 71;
5532
+ _context50.next = 71;
5378
5533
  break;
5379
5534
  }
5380
5535
  throw new AvailabilityError('REVALIDATION_FAILED', 'projection 缺少 prepareParams,无法执行缓存重校验');
@@ -5386,7 +5541,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5386
5541
  })),
5387
5542
  includesInjectedRawOccupancies: true
5388
5543
  };
5389
- _context48.next = 74;
5544
+ _context50.next = 74;
5390
5545
  return this.buildAvailabilityProjectionSnapshot(_objectSpread(_objectSpread({}, this.cloneAvailabilityPrepareParams(prepareParams)), {}, {
5391
5546
  editingProductLineUids: params.mode === 'edit' && params.productLineUid ? [params.productLineUid] : []
5392
5547
  }), {
@@ -5395,13 +5550,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5395
5550
  durationCandidateAnchorAt: this.getAvailabilityDurationCandidateAnchorAt(baseProjection) || context.durationCandidateAnchorAt
5396
5551
  });
5397
5552
  case 74:
5398
- commitSnapshot = _context48.sent;
5553
+ commitSnapshot = _context50.sent;
5399
5554
  refreshedProjection = commitSnapshot.projection;
5400
5555
  if (!(String((_refreshedProjection$ = refreshedProjection.meta.orderRevision) !== null && _refreshedProjection$ !== void 0 ? _refreshedProjection$ : '') !== String((_baseProjection$meta$2 = baseProjection.meta.orderRevision) !== null && _baseProjection$meta$2 !== void 0 ? _baseProjection$meta$2 : ''))) {
5401
- _context48.next = 81;
5556
+ _context50.next = 81;
5402
5557
  break;
5403
5558
  }
5404
- _context48.next = 79;
5559
+ _context50.next = 79;
5405
5560
  return this.refreshAvailabilityContextProjection({
5406
5561
  contextId: normalizedContextId,
5407
5562
  reason: 'commit_order_revision_changed',
@@ -5422,7 +5577,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5422
5577
  this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
5423
5578
  candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
5424
5579
  candidateStartTime = getCandidateStartTime(params.candidate);
5425
- allowPosAvailabilityOverride = String((_this$otherParams$pla6 = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform) !== null && _this$otherParams$pla6 !== void 0 ? _this$otherParams$pla6 : '').trim().toLowerCase() === 'pos' && !isRememberedSelection;
5580
+ allowPosAvailabilityOverride = String((_this$otherParams$pla6 = (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.platform) !== null && _this$otherParams$pla6 !== void 0 ? _this$otherParams$pla6 : '').trim().toLowerCase() === 'pos' && !isRememberedSelection;
5426
5581
  candidateBusinessDate = params.candidate.businessDate || ((selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) === 'duration' && this.usesDurationTimeGrid(refreshedProjection) ? getDurationBusinessDate(refreshedProjection, params.candidate.startAt) : params.candidate.startAt.slice(0, 10));
5427
5582
  refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
5428
5583
  productIds: [params.candidate.productId],
@@ -5456,7 +5611,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5456
5611
  return candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt;
5457
5612
  });
5458
5613
  if (refreshedCandidateBase) {
5459
- _context48.next = 90;
5614
+ _context50.next = 90;
5460
5615
  break;
5461
5616
  }
5462
5617
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后候选时间已不在商品配置中', {
@@ -5469,7 +5624,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5469
5624
  return sameAvailabilityId(item.id, refreshedCandidateBase.productId);
5470
5625
  });
5471
5626
  if (product) {
5472
- _context48.next = 93;
5627
+ _context50.next = 93;
5473
5628
  break;
5474
5629
  }
5475
5630
  throw new AvailabilityError('REVALIDATION_FAILED', '缓存重校验后商品不在 projection 中', {
@@ -5508,7 +5663,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5508
5663
  });
5509
5664
  }
5510
5665
  if (validation.ok) {
5511
- _context48.next = 98;
5666
+ _context50.next = 98;
5512
5667
  break;
5513
5668
  }
5514
5669
  capacityConflict = validation.conflicts.find(function (conflict) {
@@ -5531,7 +5686,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5531
5686
  incrementVersion: true
5532
5687
  });
5533
5688
  revalidatedContext = this.getAvailabilityContextEntry(normalizedContextId);
5534
- _context48.next = 102;
5689
+ _context50.next = 102;
5535
5690
  return this.emitAvailabilityDiagnostic({
5536
5691
  action: 'refresh',
5537
5692
  contextId: normalizedContextId,
@@ -5555,9 +5710,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5555
5710
  availabilityCommitGuard = hasCommitGuard ? function () {
5556
5711
  var _params$availabilityC2;
5557
5712
  (_params$availabilityC2 = params.availabilityCommitGuard) === null || _params$availabilityC2 === void 0 || _params$availabilityC2.call(params);
5558
- _this14.assertAvailabilityCommitWriteCAS(commitWriteGuard);
5713
+ _this15.assertAvailabilityCommitWriteCAS(commitWriteGuard);
5559
5714
  if (!availabilityCommitTargetGuard()) {
5560
- throw _this14.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '记忆时间加购期间订单或业务已变化');
5715
+ throw _this15.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '记忆时间加购期间订单或业务已变化');
5561
5716
  }
5562
5717
  if (!isRememberedSelection) return;
5563
5718
  var currentValidation = validateAvailabilitySelection(refreshedProjection, {
@@ -5578,7 +5733,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5578
5733
  existingBooking = editingLine ? this.findLinkedBooking(editingLine) : undefined;
5579
5734
  existingBookingUid = existingBooking ? getBookingUid(existingBooking) : '';
5580
5735
  if (!(params.mode === 'edit' && !existingBookingUid)) {
5581
- _context48.next = 109;
5736
+ _context50.next = 109;
5582
5737
  break;
5583
5738
  }
5584
5739
  throw new AvailabilityError('PRODUCT_LINE_NOT_FOUND', '编辑商品行缺少关联 booking', {
@@ -5596,7 +5751,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5596
5751
  holderIds: (_ref57 = (_ref58 = (_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 && _ref58 !== void 0 ? _ref58 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref57 !== void 0 ? _ref57 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
5597
5752
  });
5598
5753
  if (!(isRememberedSelection && (_params$orderProduct9 = params.orderProduct) !== null && _params$orderProduct9 !== void 0 && (_params$orderProduct9 = _params$orderProduct9._extend) !== null && _params$orderProduct9 !== void 0 && _params$orderProduct9.resource)) {
5599
- _context48.next = 119;
5754
+ _context50.next = 119;
5600
5755
  break;
5601
5756
  }
5602
5757
  // AutoClose 与编辑共用旧资源协议。仅复用其结构,实际资源及每份容量
@@ -5616,7 +5771,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5616
5771
  return sameAvailabilityId(selected.form_id, resource.form_id);
5617
5772
  });
5618
5773
  }))) {
5619
- _context48.next = 118;
5774
+ _context50.next = 118;
5620
5775
  break;
5621
5776
  }
5622
5777
  throw new AvailabilityError('REVALIDATION_FAILED', '记忆时间的资源与本次校验结果不一致');
@@ -5633,7 +5788,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5633
5788
  quantity: bookingCount
5634
5789
  }), 'unified_booking_sales', product);
5635
5790
  if (transformed) {
5636
- _context48.next = 122;
5791
+ _context50.next = 122;
5637
5792
  break;
5638
5793
  }
5639
5794
  throw new AvailabilityError('INVALID_TARGET_FILTER', 'orderProduct 无法转换为订单行', {
@@ -5652,7 +5807,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5652
5807
  productLineUids = [];
5653
5808
  bookingUids = [];
5654
5809
  if (!(params.mode === 'edit' && editingLine && params.productLineUid)) {
5655
- _context48.next = 141;
5810
+ _context50.next = 143;
5656
5811
  break;
5657
5812
  }
5658
5813
  transformed.product_sku = (_transformed$product_ = transformed.product_sku) !== null && _transformed$product_ !== void 0 ? _transformed$product_ : editingLine.product_sku;
@@ -5662,7 +5817,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5662
5817
  unique_identification_number: params.productLineUid,
5663
5818
  booking_uid: existingBookingUid
5664
5819
  });
5665
- _context48.next = 135;
5820
+ _context50.next = 135;
5666
5821
  return this.updateOrderProduct(_objectSpread(_objectSpread({
5667
5822
  product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
5668
5823
  product_variant_id: (_ref59 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref59 !== void 0 ? _ref59 : 0,
@@ -5675,29 +5830,36 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5675
5830
  allow_booking_discount_reapply: params.allowBookingDiscountReapply
5676
5831
  } : {}));
5677
5832
  case 135:
5833
+ _context50.next = 137;
5834
+ return this.removeBookingProductsOutsideStartDate(booking.start_date);
5835
+ case 137:
5678
5836
  productLineUid = params.productLineUid;
5679
5837
  bookingUid = existingBookingUid;
5680
5838
  productLineUids = [productLineUid];
5681
5839
  bookingUids = [bookingUid];
5682
- _context48.next = 155;
5840
+ _context50.next = 160;
5683
5841
  break;
5684
- case 141:
5685
- beforeProductLineUids = new Set((((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || []).map(function (line) {
5842
+ case 143:
5843
+ beforeProductLineUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.products) || []).map(function (line) {
5686
5844
  return getProductLineUid(line);
5687
5845
  }).filter(Boolean));
5688
- beforeBookingUids = new Set((((_this$getTempOrder5 = this.getTempOrder()) === null || _this$getTempOrder5 === void 0 ? void 0 : _this$getTempOrder5.bookings) || []).map(function (item) {
5846
+ beforeBookingUids = new Set((((_this$getTempOrder6 = this.getTempOrder()) === null || _this$getTempOrder6 === void 0 ? void 0 : _this$getTempOrder6.bookings) || []).map(function (item) {
5689
5847
  return getBookingUid(item);
5690
5848
  }).filter(Boolean));
5691
5849
  availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
5692
- _context48.next = 146;
5850
+ _context50.next = 148;
5693
5851
  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 ? {
5694
5852
  salesNotes: params.salesNotes
5695
5853
  } : {}), availabilityCommitGuard ? {
5696
5854
  availabilityCommitGuard: availabilityCommitGuard,
5697
5855
  availabilityCommitTargetGuard: availabilityCommitTargetGuard
5698
5856
  } : {}) : undefined);
5699
- case 146:
5700
- products = _context48.sent;
5857
+ case 148:
5858
+ products = _context50.sent;
5859
+ _context50.next = 151;
5860
+ return this.removeBookingProductsOutsideStartDate(booking.start_date);
5861
+ case 151:
5862
+ products = _context50.sent;
5701
5863
  guardedCommitPublished = hasCommitGuard;
5702
5864
  addedLines = products.filter(function (line) {
5703
5865
  var _line$product_id, _line$metadata;
@@ -5721,7 +5883,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5721
5883
  }
5722
5884
  productLineUid = productLineUids[productLineUids.length - 1] || '';
5723
5885
  bookingUid = bookingUids[bookingUids.length - 1] || '';
5724
- case 155:
5886
+ case 160:
5725
5887
  targetStillCurrent = !hasCommitGuard || availabilityCommitTargetGuard();
5726
5888
  if (targetStillCurrent) this.invalidateAvailabilityContextsAfterCommit();else this.removeAvailabilityContext(normalizedContextId);
5727
5889
  nextContext = hasCommitGuard ? this.availabilityContextRegistry.get(normalizedContextId) : this.getAvailabilityContextEntry(normalizedContextId);
@@ -5737,60 +5899,60 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5737
5899
  bookingUids: bookingUids
5738
5900
  };
5739
5901
  if (!targetStillCurrent) {
5740
- _context48.next = 173;
5902
+ _context50.next = 178;
5741
5903
  break;
5742
5904
  }
5743
5905
  // A notification failure after publication must not invite a duplicate add.
5744
5906
  emit = function emit() {
5745
- return _this14.core.effects.emit("".concat(_this14.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
5907
+ return _this15.core.effects.emit("".concat(_this15.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
5746
5908
  };
5747
5909
  if (!guardedCommitPublished) {
5748
- _context48.next = 171;
5910
+ _context50.next = 176;
5749
5911
  break;
5750
5912
  }
5751
- _context48.prev = 162;
5752
- _context48.next = 165;
5913
+ _context50.prev = 167;
5914
+ _context50.next = 170;
5753
5915
  return emit();
5754
- case 165:
5755
- _context48.next = 169;
5916
+ case 170:
5917
+ _context50.next = 174;
5756
5918
  break;
5757
- case 167:
5758
- _context48.prev = 167;
5759
- _context48.t0 = _context48["catch"](162);
5760
- case 169:
5761
- _context48.next = 173;
5919
+ case 172:
5920
+ _context50.prev = 172;
5921
+ _context50.t0 = _context50["catch"](167);
5922
+ case 174:
5923
+ _context50.next = 178;
5762
5924
  break;
5763
- case 171:
5764
- _context48.next = 173;
5925
+ case 176:
5926
+ _context50.next = 178;
5765
5927
  return emit();
5766
- case 173:
5767
- return _context48.abrupt("return", result);
5768
- case 174:
5769
- _context48.prev = 174;
5928
+ case 178:
5929
+ return _context50.abrupt("return", result);
5930
+ case 179:
5931
+ _context50.prev = 179;
5770
5932
  release = this.releaseAvailabilityCommitLock(normalizedContextId);
5771
5933
  if (!guardedCommitPublished) {
5772
- _context48.next = 181;
5934
+ _context50.next = 186;
5773
5935
  break;
5774
5936
  }
5775
- _context48.next = 179;
5937
+ _context50.next = 184;
5776
5938
  return release.catch(function () {
5777
5939
  return undefined;
5778
5940
  });
5779
- case 179:
5780
- _context48.next = 183;
5941
+ case 184:
5942
+ _context50.next = 188;
5781
5943
  break;
5782
- case 181:
5783
- _context48.next = 183;
5944
+ case 186:
5945
+ _context50.next = 188;
5784
5946
  return release;
5785
- case 183:
5786
- return _context48.finish(174);
5787
- case 184:
5947
+ case 188:
5948
+ return _context50.finish(179);
5949
+ case 189:
5788
5950
  case "end":
5789
- return _context48.stop();
5951
+ return _context50.stop();
5790
5952
  }
5791
- }, _callee48, this, [[16,, 174, 184], [162, 167]]);
5953
+ }, _callee50, this, [[16,, 179, 189], [167, 172]]);
5792
5954
  }));
5793
- function commitAvailabilitySelection(_x36, _x37) {
5955
+ function commitAvailabilitySelection(_x37, _x38) {
5794
5956
  return _commitAvailabilitySelection.apply(this, arguments);
5795
5957
  }
5796
5958
  return commitAvailabilitySelection;