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